diff options
author | emsr <emsr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-10 15:53:12 +0000 |
---|---|---|
committer | emsr <emsr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-10 15:53:12 +0000 |
commit | 3aa2fa443f8de74ae74fb13ec81ce2edc1b29a82 (patch) | |
tree | cdf2ab35de7a1da1bcda63af97f127dea644c2ce /gcc/c-family/c-cppbuiltin.c | |
parent | 05d5a6da74f67ca19d687dcb96bc08f03cba78e4 (diff) | |
download | gcc-3aa2fa443f8de74ae74fb13ec81ce2edc1b29a82.tar.gz |
libcpp:
2014-11-10 Edward Smith-Rowland <3dw4rd@verizon.net>
* include/cpplib.h (cpp_callbacks): Add has_attribute.
* internal.h (lexer_state): Add in__has_attribute__.
* directives.c (lex_macro_node): Prevent use of __has_attribute__
as a macro.
* expr.c (parse_has_attribute): New function; (eval_token): Look for
__has_attribute__ and route to parse_has_attribute.
* identifiers.c (_cpp_init_hashtable): Initialize n__has_attribute__.
* pch.c (cpp_read_state): Initialize n__has_attribute__.
* traditional.c (enum ls): Add ls_has_attribute, ls_has_attribute_close;
(_cpp_scan_out_logical_line): Attend to __has_attribute__.
gcc/c-family:
2014-11-10 Edward Smith-Rowland <3dw4rd@verizon.net>
* c-cppbuiltin.c (__has_attribute, __has_cpp_attribute): New macros;
(__cpp_rtti, __cpp_exceptions): New macros for C++98;
(__cpp_range_based_for, __cpp_initializer_lists,
__cpp_delegating_constructors, __cpp_nsdmi,
__cpp_inheriting_constructors, __cpp_ref_qualifiers): New macros
for C++11; (__cpp_attribute_deprecated): Remove in favor of
__has_cpp_attribute.
* c-lex.c (cb_has_attribute): New callback CPP function;
(init_c_lex): Set has_attribute callback.
gcc/testsuite:
2014-11-10 Edward Smith-Rowland <3dw4rd@verizon.net>
* g++.dg/cpp1y/feat-cxx11.C: Test new feature macros for C++98
and C++11; Test existence of __has_cpp_attribute; Test C++11
attributes.
* g++.dg/cpp1y/feat-cxx11-neg.C: Ditto.
* g++.dg/cpp1y/feat-cxx14.C: Ditto and test for C++14 attributes.
* g++.dg/cpp1y/feat-cxx98.C: Test new feature macros for C++98.
* g++.dg/cpp1y/feat-cxx98-neg.C: Ditto.
* g++.dg/cpp1y/feat-neg.C: Test that __cpp_rtti, _cpp_exceptions
will be undefined for -fno-rtti -fno-exceptions.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217292 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family/c-cppbuiltin.c')
-rw-r--r-- | gcc/c-family/c-cppbuiltin.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index 26fabc2e4c4..a4ed5c62ba7 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -790,11 +790,16 @@ c_cpp_builtins (cpp_reader *pfile) c_stddef_cpp_builtins (); /* Set include test macros for all C/C++ (not for just C++11 etc.) - the builtins __has_include__ and __has_include_next__ are defined + The builtins __has_include__ and __has_include_next__ are defined in libcpp. */ cpp_define (pfile, "__has_include(STR)=__has_include__(STR)"); cpp_define (pfile, "__has_include_next(STR)=__has_include_next__(STR)"); + /* Set attribute test macros for all C/C++ (not for just C++11 etc.) + The builtin __has_attribute__ is defined in libcpp. */ + cpp_define (pfile, "__has_attribute(STR)=__has_attribute__(STR)"); + cpp_define (pfile, "__has_cpp_attribute(STR)=__has_attribute__(STR)"); + if (c_dialect_cxx ()) { if (flag_weak && SUPPORTS_ONE_ONLY) @@ -806,7 +811,10 @@ c_cpp_builtins (cpp_reader *pfile) cpp_define (pfile, "__DEPRECATED"); if (flag_rtti) - cpp_define (pfile, "__GXX_RTTI"); + { + cpp_define (pfile, "__GXX_RTTI"); + cpp_define (pfile, "__cpp_rtti=199711"); + } if (cxx_dialect >= cxx11) cpp_define (pfile, "__GXX_EXPERIMENTAL_CXX0X__"); @@ -824,13 +832,18 @@ c_cpp_builtins (cpp_reader *pfile) cpp_define (pfile, "__cpp_user_defined_literals=200809"); cpp_define (pfile, "__cpp_lambdas=200907"); cpp_define (pfile, "__cpp_constexpr=200704"); + cpp_define (pfile, "__cpp_range_based_for=200907"); cpp_define (pfile, "__cpp_static_assert=200410"); cpp_define (pfile, "__cpp_decltype=200707"); cpp_define (pfile, "__cpp_attributes=200809"); cpp_define (pfile, "__cpp_rvalue_reference=200610"); cpp_define (pfile, "__cpp_variadic_templates=200704"); + cpp_define (pfile, "__cpp_initializer_lists=200806"); + cpp_define (pfile, "__cpp_delegating_constructors=200604"); + cpp_define (pfile, "__cpp_nsdmi=200809"); + cpp_define (pfile, "__cpp_inheriting_constructors=200802"); + cpp_define (pfile, "__cpp_ref_qualifiers=200710"); cpp_define (pfile, "__cpp_alias_templates=200704"); - cpp_define (pfile, "__cpp_attribute_deprecated=201309"); } if (cxx_dialect > cxx11) { @@ -853,7 +866,11 @@ c_cpp_builtins (cpp_reader *pfile) /* Note that we define this for C as well, so that we know if __attribute__((cleanup)) will interface with EH. */ if (flag_exceptions) - cpp_define (pfile, "__EXCEPTIONS"); + { + cpp_define (pfile, "__EXCEPTIONS"); + if (c_dialect_cxx ()) + cpp_define (pfile, "__cpp_exceptions=199711"); + } /* Represents the C++ ABI version, always defined so it can be used while preprocessing C and assembler. */ |