From owner-svn-src-head@FreeBSD.ORG Sat Jul 19 18:38:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1FD6CC36; Sat, 19 Jul 2014 18:38:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B92B22EB; Sat, 19 Jul 2014 18:38:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6JIcnhO003947; Sat, 19 Jul 2014 18:38:49 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6JIcnKP003942; Sat, 19 Jul 2014 18:38:49 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201407191838.s6JIcnKP003942@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Sat, 19 Jul 2014 18:38:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r268883 - in head: contrib/unbound contrib/unbound/util lib/libunbound X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Jul 2014 18:38:50 -0000 Author: des Date: Sat Jul 19 18:38:48 2014 New Revision: 268883 URL: http://svnweb.freebsd.org/changeset/base/268883 Log: Clean up the libunbound build to avoid accidentally regenerating the configuration lexer and parser during buildworld. Instead of being included in the source as it is in the upstream distribution, the code is now always generated (in ${.OBJDIR}) at build time. PR: 190739 MFC after: 1 week Deleted: head/contrib/unbound/util/configlexer.c head/contrib/unbound/util/configparser.c head/contrib/unbound/util/configparser.h Modified: head/contrib/unbound/freebsd-configure.sh head/contrib/unbound/util/config_file.c head/contrib/unbound/util/configlexer.lex head/contrib/unbound/util/configparser.y head/lib/libunbound/Makefile Modified: head/contrib/unbound/freebsd-configure.sh ============================================================================== --- head/contrib/unbound/freebsd-configure.sh Sat Jul 19 18:33:09 2014 (r268882) +++ head/contrib/unbound/freebsd-configure.sh Sat Jul 19 18:38:48 2014 (r268883) @@ -32,13 +32,6 @@ autoheader --with-run-dir=/var/unbound \ --with-username=unbound -# Regenerate the configuration parser -{ -cat <util/configlexer.c - -/usr/bin/yacc -d -o util/configparser.c util/configparser.y +# Don't try to provide bogus memory usage statistics based on sbrk(2). +sed -n -i.orig -e '/HAVE_SBRK/!p' config.status +./config.status config.h Modified: head/contrib/unbound/util/config_file.c ============================================================================== --- head/contrib/unbound/util/config_file.c Sat Jul 19 18:33:09 2014 (r268882) +++ head/contrib/unbound/util/config_file.c Sat Jul 19 18:38:48 2014 (r268883) @@ -48,7 +48,7 @@ #include "util/log.h" #include "util/configyyrename.h" #include "util/config_file.h" -#include "util/configparser.h" +#include "configparser.h" #include "util/net_help.h" #include "util/data/msgparse.h" #include "util/module.h" Modified: head/contrib/unbound/util/configlexer.lex ============================================================================== --- head/contrib/unbound/util/configlexer.lex Sat Jul 19 18:33:09 2014 (r268882) +++ head/contrib/unbound/util/configlexer.lex Sat Jul 19 18:38:48 2014 (r268883) @@ -8,6 +8,8 @@ * */ +#include "config.h" + #include #include #include @@ -16,7 +18,7 @@ #endif #include "util/config_file.h" -#include "util/configparser.h" +#include "configparser.h" void ub_c_error(const char *message); #if 0 @@ -26,13 +28,13 @@ void ub_c_error(const char *message); #endif /** avoid warning in about fwrite return value */ -#define ECHO ub_c_error_msg("syntax error at text: %s", yytext) +#define ECHO ub_c_error_msg("syntax error at text: %s", ub_c_text) /** A parser variable, this is a statement in the config file which is * of the form variable: value1 value2 ... nargs is the number of values. */ #define YDVAR(nargs, var) \ num_args=(nargs); \ - LEXOUT(("v(%s%d) ", yytext, num_args)); \ + LEXOUT(("v(%s%d) ", ub_c_text, num_args)); \ if(num_args > 0) { BEGIN(val); } \ return (var); @@ -166,7 +168,7 @@ static void config_end_include(void) #define yy_set_bol(at_bol) \ { \ if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer = yy_create_buffer( ub_c_in, YY_BUF_SIZE ); \ yy_current_buffer->yy_ch_buf[0] = ((at_bol)?'\n':' '); \ } #endif @@ -200,7 +202,7 @@ SQANY [^\'\n\r\\]|\\. LEXOUT(("SP ")); /* ignore */ } {SPACE}*{COMMENT}.* { /* note that flex makes the longest match and '.' is any but not nl */ - LEXOUT(("comment(%s) ", yytext)); /* ignore */ } + LEXOUT(("comment(%s) ", ub_c_text)); /* ignore */ } server{COLON} { YDVAR(0, VAR_SERVER) } num-threads{COLON} { YDVAR(1, VAR_NUM_THREADS) } verbosity{COLON} { YDVAR(1, VAR_VERBOSITY) } @@ -331,71 +333,71 @@ max-udp-size{COLON} { YDVAR(1, VAR_MAX_ /* Quoted strings. Strip leading and ending quotes */ \" { BEGIN(quotedstring); LEXOUT(("QS ")); } <> { - yyerror("EOF inside quoted string"); + ub_c_error("EOF inside quoted string"); if(--num_args == 0) { BEGIN(INITIAL); } else { BEGIN(val); } } -{DQANY}* { LEXOUT(("STR(%s) ", yytext)); yymore(); } -{NEWLINE} { yyerror("newline inside quoted string, no end \""); +{DQANY}* { LEXOUT(("STR(%s) ", ub_c_text)); yymore(); } +{NEWLINE} { ub_c_error("newline inside quoted string, no end \""); cfg_parser->line++; BEGIN(INITIAL); } \" { LEXOUT(("QE ")); if(--num_args == 0) { BEGIN(INITIAL); } else { BEGIN(val); } - yytext[yyleng - 1] = '\0'; - yylval.str = strdup(yytext); - if(!yylval.str) - yyerror("out of memory"); + ub_c_text[ub_c_leng - 1] = '\0'; + ub_c_lval.str = strdup(ub_c_text); + if(!ub_c_lval.str) + ub_c_error("out of memory"); return STRING_ARG; } /* Single Quoted strings. Strip leading and ending quotes */ \' { BEGIN(singlequotedstr); LEXOUT(("SQS ")); } <> { - yyerror("EOF inside quoted string"); + ub_c_error("EOF inside quoted string"); if(--num_args == 0) { BEGIN(INITIAL); } else { BEGIN(val); } } -{SQANY}* { LEXOUT(("STR(%s) ", yytext)); yymore(); } -{NEWLINE} { yyerror("newline inside quoted string, no end '"); +{SQANY}* { LEXOUT(("STR(%s) ", ub_c_text)); yymore(); } +{NEWLINE} { ub_c_error("newline inside quoted string, no end '"); cfg_parser->line++; BEGIN(INITIAL); } \' { LEXOUT(("SQE ")); if(--num_args == 0) { BEGIN(INITIAL); } else { BEGIN(val); } - yytext[yyleng - 1] = '\0'; - yylval.str = strdup(yytext); - if(!yylval.str) - yyerror("out of memory"); + ub_c_text[ub_c_leng - 1] = '\0'; + ub_c_lval.str = strdup(ub_c_text); + if(!ub_c_lval.str) + ub_c_error("out of memory"); return STRING_ARG; } /* include: directive */ include{COLON} { - LEXOUT(("v(%s) ", yytext)); inc_prev = YYSTATE; BEGIN(include); } + LEXOUT(("v(%s) ", ub_c_text)); inc_prev = YYSTATE; BEGIN(include); } <> { - yyerror("EOF inside include directive"); + ub_c_error("EOF inside include directive"); BEGIN(inc_prev); } {SPACE}* { LEXOUT(("ISP ")); /* ignore */ } {NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++;} \" { LEXOUT(("IQS ")); BEGIN(include_quoted); } {UNQUOTEDLETTER}* { - LEXOUT(("Iunquotedstr(%s) ", yytext)); - config_start_include_glob(yytext); + LEXOUT(("Iunquotedstr(%s) ", ub_c_text)); + config_start_include_glob(ub_c_text); BEGIN(inc_prev); } <> { - yyerror("EOF inside quoted string"); + ub_c_error("EOF inside quoted string"); BEGIN(inc_prev); } -{DQANY}* { LEXOUT(("ISTR(%s) ", yytext)); yymore(); } -{NEWLINE} { yyerror("newline before \" in include name"); +{DQANY}* { LEXOUT(("ISTR(%s) ", ub_c_text)); yymore(); } +{NEWLINE} { ub_c_error("newline before \" in include name"); cfg_parser->line++; BEGIN(inc_prev); } \" { LEXOUT(("IQE ")); - yytext[yyleng - 1] = '\0'; - config_start_include_glob(yytext); + ub_c_text[ub_c_leng - 1] = '\0'; + config_start_include_glob(ub_c_text); BEGIN(inc_prev); } <> { @@ -404,21 +406,21 @@ max-udp-size{COLON} { YDVAR(1, VAR_MAX_ if (!config_include_stack) { yyterminate(); } else { - fclose(yyin); + fclose(ub_c_in); config_end_include(); } } -{UNQUOTEDLETTER}* { LEXOUT(("unquotedstr(%s) ", yytext)); +{UNQUOTEDLETTER}* { LEXOUT(("unquotedstr(%s) ", ub_c_text)); if(--num_args == 0) { BEGIN(INITIAL); } - yylval.str = strdup(yytext); return STRING_ARG; } + ub_c_lval.str = strdup(ub_c_text); return STRING_ARG; } {UNQUOTEDLETTER_NOCOLON}* { - ub_c_error_msg("unknown keyword '%s'", yytext); + ub_c_error_msg("unknown keyword '%s'", ub_c_text); } <*>. { - ub_c_error_msg("stray '%s'", yytext); + ub_c_error_msg("stray '%s'", ub_c_text); } %% Modified: head/contrib/unbound/util/configparser.y ============================================================================== --- head/contrib/unbound/util/configparser.y Sat Jul 19 18:33:09 2014 (r268882) +++ head/contrib/unbound/util/configparser.y Sat Jul 19 18:38:48 2014 (r268883) @@ -44,7 +44,6 @@ #include #include -#include "util/configyyrename.h" #include "util/config_file.h" #include "util/net_help.h" Modified: head/lib/libunbound/Makefile ============================================================================== --- head/lib/libunbound/Makefile Sat Jul 19 18:33:09 2014 (r268882) +++ head/lib/libunbound/Makefile Sat Jul 19 18:38:48 2014 (r268883) @@ -10,9 +10,9 @@ UNBOUNDDIR= ${.CURDIR}/../../contrib/unb LIB= unbound PRIVATELIB= -CFLAGS= -I${UNBOUNDDIR} -I${LDNSDIR} +CFLAGS= -I${UNBOUNDDIR} -I${LDNSDIR} -I${.OBJDIR} -SRCS= alloc.c autotrust.c config_file.c configlexer.c configparser.c \ +SRCS= alloc.c autotrust.c config_file.c configlexer.l configparser.y \ context.c dname.c dns.c dnstree.c fptr_wlist.c infra.c \ iter_delegpt.c iter_donotq.c iter_fwd.c iter_hints.c iter_priv.c \ iter_resptype.c iter_scrub.c iter_utils.c iterator.c keyraw.c \ @@ -31,4 +31,13 @@ WARNS?= 3 DPADD+= ${LIBSSL} ${LIBCRYPTO} ${LIBPTHREAD} LDADD+= -lssl -lcrypto -lpthread +# Misnamed file in upstream source +configlexer.l: configlexer.lex + cp -p ${.ALLSRC} ${.TARGET} +CLEANFILES+= configlexer.l + +# Symbol prefix for lex and yacc +LFLAGS= -Pub_c_ +YFLAGS= -pub_c_ -d + .include