c++: factor the handling of __cplusplus into YY_CPLUSPLUS

* data/c++.m4 (b4_cxx_portability): Define it.
Use it.
* data/lalr1.cc, data/variant.hh: Use it.
This commit is contained in:
Akim Demaille
2018-11-13 06:49:24 +01:00
parent a52723e3e8
commit 7adeb80765
4 changed files with 16 additions and 9 deletions

View File

@@ -53,8 +53,14 @@ m4_define([b4_inline],
# b4_cxx_portability
# ------------------
m4_define([b4_cxx_portability],
[// Support move semantics when possible.
#if defined __cplusplus && 201103L <= __cplusplus
[#if defined __cplusplus
# define YY_CPLUSPLUS __cplusplus
#else
# define YY_CPLUSPLUS 199711L
#endif
// Support move semantics when possible.
#if 201103L <= YY_CPLUSPLUS
# define YY_MOVE std::move
# define YY_MOVE_OR_COPY move
# define YY_MOVE_REF(Type) Type&&