From e5b276f1a15604f1c7efe754074a86fabbb6bf6f Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 21 Apr 2017 02:55:53 +0200 Subject: [PATCH] Avoid warning about yywrap being redefined. The flex documentation says If you do not supply your own version of 'yywrap()', then you must either use '%option noyywrap' (in which case the scanner behaves as though 'yywrap()' returned 1), or you must link with '-lfl' to obtain the default version of the routine, which always returns 1. Unfortunately, if noyywrap is given, gcc-5.4.0 complains with config_file.c:417:0: warning: "yywrap" redefined ^ config_file.c:74:0: note: this is the location of the previous definition Just provide our own yywrap() to silence the warning. --- config_file.l | 2 +- lopsubgen.l | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config_file.l b/config_file.l index 38691b7..0b84350 100644 --- a/config_file.l +++ b/config_file.l @@ -4,7 +4,6 @@ * Licensed under the LGPL v3, see http://www.gnu.org/licenses/lgpl-3.0.html */ -%option noyywrap %option stack %option never-interactive %option yylineno @@ -29,6 +28,7 @@ OPTION [a-zA-Z]+[a-zA-Z0-9_-]* static char **rargv; static const char *subcommand; + static int yywrap(void) {return 1;} static int expand_result(void) { int nargc = rargc + 1; diff --git a/lopsubgen.l b/lopsubgen.l index f5db52b..eaed3ec 100644 --- a/lopsubgen.l +++ b/lopsubgen.l @@ -4,7 +4,6 @@ * Licensed under the GPL v3, see http://www.gnu.org/licenses/gpl-3.0.html */ -%option noyywrap %option stack %option never-interactive %option yylineno @@ -45,6 +44,7 @@ #define CUROPT (CURCMD.options[CURCMD.num_options - 1]) #define CURSECT (suite.sections[suite.num_sections - 1]) + static int yywrap(void) {return 1;} static void *xmalloc(size_t size) { void *p; -- 2.39.2