remove support for lint

Basically revert commit 12ce2df60d.
http://lists.gnu.org/archive/html/bison-patches/2012-08/msg00004.html

* data/c.m4, data/glr.c, data/yacc.c (YYID): Remove.
No longer use ARGSUSED.
* src/getargs.c: Restore simpler inclusion of getopt.h (anyway, since
then we now use gnulib which certainly protects us from such issues).
This commit is contained in:
Akim Demaille
2012-08-03 08:03:03 +02:00
parent e3f12e0818
commit 56f8d56088
4 changed files with 37 additions and 75 deletions

View File

@@ -195,12 +195,11 @@ m4_define([b4_int_type_for],
# -------------------------------------------- # --------------------------------------------
# Without inducing a comparison warning from the compiler, check if the # Without inducing a comparison warning from the compiler, check if the
# literal value LITERAL equals VALUE from table TABLE, which must have # literal value LITERAL equals VALUE from table TABLE, which must have
# TABLE_min and TABLE_max defined. YYID must be defined as an identity # TABLE_min and TABLE_max defined.
# function that suppresses warnings about constant conditions.
m4_define([b4_table_value_equals], m4_define([b4_table_value_equals],
[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min]) [m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
|| m4_indir([b4_]$1[_max]) < $3), [1], || m4_indir([b4_]$1[_max]) < $3), [1],
[[YYID (0)]], [[0]],
[[((]$2[) == (]$3[))]])]) [[((]$2[) == (]$3[))]])])
@@ -415,7 +414,6 @@ m4_define_default([b4_yydestruct_define],
| Release the memory associated to this symbol. | | Release the memory associated to this symbol. |
`-----------------------------------------------*/ `-----------------------------------------------*/
/*ARGSUSED*/
]b4_function_define([yydestruct], ]b4_function_define([yydestruct],
[static void], [static void],
[[const char *yymsg], [yymsg]], [[const char *yymsg], [yymsg]],
@@ -448,7 +446,6 @@ m4_define_default([b4_yy_symbol_print_define],
| Print this symbol on YYOUTPUT. | | Print this symbol on YYOUTPUT. |
`--------------------------------*/ `--------------------------------*/
/*ARGSUSED*/
]b4_function_define([yy_symbol_value_print], ]b4_function_define([yy_symbol_value_print],
[static void], [static void],
[[FILE *yyoutput], [yyoutput]], [[FILE *yyoutput], [yyoutput]],
@@ -582,7 +579,7 @@ m4_define([b4_yylloc_default_define],
#ifndef YYLLOC_DEFAULT #ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \ # define YYLLOC_DEFAULT(Current, Rhs, N) \
do \ do \
if (YYID (N)) \ if (N) \
{ \ { \
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
@@ -596,6 +593,6 @@ m4_define([b4_yylloc_default_define],
(Current).first_column = (Current).last_column = \ (Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \ YYRHSLOC (Rhs, 0).last_column; \
} \ } \
while (YYID (0)) while (0)
#endif #endif
]]) ]])

View File

