rpms/flex/devel flex-2.5.4a2-shapwarn.patch, NONE, 1.1 flex.spec, 1.18, 1.19

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed Jan 18 10:40:50 UTC 2006


Author: pmachata

Update of /cvs/dist/rpms/flex/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv24184

Modified Files:
	flex.spec 
Added Files:
	flex-2.5.4a2-shapwarn.patch 
Log Message:
Applying Jonathan S. Shapiro's bugfix-fixing patch. More std:: fixes
and better way to silent warnings under gcc.


flex-2.5.4a2-shapwarn.patch:
 gen.c  |   10 +++++-----
 skel.c |   21 ++++++++++-----------
 2 files changed, 15 insertions(+), 16 deletions(-)

--- NEW FILE flex-2.5.4a2-shapwarn.patch ---
diff -Burp flex-2.5.4/gen.c flex-2.5.4shap/gen.c
--- flex-2.5.4/gen.c	1997-07-26 22:32:18.000000000 -0400
+++ flex-2.5.4shap/gen.c	2006-01-15 11:49:20.000000000 -0500
@@ -1437,7 +1437,7 @@ void make_tables()
 		indent_puts( "if ( yy_act == 0 )" );
 		indent_up();
 		indent_puts( C_plus_plus ?
-			"cerr << \"--scanner backing up\\n\";" :
+			"std::cerr << \"--scanner backing up\\n\";" :
 			"fprintf( stderr, \"--scanner backing up\\n\" );" );
 		indent_down();
 
@@ -1448,7 +1448,7 @@ void make_tables()
 		if ( C_plus_plus )
 			{
 			indent_puts(
-	"cerr << \"--accepting rule at line \" << yy_rule_linenum[yy_act] <<" );
+	"std::cerr << \"--accepting rule at line \" << yy_rule_linenum[yy_act] <<" );
 			indent_puts(
 			"         \"(\\\"\" << yytext << \"\\\")\\n\";" );
 			}
@@ -1470,7 +1470,7 @@ void make_tables()
 		if ( C_plus_plus )
 			{
 			indent_puts(
-"cerr << \"--accepting default rule (\\\"\" << yytext << \"\\\")\\n\";" );
+"std::cerr << \"--accepting default rule (\\\"\" << yytext << \"\\\")\\n\";" );
 			}
 		else
 			{
@@ -1486,7 +1486,7 @@ void make_tables()
 		indent_up();
 
 		indent_puts( C_plus_plus ?
-			"cerr << \"--(end of buffer or a NUL)\\n\";" :
+			"std::cerr << \"--(end of buffer or a NUL)\\n\";" :
 		"fprintf( stderr, \"--(end of buffer or a NUL)\\n\" );" );
 
 		indent_down();
@@ -1498,7 +1498,7 @@ void make_tables()
 		if ( C_plus_plus )
 			{
 			indent_puts(
-	"cerr << \"--EOF (start condition \" << YY_START << \")\\n\";" );
+	"std::cerr << \"--EOF (start condition \" << YY_START << \")\\n\";" );
 			}
 		else
 			{
diff -Burp flex-2.5.4/skel.c flex-2.5.4shap/skel.c
--- flex-2.5.4/skel.c	2006-01-14 22:53:17.000000000 -0500
+++ flex-2.5.4shap/skel.c	2006-01-15 11:56:59.000000000 -0500
@@ -146,6 +146,15 @@ const char *skel[] = {
   "",
   "#define unput(c) yyunput( c, yytext_ptr )",
   "",
+  "/* Some routines like yy_flex_realloc() are emitted as static but are",
+  "   not called by all lexers. This generates warnings in some compilers,",
+  "   notably GCC. Arrange to suppress these. */",
+  "#ifdef __GNUC__",
+  "#define YY_MAY_BE_UNUSED __attribute__((unused))",
+  "#else",
+  "#define YY_MAY_BE_UNUSED",
+  "#endif",
+  "",
   "/* The following is because we cannot portably get our hands on size_t",
   " * (without autoconf's help, which isn't available because we want",
   " * flex-generated scanners to compile on their own).",
@@ -260,7 +269,7 @@ const char *skel[] = {
   "%*",
   "",
   "static void *yy_flex_alloc YY_PROTO(( yy_size_t ));",
-  "static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));",
+  "static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) YY_MAY_BE_UNUSED;",
   "static void yy_flex_free YY_PROTO(( void * ));",
   "",
   "#define yy_new_buffer yy_create_buffer",
@@ -1541,15 +1550,5 @@ const char *skel[] = {
   "	return 0;",
   "	}",
   "#endif",
-  "",
-  "/* Some people want warning-free code, and under certain #define",
-  "   conditions, gcc will warn for unusedness of some functions.  This",
-  "   function is provided merely to silent these warnings.  It's not",
-  "   static itself, so it will clutter exports, but it has at least",
-  "   urandom name so that clashes won't occur.*/",
-  "void _yy_dummy_uses_of_static_functions_b2f4_517d_02ff_b30c_3e5a_47d7_aaa3_3b5d_()",
-  "{",
-  "  yy_flex_realloc ((void*)0, 0);",
-  "}",
   0
 };


Index: flex.spec
===================================================================
RCS file: /cvs/dist/rpms/flex/devel/flex.spec,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- flex.spec	13 Jan 2006 16:18:07 -0000	1.18
+++ flex.spec	18 Jan 2006 10:40:44 -0000	1.19
@@ -1,7 +1,7 @@
 Summary: A tool for creating scanners (text pattern recognizers).
 Name: flex
 Version: 2.5.4a
-Release: 35
+Release: 36
 License: BSD
 Group: Development/Tools
 URL: http://www.gnu.org/software/flex/
@@ -15,6 +15,7 @@
 Patch5: flex-pic.patch
 Patch6: flex-2.5.4a2-std.patch
 Patch7: flex-2.5.4a2-warn.patch
+Patch8: flex-2.5.4a2-shapwarn.patch
 BuildRequires: autoconf, byacc
 
 %description
@@ -41,6 +42,7 @@
 %patch5 -p1 -b .pic
 %patch6 -p1 -b .std
 %patch7 -p1 -b .warn
+%patch8 -p1 -b .shapwarn
 
 %build
 autoconf
@@ -74,6 +76,10 @@
 %{_includedir}/FlexLexer.h
 
 %changelog
+* Wed Jan 18 2006 Petr Machata <pmachata at redhat.com> 2.5.4a-36
+- Applying Jonathan S. Shapiro's bugfix-fixing patch. More std:: fixes
+  and better way to silent warnings under gcc.
+
 * Fri Jan 13 2006 Petr Machata <pmachata at redhat.com> 2.5.4a-35
 - Adding `std::' prefixes, got rid of `using namespace std'. (#115354)
 - Dummy use of `yy_flex_realloc' to silent warnings. (#30943)




More information about the fedora-cvs-commits mailing list