From: Peter Maydell Date: Mon, 20 Dec 2010 21:13:32 +0000 (+0000) Subject: Fix unused-function warnings in lex output X-Git-Tag: mmh-start~5 X-Git-Url: http://git.marmaro.de/?p=mmh;a=commitdiff_plain;h=4dd01e6c68874a5fc2988d63d6c26984889310a3 Fix unused-function warnings in lex output Fix the unused-function warnings in the output of lex. In particular, we silence a warning about yyunput being static but unused by exposing it as a global function. This costs us a few hundred bytes in the binary but the other available solutions are flex-specific or more complicated. YY_NO_UNPUT used to silence this but no longer works in recent flex. On the other hand YY_NO_INPUT does work to silence warnings about input(). Signed-off-by: Peter Maydell --- diff --git a/sbr/dtimep.lex b/sbr/dtimep.lex index c35c9be..0191086 100644 --- a/sbr/dtimep.lex +++ b/sbr/dtimep.lex @@ -17,7 +17,7 @@ #define yywrap() 1 #define YY_SKIP_YYWRAP -#define YY_NO_UNPUT +#define YY_NO_INPUT /* This is the tricky thing that makes this function cool. We * replace the traditional int yylex(void) declaration with our @@ -398,3 +398,16 @@ nl [ \t\n()] {nl}("hdt"|"HDT") { INIT(); SETDST(); SETZONE(-1000); yyterminate(); } .|\n + +%% +/* This is a portable way to squash a warning about the yyunput() + * function being static but never used. It costs us a tiny amount + * of extra code in the binary but the other options are: + * "%option nounput" which is flex-specific + * makefile hackery just to compile dtimep.c with different flags + */ +void dtimep_yyunput(int c) +{ + unput(c); +} +