diff options
author | Edward Smith-Rowland <3dw4rd@verizon.net> | 2013-10-31 14:01:23 +0000 |
---|---|---|
committer | Edward Smith-Rowland <emsr@gcc.gnu.org> | 2013-10-31 14:01:23 +0000 |
commit | 7057e6452ba6b205085eede49eddf37c2feab29a (patch) | |
tree | 28dc58242b9d84a0f1723c9f24e40c623e194ef1 /libcpp/init.c | |
parent | b63cb15373bf384f1d644c4cfae0c60422cc3909 (diff) | |
download | gcc-7057e6452ba6b205085eede49eddf37c2feab29a.tar.gz |
Implement C++14 digit separators.
libcpp:
2013-10-31 Edward Smith-Rowland <3dw4rd@verizon.net>
Implement C++14 digit separators.
* include/cpplib.h (cpp_options): Add digit_separators flag.
* internal.h (DIGIT_SEP(c)): New macro.
* expr.c (cpp_classify_number): Check improper placement of digit sep;
(cpp_interpret_integer): Skip over digit separators.
* init.c (lang_flags): Add digit_separators flag; (lang_defaults): Add
digit separator flags per language; (cpp_set_lang): Set
digit_separators
* lex.c (lex_number): Add digits separator to allowable characters for
C++14.
gcc/c-family:
2013-10-31 Edward Smith-Rowland <3dw4rd@verizon.net>
Implement C++14 digit separators.
* c-lex.c (interpret_float): Remove digit separators from scratch string
before building real literal.
gcc/testsuite:
2013-10-31 Edward Smith-Rowland <3dw4rd@verizon.net>
Implement C++14 digit separators.
* g++.dg/cpp1y/digit-sep.C: New.
* g++.dg/cpp1y/digit-sep-neg.C: New.
* g++.dg/cpp1y/digit-sep-cxx11-neg.C: New.
libstdc++-v3:
2013-10-31 Edward Smith-Rowland <3dw4rd@verizon.net>
Implement C++14 digit separators.
* include/include/bits/parse_numbers.h: Change struct _Digit<_Base, '`'>
to struct _Digit<_Base, '\''>.
From-SVN: r204260
Diffstat (limited to 'libcpp/init.c')
-rw-r--r-- | libcpp/init.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/libcpp/init.c b/libcpp/init.c index 97510003dd8..97aa6cdd45f 100644 --- a/libcpp/init.c +++ b/libcpp/init.c @@ -84,24 +84,25 @@ struct lang_flags char rliterals; char user_literals; char binary_constants; + char digit_separators; }; static const struct lang_flags lang_defaults[] = -{ /* c99 c++ xnum xid std // digr ulit rlit udlit bin_cst */ - /* GNUC89 */ { 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0 }, - /* GNUC99 */ { 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0 }, - /* GNUC11 */ { 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0 }, - /* STDC89 */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, - /* STDC94 */ { 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0 }, - /* STDC99 */ { 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0 }, - /* STDC11 */ { 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0 }, - /* GNUCXX */ { 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0 }, - /* CXX98 */ { 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0 }, - /* GNUCXX11 */ { 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0 }, - /* CXX11 */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0 }, - /* GNUCXX1Y */ { 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1 }, - /* CXX1Y */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1 }, - /* ASM */ { 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0 } +{ /* c99 c++ xnum xid std // digr ulit rlit udlit bin_cst dig_sep */ + /* GNUC89 */ { 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0 }, + /* GNUC99 */ { 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0 }, + /* GNUC11 */ { 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0 }, + /* STDC89 */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 }, + /* STDC94 */ { 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 }, + /* STDC99 */ { 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0 }, + /* STDC11 */ { 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0 }, + /* GNUCXX */ { 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0 }, + /* CXX98 */ { 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0 }, + /* GNUCXX11 */ { 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0 }, + /* CXX11 */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0 }, + /* GNUCXX1Y */ { 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1 }, + /* CXX1Y */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1 }, + /* ASM */ { 0, 0, 1, 0, 0, 1, 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 identifiers in the compiler have been audited for correct handling @@ -128,6 +129,7 @@ cpp_set_lang (cpp_reader *pfile, enum c_lang lang) CPP_OPTION (pfile, rliterals) = l->rliterals; CPP_OPTION (pfile, user_literals) = l->user_literals; CPP_OPTION (pfile, binary_constants) = l->binary_constants; + CPP_OPTION (pfile, digit_separators) = l->digit_separators; } /* Initialize library global state. */ |