mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
yacc.c: do not use __attribute__ unprotected
Reported by Victor Khomenko. http://lists.gnu.org/archive/html/bug-bison/2013-04/msg00001.html * data/glr.c (YYUSE, __attribute__): Fuse their definition into... * data/c.m4 (b4_attribute_define): this new macro. * data/yacc.c, data/glr.c: Use it.
This commit is contained in:
5
NEWS
5
NEWS
@@ -2,6 +2,11 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
*** Fix compiler attribute portability (yacc.c)
|
||||||
|
|
||||||
|
With locations enabled, __attribute__ was used unprotected.
|
||||||
|
|
||||||
* Noteworthy changes in release 2.7 (2012-12-12) [stable]
|
* Noteworthy changes in release 2.7 (2012-12-12) [stable]
|
||||||
|
|
||||||
|
|||||||
1
THANKS
1
THANKS
@@ -121,6 +121,7 @@ Tom Tromey tromey@cygnus.com
|
|||||||
Tommy Nordgren tommy.nordgren@chello.se
|
Tommy Nordgren tommy.nordgren@chello.se
|
||||||
Troy A. Johnson troyj@ecn.purdue.edu
|
Troy A. Johnson troyj@ecn.purdue.edu
|
||||||
Tys Lefering gccbison@gmail.com
|
Tys Lefering gccbison@gmail.com
|
||||||
|
Victor Khomenko victor.khomenko@newcastle.ac.uk
|
||||||
Vin Shelton acs@alumni.princeton.edu
|
Vin Shelton acs@alumni.princeton.edu
|
||||||
W.C.A. Wijngaards wouter@NLnetLabs.nl
|
W.C.A. Wijngaards wouter@NLnetLabs.nl
|
||||||
Wayne Green wayne@infosavvy.com
|
Wayne Green wayne@infosavvy.com
|
||||||
|
|||||||
28
data/c.m4
28
data/c.m4
@@ -187,9 +187,29 @@ m4_define([b4_table_value_equals],
|
|||||||
[(!!(($2) == ($3)))])])
|
[(!!(($2) == ($3)))])])
|
||||||
|
|
||||||
|
|
||||||
## ---------##
|
## ----------------- ##
|
||||||
## Values. ##
|
## Compiler issues. ##
|
||||||
## ---------##
|
## ----------------- ##
|
||||||
|
|
||||||
|
# b4_attribute_define
|
||||||
|
# -------------------
|
||||||
|
# Provide portability for __attribute__.
|
||||||
|
m4_define([b4_attribute_define],
|
||||||
|
[#ifndef __attribute__
|
||||||
|
/* This feature is available in gcc versions 2.5 and later. */
|
||||||
|
# if (! defined __GNUC__ || __GNUC__ < 2 \
|
||||||
|
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
|
||||||
|
# define __attribute__(Spec) /* empty */
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Suppress unused-variable warnings by "using" E. */
|
||||||
|
#if ! defined lint || defined __GNUC__
|
||||||
|
# define YYUSE(E) ((void) (E))
|
||||||
|
#else
|
||||||
|
# define YYUSE(E) /* empty */
|
||||||
|
#endif
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_null_define
|
# b4_null_define
|
||||||
@@ -405,7 +425,7 @@ m4_define([b4_c_arg],
|
|||||||
## ----------- ##
|
## ----------- ##
|
||||||
|
|
||||||
# b4_sync_start(LINE, FILE)
|
# b4_sync_start(LINE, FILE)
|
||||||
# -----------------------
|
# -------------------------
|
||||||
m4_define([b4_sync_start], [[#]line $1 $2])
|
m4_define([b4_sync_start], [[#]line $1 $2])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
19
data/glr.c
19
data/glr.c
@@ -246,13 +246,6 @@ b4_percent_code_get[]dnl
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Suppress unused-variable warnings by "using" E. */
|
|
||||||
#if ! defined lint || defined __GNUC__
|
|
||||||
# define YYUSE(E) ((void) (E))
|
|
||||||
#else
|
|
||||||
# define YYUSE(E) /* empty */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Identity function, used to suppress warnings about constant conditions. */
|
/* Identity function, used to suppress warnings about constant conditions. */
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
# define YYID(N) (N)
|
# define YYID(N) (N)
|
||||||
@@ -291,17 +284,7 @@ b4_percent_code_get[]dnl
|
|||||||
# define YYLONGJMP(Env, Val) (longjmp (Env, Val), YYASSERT (0))
|
# define YYLONGJMP(Env, Val) (longjmp (Env, Val), YYASSERT (0))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*-----------------.
|
]b4_attribute_define[
|
||||||
| GCC extensions. |
|
|
||||||
`-----------------*/
|
|
||||||
|
|
||||||
#ifndef __attribute__
|
|
||||||
/* This feature is available in gcc versions 2.5 and later. */
|
|
||||||
# if (! defined __GNUC__ || __GNUC__ < 2 \
|
|
||||||
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
|
|
||||||
# define __attribute__(Spec) /* empty */
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef YYASSERT
|
#ifndef YYASSERT
|
||||||
# define YYASSERT(Condition) ((void) ((Condition) || (abort (), 0)))
|
# define YYASSERT(Condition) ((void) ((Condition) || (abort (), 0)))
|
||||||
|
|||||||
@@ -447,12 +447,7 @@ typedef short int yytype_int16;
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Suppress unused-variable warnings by "using" E. */
|
]b4_attribute_define[
|
||||||
#if ! defined lint || defined __GNUC__
|
|
||||||
# define YYUSE(E) ((void) (E))
|
|
||||||
#else
|
|
||||||
# define YYUSE(E) /* empty */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Identity function, used to suppress warnings about constant conditions. */
|
/* Identity function, used to suppress warnings about constant conditions. */
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
|||||||
Reference in New Issue
Block a user