Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Oct 2009 19:07:24 +0200 (CEST)
From:      Ulrich Spoerlein <uqs@spoerlein.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/139319: flex: fix prototypes, esp. when YY_NO_INPUT is defined
Message-ID:  <200910021707.n92H7ONP029322@roadrunner.spoerlein.net>
Resent-Message-ID: <200910022120.n92LK1IA066812@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         139319
>Category:       bin
>Synopsis:       flex: fix prototypes, esp. when YY_NO_INPUT is defined
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 02 21:20:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Ulrich Spörlein
>Release:        FreeBSD 8.0-BETA4 i386
>Organization:
>Environment:
>Description:
When YY_NO_INPUT is defined, the input function body will still be emitted,
but not the prototype. This breaks build for some software with higher
WARNS flags.
>How-To-Repeat:
Grab games/atc from DragonflyBSD and try to compile with WARNS>2
>Fix:

The fix is taken straight from DragonflyBSD, it adds more prototypes in
the YY_USE_PROTOS case and adds the missing #ifdef glue around input()
(compare this with what's done to unput())

--- flex.diff begins here ---
--- a/usr.bin/lex/flex.skl	Fri Oct 02 14:16:27 2009 +0200
+++ b/usr.bin/lex/flex.skl	Fri Oct 02 18:56:51 2009 +0200
@@ -747,7 +747,11 @@
  */
 
 %-
+#ifdef YY_USE_PROTOS
+static int yy_get_next_buffer( void )
+#else
 static int yy_get_next_buffer()
+#endif
 %+
 int yyFlexLexer::yy_get_next_buffer()
 %*
@@ -883,7 +887,11 @@
 /* yy_get_previous_state - get the state just before the EOB char was reached */
 
 %-
+#ifdef YY_USE_PROTOS
+static yy_state_type yy_get_previous_state( void )
+#else
 static yy_state_type yy_get_previous_state()
+#endif
 %+
 yy_state_type yyFlexLexer::yy_get_previous_state()
 %*
@@ -979,11 +987,16 @@
 
 
 %-
+#ifndef YY_NO_INPUT
 #ifdef __cplusplus
 static int yyinput()
 #else
+#ifdef YY_USE_PROTOS
+static int input( void )
+#else
 static int input()
 #endif
+#endif
 %+
 int yyFlexLexer::yyinput()
 %*
@@ -1054,6 +1067,9 @@
 
 	return c;
 	}
+%-
+#endif	/* ifndef YY_NO_INPUT */
+%*
 
 
 %-
@@ -1402,7 +1418,11 @@
 
 #ifndef YY_NO_POP_STATE
 %-
+#ifdef YY_USE_PROTOS
+static void yy_pop_state( void )
+#else
 static void yy_pop_state()
+#endif
 %+
 void yyFlexLexer::yy_pop_state()
 %*
@@ -1417,7 +1437,11 @@
 
 #ifndef YY_NO_TOP_STATE
 %-
+#ifdef YY_USE_PROTOS
+static int yy_top_state( void )
+#else
 static int yy_top_state()
+#endif
 %+
 int yyFlexLexer::yy_top_state()
 %*
--- flex.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910021707.n92H7ONP029322>