PATCH: gengtype-lex.l warning

Ben Elliston
Mon Jan 5 10:51:00 GMT 2009

For various versions of flex that I tested, gengtype-lex.l produces a
gengtype-lex.c that contains a static input() function.  This function
is never called, leading to a warning when building the tools in the
gcc/build/ directory:

    gengtype-lex.c:1908: warning: ‘input’ defined but not used

This can be suppressed by defining YY_NO_INPUT in the C preamble section
of the flex file.  This should not cause any problems for earlier
versions that do not conditionally compile the input function based on
the value of YY_NO_INPUT (this is only hypothetical; all the versions of
flex, new and old, that I tried all support this).

Okay for the trunk?


2009-01-05  Ben Elliston  <>

        * gengtype-lex.l (YY_NO_INPUT): Define.

Index: gengtype-lex.l
--- gengtype-lex.l      (revision 143072)
+++ gengtype-lex.l      (working copy)
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3.  
 #include "gengtype.h"
+#define YY_NO_INPUT
 #define YY_DECL int yylex (const char **yylval)
 #define yyterminate() return EOF_TOKEN

More information about the Gcc-patches mailing list