Hi again, Joel E. Denny wrote:
> I guess I'm just not used to seeing so many emails for one small issue. > I'm used to seeing patches appended to the main email that introduces > them. Okay, I’ll try this. > I want to include the rest of your changes in release 2.4.2, which is > purely a bug fix release, so please submit the b4_locations_if change in a > separate patch. Oh! Sorry about that. Two following two patches follow. Avoid warnings from gcc -Wunused y.tab.c. Simplify y.tab.c when location tracking is disabled. ChangeLog | 15 +++++++++++++++ data/glr.c | 4 ++-- data/lalr1.cc | 2 +- data/yacc.c | 14 ++++++++++---- 4 files changed, 28 insertions(+), 7 deletions(-) -- %< ------- patch 1 ------- >From 23d4e466fcf6428cad857149d51c25475a870d4d Mon Sep 17 00:00:00 2001 From: Jonathan Nieder <[email protected]> Date: Tue, 15 Dec 2009 22:03:18 -0600 Subject: Avoid warnings from gcc -Wunused y.tab.c. * data/glr.c: Check if YYENABLE_NLS and YYLTYPE_IS_TRIVIAL are defined before using them. * data/lalr1.cc: Likewise. * data/yacc.c: Likewise. --- ChangeLog | 8 ++++++++ data/glr.c | 4 ++-- data/lalr1.cc | 2 +- data/yacc.c | 6 +++--- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c5d33e..e2a323e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-12-15 Jonathan Nieder <[email protected]> + + Avoid warnings from gcc -Wunused y.tab.c. + * data/glr.c: Check if YYENABLE_NLS and YYLTYPE_IS_TRIVIAL are + defined before using them. + * data/lalr1.cc: Likewise. + * data/yacc.c: Likewise. + 2009-12-15 Joel E. Denny <[email protected]> autoconf: update to latest for fix of M4 detection. diff --git a/data/glr.c b/data/glr.c index 6f1f7ee..e73b251 100644 --- a/data/glr.c +++ b/data/glr.c @@ -256,7 +256,7 @@ b4_percent_code_get[]dnl #include <string.h> #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -2264,7 +2264,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[) yychar = YYEMPTY; yylval = yyval_default; ]b4_locations_if([ -#if YYLTYPE_IS_TRIVIAL +#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[; yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[; #endif diff --git a/data/lalr1.cc b/data/lalr1.cc index 1a2777e..9e0d522 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -398,7 +398,7 @@ m4_if(b4_prefix, [yy], [], b4_percent_code_get[]dnl [#ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) diff --git a/data/yacc.c b/data/yacc.c index ea2ae14..a7d7948 100644 --- a/data/yacc.c +++ b/data/yacc.c @@ -374,7 +374,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -668,7 +668,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -1192,7 +1192,7 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[ yyvsp = yyvs;]b4_locations_if([[ yylsp = yyls; -#if YYLTYPE_IS_TRIVIAL +#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[; yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[; -- 1.6.5.4 -- >% ----- end of patch 1 ----- -- %< ----- patch 2 ----- >From 83e581279b9485ddd26a25c84cbd9c9633e4f5da Mon Sep 17 00:00:00 2001 From: Jonathan Nieder <[email protected]> Date: Tue, 15 Dec 2009 22:07:46 -0600 Subject: Simplify y.tab.c when location tracking is disabled. * data/yacc.c: Do not check YYLTYPE_IS_TRIVIAL if location tracking is not enabled. Instead, unconditionally define YY_LOCATION_PRINT as a no-op for backward compatibility. --- ChangeLog | 7 +++++++ data/yacc.c | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index e2a323e..30aa283 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2009-12-15 Jonathan Nieder <[email protected]> + Simplify y.tab.c when location tracking is disabled. + * data/yacc.c: Do not check YYLTYPE_IS_TRIVIAL if location + tracking is not enabled. Instead, unconditionally define + YY_LOCATION_PRINT as a no-op for backward compatibility. + +2009-12-15 Jonathan Nieder <[email protected]> + Avoid warnings from gcc -Wunused y.tab.c. * data/glr.c: Check if YYENABLE_NLS and YYLTYPE_IS_TRIVIAL are defined before using them. diff --git a/data/yacc.c b/data/yacc.c index a7d7948..711d41d 100644 --- a/data/yacc.c +++ b/data/yacc.c @@ -662,7 +662,7 @@ while (YYID (0)) while (YYID (0)) #endif - +]b4_locations_if([[ /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ @@ -677,7 +677,13 @@ while (YYID (0)) # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif +]], [[ +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif +]])[ /* YYLEX -- calling `yylex' with the right arguments. */ -- 1.6.5.4 -- >% ------ end of patch 2 -----