@@ -258,22 +258,12 @@ b4_percent_code_get[]dnl
#endif #endif
/* Suppress unused-variable warnings by "using" E. */ /* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__ #ifdef __GNUC__
# define YYUSE(e) ((void) (e)) # define YYUSE(e) ((void) (e))
#else #else
# define YYUSE(e) /* empty */ # define YYUSE(e) /* empty */
#endif #endif
/* Identity function, used to suppress warnings about constant conditions. */
#ifndef lint
# define YYID(n) (n)
#else
]b4_function_define([YYID], [static int], [[int i], [i]])[
{
return i;
}
#endif
#ifndef YYFREE #ifndef YYFREE
# define YYFREE free # define YYFREE free
#endif #endif
@@ -477,7 +467,7 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
YYRESULTTAG yychk_flag = YYE; \ YYRESULTTAG yychk_flag = YYE; \
if (yychk_flag != yyok) \ if (yychk_flag != yyok) \
return yychk_flag; \ return yychk_flag; \
} while (YYID (0)) } while (0)
#if ]b4_api_PREFIX[DEBUG #if ]b4_api_PREFIX[DEBUG
@@ -489,7 +479,7 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
do { \ do { \
if (yydebug) \ if (yydebug) \
YYFPRINTF Args; \ YYFPRINTF Args; \
} while (YYID (0)) } while (0)
]b4_yy_symbol_print_define[ ]b4_yy_symbol_print_define[
@@ -501,7 +491,7 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
yy_symbol_print (stderr, Type, Value]b4_locuser_args([Location])[); \ yy_symbol_print (stderr, Type, Value]b4_locuser_args([Location])[); \
YYFPRINTF (stderr, "\n"); \ YYFPRINTF (stderr, "\n"); \
} \ } \
} while (YYID (0)) } while (0)
/* Nonzero means print parse trace. It is left uninitialized so that /* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */ multiple parsers can coexist. */
@@ -546,13 +536,13 @@ int yydebug;
do { \ do { \
if (Yystack->yyspaceLeft < YYHEADROOM) \ if (Yystack->yyspaceLeft < YYHEADROOM) \
yyexpandGLRStack (Yystack); \ yyexpandGLRStack (Yystack); \
} while (YYID (0)) } while (0)
#else #else
# define YY_RESERVE_GLRSTACK(Yystack) \ # define YY_RESERVE_GLRSTACK(Yystack) \
do { \ do { \
if (Yystack->yyspaceLeft < YYHEADROOM) \ if (Yystack->yyspaceLeft < YYHEADROOM) \
yyMemoryExhausted (Yystack); \ yyMemoryExhausted (Yystack); \
} while (YYID (0)) } while (0)
#endif #endif
@@ -804,7 +794,7 @@ yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal)
* value ($$), and yylocp points to place for location information * value ($$), and yylocp points to place for location information
* (@@$). Returns yyok for normal return, yyaccept for YYACCEPT, * (@@$). Returns yyok for normal return, yyaccept for YYACCEPT,
* yyerr for YYERROR, yyabort for YYABORT. */ * yyerr for YYERROR, yyabort for YYABORT. */
/*ARGSUSED*/ static YYRESULTTAG static YYRESULTTAG
yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp, yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
yyGLRStack* yystackp, yyGLRStack* yystackp,
YYSTYPE* yyvalp]b4_locuser_formals[) YYSTYPE* yyvalp]b4_locuser_formals[)
@@ -855,9 +845,9 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
# undef yyclearin # undef yyclearin
# undef YYRECOVERING # undef YYRECOVERING
} }
/*ARGSUSED*/ static void
static void
yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1) yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
{ {
YYUSE (yy0); YYUSE (yy0);
@@ -1277,13 +1267,13 @@ yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
do { \ do { \
if (yydebug) \ if (yydebug) \
yy_reduce_print Args; \ yy_reduce_print Args; \
} while (YYID (0)) } while (0)
/*----------------------------------------------------------------------. /*----------------------------------------------------------------------.
| Report that stack #YYK of *YYSTACKP is going to be reduced by YYRULE. | | Report that stack #YYK of *YYSTACKP is going to be reduced by YYRULE. |
`----------------------------------------------------------------------*/ `----------------------------------------------------------------------*/
/*ARGSUSED*/ static inline void static inline void
yy_reduce_print (int yynormal, yyGLRStackItem* yyvsp, size_t yyk, yy_reduce_print (int yynormal, yyGLRStackItem* yyvsp, size_t yyk,
yyRuleNum yyrule]b4_user_formals[) yyRuleNum yyrule]b4_user_formals[)
{ {
@@ -1533,7 +1523,7 @@ yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1)
{ {
yySemanticOption** yyz0p = &yys0->yysemantics.yyfirstVal; yySemanticOption** yyz0p = &yys0->yysemantics.yyfirstVal;
yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal; yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal;
while (YYID (yytrue)) while (yytrue)
{ {
if (yyz1 == *yyz0p || yyz1 == YY_NULL) if (yyz1 == *yyz0p || yyz1 == YY_NULL)
break; break;
@@ -1694,7 +1684,7 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
} }
#endif #endif
/*ARGSUSED*/ static YYRESULTTAG static YYRESULTTAG
yyreportAmbiguity (yySemanticOption* yyx0, yyreportAmbiguity (yySemanticOption* yyx0,
yySemanticOption* yyx1]b4_pure_formals[) yySemanticOption* yyx1]b4_pure_formals[)
{ {
@@ -2025,7 +2015,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
return yyok; return yyok;
} }
/*ARGSUSED*/ static void static void
yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[) yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
{ {
if (yystackp->yyerrState != 0) if (yystackp->yyerrState != 0)
@@ -2157,7 +2147,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
/* Recover from a syntax error on *YYSTACKP, assuming that *YYSTACKP->YYTOKENP, /* Recover from a syntax error on *YYSTACKP, assuming that *YYSTACKP->YYTOKENP,
yylval, and yylloc are the syntactic category, semantic value, and location yylval, and yylloc are the syntactic category, semantic value, and location
of the lookahead. */ of the lookahead. */
/*ARGSUSED*/ static void static void
yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[) yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
{ {
size_t yyk; size_t yyk;
@@ -2166,7 +2156,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
if (yystackp->yyerrState == 3) if (yystackp->yyerrState == 3)
/* We just shifted the error token and (perhaps) took some /* We just shifted the error token and (perhaps) took some
reductions. Skip tokens until we can proceed. */ reductions. Skip tokens until we can proceed. */
while (YYID (yytrue)) while (yytrue)
{ {
yySymbol yytoken; yySymbol yytoken;
if (yychar == YYEOF) if (yychar == YYEOF)
@@ -2270,7 +2260,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
default: \ default: \
goto yybuglab; \ goto yybuglab; \
} \ } \
} while (YYID (0)) } while (0)
/*----------. /*----------.
| yyparse. | | yyparse. |
@@ -2311,13 +2301,13 @@ b4_dollar_popdef])[]dnl
yyglrShift (&yystack, 0, 0, 0, &yylval]b4_locations_if([, &yylloc])[); yyglrShift (&yystack, 0, 0, 0, &yylval]b4_locations_if([, &yylloc])[);
yyposn = 0; yyposn = 0;
while (YYID (yytrue)) while (yytrue)
{ {
/* For efficiency, we have two loops, the first of which is /* For efficiency, we have two loops, the first of which is
specialized to deterministic operation (single stack, no specialized to deterministic operation (single stack, no
potential ambiguity). */ potential ambiguity). */
/* Standard mode */ /* Standard mode */
while (YYID (yytrue)) while (yytrue)
{ {
yyRuleNum yyrule; yyRuleNum yyrule;
int yyaction; int yyaction;
@@ -2381,7 +2371,7 @@ b4_dollar_popdef])[]dnl
} }
} }
while (YYID (yytrue)) while (yytrue)
{ {
yySymbol yytoken_to_shift; yySymbol yytoken_to_shift;
size_t yys; size_t yys;
@@ -2513,8 +2503,7 @@ b4_dollar_popdef])[]dnl
yyfreeGLRStack (&yystack); yyfreeGLRStack (&yystack);
} }
/* Make sure YYID is used. */ return yyresult;
return YYID (yyresult);
} }
/* DEBUGGING ONLY */ /* DEBUGGING ONLY */

View File

@@ -404,22 +404,12 @@ typedef short int yytype_int16;
#endif #endif
/* Suppress unused-variable warnings by "using" E. */ /* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__ #ifdef __GNUC__
# define YYUSE(e) ((void) (e)) # define YYUSE(e) ((void) (e))
#else #else
# define YYUSE(e) /* empty */ # define YYUSE(e) /* empty */
#endif #endif
/* Identity function, used to suppress warnings about constant conditions. */
#ifndef lint
# define YYID(n) (n)
#else
]b4_function_define([YYID], [static int], [[int yyi], [yyi]])[
{
return yyi;
}
#endif
#if ]b4_lac_if([[1]], [[! defined yyoverflow || YYERROR_VERBOSE]])[ #if ]b4_lac_if([[1]], [[! defined yyoverflow || YYERROR_VERBOSE]])[
/* The parser invokes alloca or malloc; define the necessary symbols. */]dnl /* The parser invokes alloca or malloc; define the necessary symbols. */]dnl
@@ -451,7 +441,7 @@ b4_push_if([], [b4_lac_if([], [[
# ifdef YYSTACK_ALLOC # ifdef YYSTACK_ALLOC
/* Pacify GCC's `empty if-body' warning. */ /* Pacify GCC's `empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# ifndef YYSTACK_ALLOC_MAXIMUM # ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack, /* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely and a page size can be as small as 4096 bytes. So we cannot safely
@@ -532,7 +522,7 @@ union yyalloc
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \ yyptr += yynewbytes / sizeof (*yyptr); \
} \ } \
while (YYID (0)) while (0)
#endif #endif
@@ -551,7 +541,7 @@ union yyalloc
for (yyi = 0; yyi < (Count); yyi++) \ for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \ (Dst)[yyi] = (Src)[yyi]; \
} \ } \
while (YYID (0)) while (0)
# endif # endif
# endif # endif
#endif /* !YYCOPY_NEEDED */ #endif /* !YYCOPY_NEEDED */
@@ -648,7 +638,7 @@ do \
yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \ yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
YYERROR; \ YYERROR; \
} \ } \
while (YYID (0)) while (0)
#define YYTERROR 1 #define YYTERROR 1
@@ -701,7 +691,7 @@ while (YYID (0))
do { \ do { \
if (yydebug) \ if (yydebug) \
YYFPRINTF Args; \ YYFPRINTF Args; \
} while (YYID (0)) } while (0)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
do { \ do { \
@@ -712,7 +702,7 @@ do { \
Type, Value]b4_locations_if([, Location])[]b4_user_args[); \ Type, Value]b4_locations_if([, Location])[]b4_user_args[); \
YYFPRINTF (stderr, "\n"); \ YYFPRINTF (stderr, "\n"); \
} \ } \
} while (YYID (0)) } while (0)
]b4_yy_symbol_print_define[ ]b4_yy_symbol_print_define[
@@ -738,7 +728,7 @@ do { \
do { \ do { \
if (yydebug) \ if (yydebug) \
yy_stack_print ((Bottom), (Top)); \ yy_stack_print ((Bottom), (Top)); \
} while (YYID (0)) } while (0)
/*------------------------------------------------. /*------------------------------------------------.
@@ -774,7 +764,7 @@ do { \
do { \ do { \
if (yydebug) \ if (yydebug) \
yy_reduce_print (yyssp, yyvsp, ]b4_locations_if([yylsp, ])[Rule]b4_user_args[); \ yy_reduce_print (yyssp, yyvsp, ]b4_locations_if([yylsp, ])[Rule]b4_user_args[); \
} while (YYID (0)) } while (0)
/* Nonzero means print parse trace. It is left uninitialized so that /* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */ multiple parsers can coexist. */
@@ -908,7 +898,7 @@ do { \
goto yyerrlab; \ goto yyerrlab; \
} \ } \
} \ } \
} while (YYID (0)) } while (0)
/* Discard any previous initial lookahead context because of Event, /* Discard any previous initial lookahead context because of Event,
which may be a lookahead change or an invalidation of the currently which may be a lookahead change or an invalidation of the currently
@@ -931,7 +921,7 @@ do { \
Event "\n"); \ Event "\n"); \
yy_lac_established = 0; \ yy_lac_established = 0; \
} \ } \
} while (YYID (0)) } while (0)
#else #else
# define YY_LAC_DISCARD(Event) yy_lac_established = 0 # define YY_LAC_DISCARD(Event) yy_lac_established = 0
#endif #endif
@@ -1941,8 +1931,7 @@ yypushreturn:]])[
if (yymsg != yymsgbuf) if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg); YYSTACK_FREE (yymsg);
#endif #endif
/* Make sure YYID is used. */ return yyresult;
return YYID (yyresult);
} }
]b4_epilogue[]dnl ]b4_epilogue[]dnl

View File

@@ -26,20 +26,7 @@
#include <c-strcase.h> #include <c-strcase.h>
#include <configmake.h> #include <configmake.h>
#include <error.h> #include <error.h>
/* Hack to get <getopt.h> to declare getopt with a prototype. */
#if lint && ! defined __GNU_LIBRARY__
# define __GNU_LIBRARY__
# define HACK_FOR___GNU_LIBRARY___PROTOTYPE 1
#endif
#include <getopt.h> #include <getopt.h>
#ifdef HACK_FOR___GNU_LIBRARY___PROTOTYPE
# undef __GNU_LIBRARY__
# undef HACK_FOR___GNU_LIBRARY___PROTOTYPE
#endif
#include <progname.h> #include <progname.h>
#include "complain.h" #include "complain.h"