[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/11] remove support for lint
From: |
Akim Demaille |
Subject: |
[PATCH 10/11] remove support for lint |
Date: |
Fri, 3 Aug 2012 10:40:00 +0200 |
Basically revert commit 12ce2df60d16961eaa03a5aa009eeaa645e4e1cb.
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).
---
data/c.m4 | 11 ++++-------
data/glr.c | 53 +++++++++++++++++++++--------------------------------
data/yacc.c | 35 ++++++++++++-----------------------
src/getargs.c | 13 -------------
4 files changed, 37 insertions(+), 75 deletions(-)
diff --git a/data/c.m4 b/data/c.m4
index 0020982..1a527b5 100644
--- a/data/c.m4
+++ b/data/c.m4
@@ -195,12 +195,11 @@ m4_define([b4_int_type_for],
# --------------------------------------------
# Without inducing a comparison warning from the compiler, check if the
# literal value LITERAL equals VALUE from table TABLE, which must have
-# TABLE_min and TABLE_max defined. YYID must be defined as an identity
-# function that suppresses warnings about constant conditions.
+# TABLE_min and TABLE_max defined.
m4_define([b4_table_value_equals],
[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
|| m4_indir([b4_]$1[_max]) < $3), [1],
- [[YYID (0)]],
+ [[0]],
[[((]$2[) == (]$3[))]])])
@@ -415,7 +414,6 @@ m4_define_default([b4_yydestruct_define],
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
-/*ARGSUSED*/
]b4_function_define([yydestruct],
[static void],
[[const char *yymsg], [yymsg]],
@@ -448,7 +446,6 @@ m4_define_default([b4_yy_symbol_print_define],
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
-/*ARGSUSED*/
]b4_function_define([yy_symbol_value_print],
[static void],
[[FILE *yyoutput], [yyoutput]],
@@ -582,7 +579,7 @@ m4_define([b4_yylloc_default_define],
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
- if (YYID (N)) \
+ if (N) \
{ \
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
@@ -596,6 +593,6 @@ m4_define([b4_yylloc_default_define],
(Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \
} \
- while (YYID (0))
+ while (0)
#endif
]])
diff --git a/data/glr.c b/data/glr.c
index 18a1138..8b3c34c 100644
--- a/data/glr.c
+++ b/data/glr.c
@@ -258,22 +258,12 @@ b4_percent_code_get[]dnl
#endif
/* Suppress unused-variable warnings by "using" E. */
-#if ! defined lint || defined __GNUC__
+#ifdef __GNUC__
# define YYUSE(e) ((void) (e))
#else
# define YYUSE(e) /* empty */
#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
# define YYFREE free
#endif
@@ -477,7 +467,7 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
YYRESULTTAG yychk_flag = YYE; \
if (yychk_flag != yyok) \
return yychk_flag; \
- } while (YYID (0))
+ } while (0)
#if ]b4_api_PREFIX[DEBUG
@@ -489,7 +479,7 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
do { \
if (yydebug) \
YYFPRINTF Args; \
- } while (YYID (0))
+ } while (0)
]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])[);
\
YYFPRINTF (stderr, "\n"); \
} \
- } while (YYID (0))
+ } while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
@@ -546,13 +536,13 @@ int yydebug;
do { \
if (Yystack->yyspaceLeft < YYHEADROOM) \
yyexpandGLRStack (Yystack); \
- } while (YYID (0))
+ } while (0)
#else
# define YY_RESERVE_GLRSTACK(Yystack) \
do { \
if (Yystack->yyspaceLeft < YYHEADROOM) \
yyMemoryExhausted (Yystack); \
- } while (YYID (0))
+ } while (0)
#endif
@@ -804,7 +794,7 @@ yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1,
yybool yynormal)
* value ($$), and yylocp points to place for location information
* (@@$). Returns yyok for normal return, yyaccept for YYACCEPT,
* yyerr for YYERROR, yyabort for YYABORT. */
-/*ARGSUSED*/ static YYRESULTTAG
+static YYRESULTTAG
yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
yyGLRStack* yystackp,
YYSTYPE* yyvalp]b4_locuser_formals[)
@@ -855,9 +845,9 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem*
yyvsp,
# undef yyclearin
# undef YYRECOVERING
}
-
-/*ARGSUSED*/ static void
+
+static void
yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
{
YYUSE (yy0);
@@ -1277,13 +1267,13 @@ yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk,
yyStateNum yylrState,
do { \
if (yydebug) \
yy_reduce_print Args; \
-} while (YYID (0))
+} while (0)
/*----------------------------------------------------------------------.
| 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,
yyRuleNum yyrule]b4_user_formals[)
{
@@ -1533,7 +1523,7 @@ yymergeOptionSets (yySemanticOption* yyy0,
yySemanticOption* yyy1)
{
yySemanticOption** yyz0p = &yys0->yysemantics.yyfirstVal;
yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal;
- while (YYID (yytrue))
+ while (yytrue)
{
if (yyz1 == *yyz0p || yyz1 == YY_NULL)
break;
@@ -1694,7 +1684,7 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
}
#endif
-/*ARGSUSED*/ static YYRESULTTAG
+static YYRESULTTAG
yyreportAmbiguity (yySemanticOption* yyx0,
yySemanticOption* yyx1]b4_pure_formals[)
{
@@ -2025,7 +2015,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
return yyok;
}
-/*ARGSUSED*/ static void
+static void
yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
{
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,
yylval, and yylloc are the syntactic category, semantic value, and location
of the lookahead. */
-/*ARGSUSED*/ static void
+static void
yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
{
size_t yyk;
@@ -2166,7 +2156,7 @@ yyrecoverSyntaxError (yyGLRStack*
yystackp]b4_user_formals[)
if (yystackp->yyerrState == 3)
/* We just shifted the error token and (perhaps) took some
reductions. Skip tokens until we can proceed. */
- while (YYID (yytrue))
+ while (yytrue)
{
yySymbol yytoken;
if (yychar == YYEOF)
@@ -2270,7 +2260,7 @@ yyrecoverSyntaxError (yyGLRStack*
yystackp]b4_user_formals[)
default: \
goto yybuglab; \
} \
- } while (YYID (0))
+ } while (0)
/*----------.
| yyparse. |
@@ -2311,13 +2301,13 @@ b4_dollar_popdef])[]dnl
yyglrShift (&yystack, 0, 0, 0, &yylval]b4_locations_if([, &yylloc])[);
yyposn = 0;
- while (YYID (yytrue))
+ while (yytrue)
{
/* For efficiency, we have two loops, the first of which is
specialized to deterministic operation (single stack, no
potential ambiguity). */
/* Standard mode */
- while (YYID (yytrue))
+ while (yytrue)
{
yyRuleNum yyrule;
int yyaction;
@@ -2381,7 +2371,7 @@ b4_dollar_popdef])[]dnl
}
}
- while (YYID (yytrue))
+ while (yytrue)
{
yySymbol yytoken_to_shift;
size_t yys;
@@ -2513,8 +2503,7 @@ b4_dollar_popdef])[]dnl
yyfreeGLRStack (&yystack);
}
- /* Make sure YYID is used. */
- return YYID (yyresult);
+ return yyresult;
}
/* DEBUGGING ONLY */
diff --git a/data/yacc.c b/data/yacc.c
index 76121f3..5b5b1bc 100644
--- a/data/yacc.c
+++ b/data/yacc.c
@@ -404,22 +404,12 @@ typedef short int yytype_int16;
#endif
/* Suppress unused-variable warnings by "using" E. */
-#if ! defined lint || defined __GNUC__
+#ifdef __GNUC__
# define YYUSE(e) ((void) (e))
#else
# define YYUSE(e) /* empty */
#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]])[
/* The parser invokes alloca or malloc; define the necessary symbols. */]dnl
@@ -451,7 +441,7 @@ b4_push_if([], [b4_lac_if([], [[
# ifdef YYSTACK_ALLOC
/* 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
/* 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
@@ -532,7 +522,7 @@ union yyalloc
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
- while (YYID (0))
+ while (0)
#endif
@@ -551,7 +541,7 @@ union yyalloc
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
- while (YYID (0))
+ while (0)
# endif
# endif
#endif /* !YYCOPY_NEEDED */
@@ -648,7 +638,7 @@ do
\
yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
YYERROR; \
} \
-while (YYID (0))
+while (0)
#define YYTERROR 1
@@ -701,7 +691,7 @@ while (YYID (0))
do { \
if (yydebug) \
YYFPRINTF Args; \
-} while (YYID (0))
+} while (0)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
do { \
@@ -712,7 +702,7 @@ do {
\
Type, Value]b4_locations_if([, Location])[]b4_user_args[); \
YYFPRINTF (stderr, "\n"); \
} \
-} while (YYID (0))
+} while (0)
]b4_yy_symbol_print_define[
@@ -738,7 +728,7 @@ do {
\
do { \
if (yydebug) \
yy_stack_print ((Bottom), (Top)); \
-} while (YYID (0))
+} while (0)
/*------------------------------------------------.
@@ -774,7 +764,7 @@ do {
\
do { \
if (yydebug) \
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
multiple parsers can coexist. */
@@ -908,7 +898,7 @@ do {
\
goto yyerrlab; \
} \
} \
-} while (YYID (0))
+} while (0)
/* Discard any previous initial lookahead context because of Event,
which may be a lookahead change or an invalidation of the currently
@@ -931,7 +921,7 @@ do {
\
Event "\n"); \
yy_lac_established = 0; \
} \
-} while (YYID (0))
+} while (0)
#else
# define YY_LAC_DISCARD(Event) yy_lac_established = 0
#endif
@@ -1941,8 +1931,7 @@ yypushreturn:]])[
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
- /* Make sure YYID is used. */
- return YYID (yyresult);
+ return yyresult;
}
]b4_epilogue[]dnl
diff --git a/src/getargs.c b/src/getargs.c
index dadcbbb..5a74f4b 100644
--- a/src/getargs.c
+++ b/src/getargs.c
@@ -26,20 +26,7 @@
#include <c-strcase.h>
#include <configmake.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>
-
-#ifdef HACK_FOR___GNU_LIBRARY___PROTOTYPE
-# undef __GNU_LIBRARY__
-# undef HACK_FOR___GNU_LIBRARY___PROTOTYPE
-#endif
-
#include <progname.h>
#include "complain.h"
--
1.7.11.3
- [PATCH 00/11] {master} remove oldies: lint, YYPARSE_PARAM, and K&R support, Akim Demaille, 2012/08/03
- [PATCH 05/11] skeletons: b4_args -> b4_join to prepare forthcoming changes, Akim Demaille, 2012/08/03
- [PATCH 03/11] YYPARSE_PARAM: drop support, Akim Demaille, 2012/08/03
- [PATCH 07/11] skeletons: simplify after knr removal, Akim Demaille, 2012/08/03
- [PATCH 01/11] todo: more items, Akim Demaille, 2012/08/03
- [PATCH 08/11] c++: fix a comment, Akim Demaille, 2012/08/03
- [PATCH 02/11] skeletons: remove K&R C support, Akim Demaille, 2012/08/03
- [PATCH 11/11] regen, Akim Demaille, 2012/08/03
- [PATCH 06/11] skeletons: renamings after knr removal, Akim Demaille, 2012/08/03
- [PATCH 10/11] remove support for lint,
Akim Demaille <=
- [PATCH 09/11] skeletons: renamings after knr removal, Akim Demaille, 2012/08/03
- [PATCH 04/11] regen, Akim Demaille, 2012/08/03