]> git.tuebingen.mpg.de Git - lopsub.git/commitdiff
Avoid warning about yywrap being redefined.
authorAndre Noll <maan@tuebingen.mpg.de>
Fri, 21 Apr 2017 00:55:53 +0000 (02:55 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Fri, 21 Apr 2017 01:08:04 +0000 (03:08 +0200)
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
lopsubgen.l

index 38691b7d5111a68b45b7a469d4b3f52c71fd5ee9..0b8435041fa0a1ba55546e885304ab30442a31f4 100644 (file)
@@ -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;
index f5db52b2a56830487ca8c593572899a6c32eaee0..eaed3ecc5538ff8bfdcef8be80117e4b419aa250 100644 (file)
@@ -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;