diff options
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 11 | ||||
-rw-r--r-- | libcpp/expr.c | 2 | ||||
-rw-r--r-- | libcpp/include/cpplib.h | 2 | ||||
-rw-r--r-- | libcpp/init.c | 50 |
4 files changed, 42 insertions, 23 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 89c840658f0..1b4e31d6be2 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,14 @@ +2014-08-23 Edward Smith-Rowland <3dw4rd@verizon.net> + + * include/cpplib.h (enum c_lang): Add CLK_GNUCXX1Z, CLK_CXX1Z; + Rename CLK_GNUCXX1Y, CLK_CXX1Y to CLK_GNUCXX14, CLK_CXX14; + * init.c (struct lang_flags lang_defaults): Add column for trigraphs; + Add rows for CLK_GNUCXX1Z, CLK_CXX1Z; (cpp_set_lang): Set trigraphs; + (cpp_init_builtins): Set __cplusplus to 201402L for C++14; + Set __cplusplus to 201500L for C++17. + * expr.c (cpp_classify_number): Change C++1y to C++14 in binary + constants error message. + 2014-08-20 Marek Polacek <polacek@redhat.com> * include/cpplib.h (cpp_options): Use signed char. diff --git a/libcpp/expr.c b/libcpp/expr.c index 147bd97c5ec..07f1b2fb419 100644 --- a/libcpp/expr.c +++ b/libcpp/expr.c @@ -687,7 +687,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token, && CPP_PEDANTIC (pfile)) cpp_error_with_line (pfile, CPP_DL_PEDWARN, virtual_location, 0, CPP_OPTION (pfile, cplusplus) - ? "binary constants are a C++1y feature " + ? "binary constants are a C++14 feature " "or GCC extension" : "binary constants are a GCC extension"); diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index 9f87ff8b514..28fc0f8965f 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -166,7 +166,7 @@ enum cpp_ttype enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC11, CLK_STDC89, CLK_STDC94, CLK_STDC99, CLK_STDC11, CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11, - CLK_GNUCXX1Y, CLK_CXX1Y, CLK_ASM}; + CLK_GNUCXX14, CLK_CXX14, CLK_GNUCXX1Z, CLK_CXX1Z, CLK_ASM}; /* Payload of a NUMBER, STRING, CHAR or COMMENT token. */ struct GTY(()) cpp_string { diff --git a/libcpp/init.c b/libcpp/init.c index b80951544d4..0d2f73718be 100644 --- a/libcpp/init.c +++ b/libcpp/init.c @@ -90,26 +90,29 @@ struct lang_flags char user_literals; char binary_constants; char digit_separators; + char trigraphs; }; static const struct lang_flags lang_defaults[] = -{ /* c99 c++ xnum xid c11 std // digr ulit rlit udlit bin_cst dig_sep */ - /* GNUC89 */ { 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0 }, - /* GNUC99 */ { 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0 }, - /* GNUC11 */ { 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0 }, - /* STDC89 */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 }, - /* STDC94 */ { 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 }, - /* STDC99 */ { 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0 }, - /* STDC11 */ { 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 }, - /* GNUCXX */ { 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0 }, - /* CXX98 */ { 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0 }, - /* GNUCXX11 */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0 }, - /* CXX11 */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 }, - /* GNUCXX1Y */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1 }, - /* CXX1Y */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, - /* ASM */ { 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 } +{ /* c99 c++ xnum xid c11 std // digr ulit rlit udlit bincst digsep trig */ + /* GNUC89 */ { 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 }, + /* GNUC99 */ { 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 }, + /* GNUC11 */ { 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0 }, + /* STDC89 */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1 }, + /* STDC94 */ { 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1 }, + /* STDC99 */ { 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1 }, + /* STDC11 */ { 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1 }, + /* GNUCXX */ { 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 }, + /* CXX98 */ { 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1 }, + /* GNUCXX11 */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0 }, + /* CXX11 */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1 }, + /* GNUCXX14 */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0 }, + /* CXX14 */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + /* GNUCXX1Z */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0 }, + /* CXX1Z */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, + /* ASM */ { 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 } /* xid should be 1 for GNUC99, STDC99, GNUCXX, CXX98, GNUCXX11, CXX11, - GNUCXX1Y, and CXX1Y when no longer experimental (when all uses of + GNUCXX14, and CXX14 when no longer experimental (when all uses of identifiers in the compiler have been audited for correct handling of extended identifiers). */ }; @@ -128,7 +131,6 @@ cpp_set_lang (cpp_reader *pfile, enum c_lang lang) CPP_OPTION (pfile, extended_identifiers) = l->extended_identifiers; CPP_OPTION (pfile, c11_identifiers) = l->c11_identifiers; CPP_OPTION (pfile, std) = l->std; - CPP_OPTION (pfile, trigraphs) = l->std; CPP_OPTION (pfile, cplusplus_comments) = l->cplusplus_comments; CPP_OPTION (pfile, digraphs) = l->digraphs; CPP_OPTION (pfile, uliterals) = l->uliterals; @@ -136,6 +138,7 @@ cpp_set_lang (cpp_reader *pfile, enum c_lang lang) CPP_OPTION (pfile, user_literals) = l->user_literals; CPP_OPTION (pfile, binary_constants) = l->binary_constants; CPP_OPTION (pfile, digit_separators) = l->digit_separators; + CPP_OPTION (pfile, trigraphs) = l->trigraphs; } /* Initialize library global state. */ @@ -489,9 +492,12 @@ cpp_init_builtins (cpp_reader *pfile, int hosted) if (CPP_OPTION (pfile, cplusplus)) { - if (CPP_OPTION (pfile, lang) == CLK_CXX1Y - || CPP_OPTION (pfile, lang) == CLK_GNUCXX1Y) - _cpp_define_builtin (pfile, "__cplusplus 201300L"); + if (CPP_OPTION (pfile, lang) == CLK_CXX1Z + || CPP_OPTION (pfile, lang) == CLK_GNUCXX1Z) + _cpp_define_builtin (pfile, "__cplusplus 201500L"); + else if (CPP_OPTION (pfile, lang) == CLK_CXX14 + || CPP_OPTION (pfile, lang) == CLK_GNUCXX14) + _cpp_define_builtin (pfile, "__cplusplus 201402L"); else if (CPP_OPTION (pfile, lang) == CLK_CXX11 || CPP_OPTION (pfile, lang) == CLK_GNUCXX11) _cpp_define_builtin (pfile, "__cplusplus 201103L"); @@ -509,7 +515,9 @@ cpp_init_builtins (cpp_reader *pfile, int hosted) _cpp_define_builtin (pfile, "__STDC_VERSION__ 199901L"); if (CPP_OPTION (pfile, uliterals) - && !CPP_OPTION (pfile, cplusplus)) + && !(CPP_OPTION (pfile, cplusplus) + && (CPP_OPTION (pfile, lang) == CLK_GNUCXX + || CPP_OPTION (pfile, lang) == CLK_CXX98))) { _cpp_define_builtin (pfile, "__STDC_UTF_16__ 1"); _cpp_define_builtin (pfile, "__STDC_UTF_32__ 1"); |