mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
c++: workaround portability issue
On some systems (x86_64-pc-solaris2.11), with Developer Studio 12.5's
CC, we get:
".../include/CC/Cstd/vector.cc", line 127: Error: Cannot assign const yy::parser::stack_symbol_type to yy::parser::stack_symbol_type without "yy::parser::stack_symbol_type::operator=(const yy::parser::stack_symbol_type&)";.
".../include/CC/Cstd/vector", line 475: Where: While instantiating "std::vector<yy::parser::stack_symbol_type>::__insert_aux(yy::parser::stack_symbol_type*, const yy::parser::stack_symbol_type&)".
".../include/CC/Cstd/vector", line 475: Where: Instantiated from non-template code.
1 Error(s) detected.
Don't expect __cplusplus to be always defined. If it's not, consider
this is C++98.
Reported by Nelson H. F. Beebe.
* data/c++.m4, data/lalr1.cc, examples/c++/variant.yy, tests/local.at,
* tests/testsuite.h:
An undefined __cplusplus means pre C++11.
This commit is contained in:
@@ -272,7 +272,7 @@ m4_define([b4_symbol_type_declare],
|
|||||||
location_type location;])[
|
location_type location;])[
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if defined __cplusplus && __cplusplus < 201103L
|
#if !defined __cplusplus || __cplusplus < 201103L
|
||||||
/// Assignment operator.
|
/// Assignment operator.
|
||||||
basic_symbol& operator= (const basic_symbol& other);
|
basic_symbol& operator= (const basic_symbol& other);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ m4_define([b4_shared_declarations],
|
|||||||
stack_symbol_type (YY_RVREF (stack_symbol_type) that);
|
stack_symbol_type (YY_RVREF (stack_symbol_type) that);
|
||||||
/// Steal the contents from \a sym to build this.
|
/// Steal the contents from \a sym to build this.
|
||||||
stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
|
stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
|
||||||
#if defined __cplusplus && __cplusplus < 201103L
|
#if !defined __cplusplus || __cplusplus < 201103L
|
||||||
/// Assignment, needed by push_back by some old implementations.
|
/// Assignment, needed by push_back by some old implementations.
|
||||||
/// Moves the contents of that.
|
/// Moves the contents of that.
|
||||||
stack_symbol_type& operator= (stack_symbol_type& that);
|
stack_symbol_type& operator= (stack_symbol_type& that);
|
||||||
@@ -626,7 +626,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
that.type = empty_symbol;
|
that.type = empty_symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined __cplusplus && __cplusplus < 201103L
|
#if !defined __cplusplus || __cplusplus < 201103L
|
||||||
]b4_parser_class_name[::stack_symbol_type&
|
]b4_parser_class_name[::stack_symbol_type&
|
||||||
]b4_parser_class_name[::stack_symbol_type::operator= (stack_symbol_type& that)
|
]b4_parser_class_name[::stack_symbol_type::operator= (stack_symbol_type& that)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ item:
|
|||||||
namespace yy
|
namespace yy
|
||||||
{
|
{
|
||||||
// Use nullptr with pre-C++11.
|
// Use nullptr with pre-C++11.
|
||||||
#if defined __cplusplus && __cplusplus < 201103L
|
#if !defined __cplusplus || __cplusplus < 201103L
|
||||||
# define NULLPTR 0
|
# define NULLPTR 0
|
||||||
#else
|
#else
|
||||||
# define NULLPTR nullptr
|
# define NULLPTR nullptr
|
||||||
|
|||||||
@@ -912,7 +912,7 @@ m4_define([AT_REQUIRE_CXX_VERSION],
|
|||||||
[AT_DATA([check.cc],
|
[AT_DATA([check.cc],
|
||||||
[[int main ()
|
[[int main ()
|
||||||
{
|
{
|
||||||
#if __cplusplus < ]m4_case([$1],
|
#if !defined __cplusplus || __cplusplus < ]m4_case([$1],
|
||||||
[98], [199711],
|
[98], [199711],
|
||||||
[03], [199711],
|
[03], [199711],
|
||||||
[11], [201103],
|
[11], [201103],
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
/* In C++ pre C++11 it is standard practice to use 0 for the null
|
/* In C++ pre C++11 it is standard practice to use 0 for the null
|
||||||
pointer. But GCC -std=c++98 with -Wzero-as-null-pointer-constant
|
pointer. But GCC -std=c++98 with -Wzero-as-null-pointer-constant
|
||||||
warns about this. Warning introduced in GCC 4.7. */
|
warns about this. Warning introduced in GCC 4.7. */
|
||||||
#if defined __cplusplus && __cplusplus < 201103L
|
#if !defined __cplusplus || __cplusplus < 201103L
|
||||||
# if defined __GNUC__ && ! defined __clang__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
|
# if defined __GNUC__ && ! defined __clang__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
|
||||||
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
|
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
Reference in New Issue
Block a user