diff --git a/data/c++.m4 b/data/c++.m4 index 38a08328..fd5ec182 100644 --- a/data/c++.m4 +++ b/data/c++.m4 @@ -272,7 +272,7 @@ m4_define([b4_symbol_type_declare], location_type location;])[ private: -#if defined __cplusplus && __cplusplus < 201103L +#if !defined __cplusplus || __cplusplus < 201103L /// Assignment operator. basic_symbol& operator= (const basic_symbol& other); #endif diff --git a/data/lalr1.cc b/data/lalr1.cc index f38015ba..30c6f7b9 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -335,7 +335,7 @@ m4_define([b4_shared_declarations], stack_symbol_type (YY_RVREF (stack_symbol_type) that); /// Steal the contents from \a sym to build this. 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. /// Moves the contents of that. stack_symbol_type& operator= (stack_symbol_type& that); @@ -626,7 +626,7 @@ m4_if(b4_prefix, [yy], [], 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::operator= (stack_symbol_type& that) { diff --git a/examples/c++/variant.yy b/examples/c++/variant.yy index f77a746a..8fba6325 100644 --- a/examples/c++/variant.yy +++ b/examples/c++/variant.yy @@ -98,7 +98,7 @@ item: namespace yy { // Use nullptr with pre-C++11. -#if defined __cplusplus && __cplusplus < 201103L +#if !defined __cplusplus || __cplusplus < 201103L # define NULLPTR 0 #else # define NULLPTR nullptr diff --git a/tests/local.at b/tests/local.at index 7ab7dbfc..89a117b8 100644 --- a/tests/local.at +++ b/tests/local.at @@ -912,14 +912,14 @@ m4_define([AT_REQUIRE_CXX_VERSION], [AT_DATA([check.cc], [[int main () { -#if __cplusplus < ]m4_case([$1], - [98], [199711], - [03], [199711], - [11], [201103], - [14], [201402], - [17], [201703], - [2a], [201709], - [m4_fatal([$0: invalid arguments: $@])])[ +#if !defined __cplusplus || __cplusplus < ]m4_case([$1], + [98], [199711], + [03], [199711], + [11], [201103], + [14], [201402], + [17], [201703], + [2a], [201709], + [m4_fatal([$0: invalid arguments: $@])])[ return 77; #else return 0; diff --git a/tests/testsuite.h b/tests/testsuite.h index e4c8298d..7e8e0599 100644 --- a/tests/testsuite.h +++ b/tests/testsuite.h @@ -7,7 +7,7 @@ /* 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 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__ # pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" # endif