mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
c++: use __attribute__((__pure__)) to avoid warnings
Building C++ parsers with -Wsuggest-attribute=const and -Wsuggest-attribute=noreturn triggers warning in generated code. * data/lalr1.cc: Call b4_attribute_define. (debug_stream, debug_level): Flag as pure. * tests/headers.at (Several parsers): There are now more YY macros that "leak".
This commit is contained in:
@@ -157,6 +157,7 @@ m4_define([b4_shared_declarations],
|
|||||||
]b4_bison_locations_if([[# include "location.hh"]])])[
|
]b4_bison_locations_if([[# include "location.hh"]])])[
|
||||||
]b4_variant_if([b4_variant_includes])[
|
]b4_variant_if([b4_variant_includes])[
|
||||||
|
|
||||||
|
]b4_attribute_define[
|
||||||
]b4_YYDEBUG_define[
|
]b4_YYDEBUG_define[
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
@@ -183,14 +184,14 @@ b4_location_define])])[
|
|||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
/// The current debugging stream.
|
/// The current debugging stream.
|
||||||
std::ostream& debug_stream () const;
|
std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
|
||||||
/// Set the current debugging stream.
|
/// Set the current debugging stream.
|
||||||
void set_debug_stream (std::ostream &);
|
void set_debug_stream (std::ostream &);
|
||||||
|
|
||||||
/// Type for debugging levels.
|
/// Type for debugging levels.
|
||||||
typedef int debug_level_type;
|
typedef int debug_level_type;
|
||||||
/// The current debugging level.
|
/// The current debugging level.
|
||||||
debug_level_type debug_level () const;
|
debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
|
||||||
/// Set the current debugging level.
|
/// Set the current debugging level.
|
||||||
void set_debug_level (debug_level_type l);
|
void set_debug_level (debug_level_type l);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -223,7 +223,11 @@ AT_CHECK([[$PERL -n -0777 -e '
|
|||||||
s{/\*.*?\*/}{}gs;
|
s{/\*.*?\*/}{}gs;
|
||||||
s{//.*}{}g;
|
s{//.*}{}g;
|
||||||
s{\b(YYChar
|
s{\b(YYChar
|
||||||
|YYPUSH_MORE(_DEFINED)?
|
|YYPUSH_MORE(?:_DEFINED)?
|
||||||
|
|YYUSE
|
||||||
|
|YY_ATTRIBUTE(?:_PURE|_UNUSED)?
|
||||||
|
|YY_IGNORE_MAYBE_UNINITIALIZED_(?:BEGIN|END)
|
||||||
|
|YY_INITIAL_VALUE
|
||||||
|YY_\w+_INCLUDED
|
|YY_\w+_INCLUDED
|
||||||
|YY_NULL
|
|YY_NULL
|
||||||
|(defined|if)\ YYDEBUG
|
|(defined|if)\ YYDEBUG
|
||||||
|
|||||||
Reference in New Issue
Block a user