From 701cade1a260d5a78662e304a7cac0aaf2d77951 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 5 Nov 2014 16:19:10 +0000 Subject: [PATCH] Enable -fextended-identifiers by default. As proposed at , this patch enables -fextended-identifiers by default for all standard versions including this feature (all C++ versions, C99 and above for C, but not C90 / C94 / gnu89 / preprocessing assembler). It adds a couple of tests for areas where I previously noted testsuite coverage for extended identifiers was lacking, removes -fextended-identifiers from existing tests, adds -g to various such tests to verify that extended identifiers don't break debug info generation and removes the test that was only there to verify that the feature was off by default. The current state of the feature may not correspond exactly to any particular checklist from 2004/5 (see bug 9449) of what was wanted before enabling the feature by default, but I don't think it's any worse than plenty of other features supported by default before every corner case is fully functional, and think problems can readily be fixed incrementally. The following aspects of extended identifiers could still do with more work (and should be straightforward): * C -aux-info (output should use UCNs). * ObjC -gen-decls (output should use UCNs; associated diagnostics from the ObjC front end should use extended characters or UCNs as appropriate to the locale, via using %qE or identifier_to_locale). * Use DW_AT_use_UTF8 in DWARF-3 debug info for compilation units built with extended identifiers enabled (or unconditionally). * cpplib diagnostics (outputting characters or UCNs as appropriate depending on the locale, as done for identifiers in non-cpplib diagnostics). * C++ test for UCN linking with C and extern "C". * Check GDB support / file issues for support if needed. * Actual UTF-8 in identifiers (?). (Be careful about not affecting performance for the normal fast path of lexing identifiers, if possible.) The following may be trickier: * cpplib spelling preservation (required to diagnose macro redefinition with different spellings of the same identifier in the definition or argument names; different spellings of the name of the macro itself are OK, however; also required for correct handling of multiple stringizing in C++); correct output for -d (UCNs), DWARF debug info for macros (UCNs), PCH and PCH tests. (Spelling preservation is the issue that needs fixing to remove references to corner cases in the documentation of -std=c99 and -std=c11 and in c99status.html.) The idea would be to add a second pointer to cpp_identifier that stores the original spelling (whether for extended identifiers only, or for all identifiers); this does not enlarge cpp_token because the resulting larger cpp_identifier structure is no bigger than cpp_string. * C++ translation of extended characters (including $@` and various control characters) to UCNs in phase 1 (note diagnostics thus needed, but not for C++11, for control characters in strings / character constants as those UCNs invalid); a likely implementation approach is to do translation when identifiers / strings / character constants are lexed, together with errors for stray $@` / control characters in program as not being valid UCNs in identifiers ($ only if not accepted in identifiers); note that this translation should not take place inside raw string literals. Bootstrapped with no regressions on x86_64-unknown-linux-gnu. libcpp: PR preprocessor/9449 * init.c (lang_defaults): Enable extended identifiers for C++ and C99-based standards. gcc: PR preprocessor/9449 * doc/cpp.texi (Character sets, Tokenization) (Implementation-defined behavior): Don't refer to UCNs in identifiers requiring -fextended-identifiers. * doc/cppopts.texi (-fextended-identifiers): Document as enabled by default for C99 and later and C++. * doc/invoke.texi (-std=c99, -std=c11): Don't refer to extended identifiers needing -fextended-identifiers. gcc/testsuite: PR preprocessor/9449 * lib/target-supports.exp (check_effective_target_ucn_nocache): Don't use -fextended-identifiers. * c-c++-common/cpp/normalize-3.c, c-c++-common/cpp/ucnid-2011-1.c, g++.dg/cpp/ucn-1.C, g++.dg/cpp/ucnid-1.C, g++.dg/other/ucnid-1.C, gcc.dg/cpp/normalize-1.c, gcc.dg/cpp/normalize-2.c, gcc.dg/cpp/normalize-4.c: Don't use -fextended-identifiers. * gcc.dg/cpp/ucnid-1.c: Don't use -fextended-identifiers. Use -g3. * gcc.dg/cpp/ucnid-10.c, gcc.dg/cpp/ucnid-2.c, gcc.dg/cpp/ucnid-3.c, gcc.dg/cpp/ucnid-4.c, gcc.dg/cpp/ucnid-5.c, gcc.dg/cpp/ucnid-7.c, gcc.dg/cpp/ucnid-9.c, gcc.dg/cpp/warn-normalized-1.c, gcc.dg/cpp/warn-normalized-2.c, gcc.dg/cpp/warn-normalized-3.c: Don't use -fextended-identifiers. * gcc.dg/ucnid-1.c, gcc.dg/ucnid-2.c, gcc.dg/ucnid-3.c, gcc.dg/ucnid-4.c, gcc.dg/ucnid-5.c, gcc.dg/ucnid-6.c: Don't use -fextended-identifiers. Use -g. * gcc.dg/ucnid-7.c, gcc.dg/ucnid-8.c: Don't use -fextended-identifiers. * gcc.dg/ucnid-9.c: Don't use -fextended-identifiers. Use -g. * gcc.dg/ucnid-10.c: Don't use -fextended-identifiers. * gcc.dg/ucnid-11.c, gcc.dg/ucnid-12.c: Don't use -fextended-identifiers. Use -g. * gcc.dg/ucnid-13.c: Don't use -fextended-identifiers. * gcc.dg/cpp/ucnid-8.c: Remove test. * gcc.dg/cpp/ucnid-10.c, gcc.dg/ucnid-14.c: New tests. From-SVN: r217144 --- gcc/ChangeLog | 11 +++++++ gcc/doc/cpp.texi | 20 +++++-------- gcc/doc/cppopts.texi | 3 +- gcc/doc/invoke.texi | 8 ++--- gcc/testsuite/ChangeLog | 29 +++++++++++++++++++ gcc/testsuite/c-c++-common/cpp/normalize-3.c | 4 +-- gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c | 4 +-- gcc/testsuite/g++.dg/cpp/ucn-1.C | 2 +- gcc/testsuite/g++.dg/cpp/ucnid-1.C | 2 +- gcc/testsuite/g++.dg/other/ucnid-1.C | 2 +- gcc/testsuite/gcc.dg/cpp/normalize-1.c | 2 +- gcc/testsuite/gcc.dg/cpp/normalize-2.c | 2 +- gcc/testsuite/gcc.dg/cpp/normalize-4.c | 2 +- gcc/testsuite/gcc.dg/cpp/ucnid-1.c | 2 +- gcc/testsuite/gcc.dg/cpp/ucnid-10.c | 8 +++++ gcc/testsuite/gcc.dg/cpp/ucnid-2.c | 2 +- gcc/testsuite/gcc.dg/cpp/ucnid-3.c | 2 +- gcc/testsuite/gcc.dg/cpp/ucnid-4.c | 2 +- gcc/testsuite/gcc.dg/cpp/ucnid-5.c | 2 +- gcc/testsuite/gcc.dg/cpp/ucnid-7.c | 2 +- gcc/testsuite/gcc.dg/cpp/ucnid-8.c | 8 ----- gcc/testsuite/gcc.dg/cpp/ucnid-9.c | 2 +- gcc/testsuite/gcc.dg/cpp/warn-normalized-1.c | 2 +- gcc/testsuite/gcc.dg/cpp/warn-normalized-2.c | 2 +- gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c | 2 +- gcc/testsuite/gcc.dg/ucnid-1.c | 2 +- gcc/testsuite/gcc.dg/ucnid-10.c | 2 +- gcc/testsuite/gcc.dg/ucnid-11.c | 2 +- gcc/testsuite/gcc.dg/ucnid-12.c | 2 +- gcc/testsuite/gcc.dg/ucnid-13.c | 2 +- gcc/testsuite/gcc.dg/ucnid-14.c | 23 +++++++++++++++ gcc/testsuite/gcc.dg/ucnid-2.c | 2 +- gcc/testsuite/gcc.dg/ucnid-3.c | 2 +- gcc/testsuite/gcc.dg/ucnid-4.c | 2 +- gcc/testsuite/gcc.dg/ucnid-5.c | 2 +- gcc/testsuite/gcc.dg/ucnid-6.c | 2 +- gcc/testsuite/gcc.dg/ucnid-7.c | 2 +- gcc/testsuite/gcc.dg/ucnid-8.c | 2 +- gcc/testsuite/gcc.dg/ucnid-9.c | 2 +- gcc/testsuite/lib/target-supports.exp | 3 +- libcpp/ChangeLog | 6 ++++ libcpp/init.c | 28 ++++++++---------- 42 files changed, 136 insertions(+), 77 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/cpp/ucnid-10.c delete mode 100644 gcc/testsuite/gcc.dg/cpp/ucnid-8.c create mode 100644 gcc/testsuite/gcc.dg/ucnid-14.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2fe8c8af1e5..c5b14a00bcc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2014-11-05 Joseph Myers + + PR preprocessor/9449 + * doc/cpp.texi (Character sets, Tokenization) + (Implementation-defined behavior): Don't refer to UCNs in + identifiers requiring -fextended-identifiers. + * doc/cppopts.texi (-fextended-identifiers): Document as enabled + by default for C99 and later and C++. + * doc/invoke.texi (-std=c99, -std=c11): Don't refer to extended + identifiers needing -fextended-identifiers. + 2014-11-05 Ilya Tocar * config/i386/i386.c (expand_vec_perm_pshufb): Try vpermq/vpermd diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi index 0a6e50caac9..f32aac70b6e 100644 --- a/gcc/doc/cpp.texi +++ b/gcc/doc/cpp.texi @@ -275,11 +275,11 @@ the character in the source character set that they represent, then converted to the execution character set, just like unescaped characters. -Unless the experimental @option{-fextended-identifiers} option is used, -GCC does not permit the use of characters outside the ASCII range, nor -@samp{\u} and @samp{\U} escapes, in identifiers. Even with that -option, characters outside the ASCII range can only be specified with -the @samp{\u} and @samp{\U} escapes, not used directly in identifiers. +In identifiers, characters outside the ASCII range can only be +specified with the @samp{\u} and @samp{\U} escapes, not used +directly. If strict ISO C90 conformance is specified with an option +such as @option{-std=c90}, or @option{-fno-extended-identifiers} is +used, then those escapes are not permitted in identifiers. @node Initial processing @section Initial processing @@ -504,10 +504,8 @@ In the 1999 C standard, identifiers may contain letters which are not part of the ``basic source character set'', at the implementation's discretion (such as accented Latin letters, Greek letters, or Chinese ideograms). This may be done with an extended character set, or the -@samp{\u} and @samp{\U} escape sequences. The implementation of this -feature in GCC is experimental; such characters are only accepted in -the @samp{\u} and @samp{\U} forms and only if -@option{-fextended-identifiers} is used. +@samp{\u} and @samp{\U} escape sequences. GCC only accepts such +characters in the @samp{\u} and @samp{\U} forms. As an extension, GCC treats @samp{$} as a letter. This is for compatibility with some systems, such as VMS, where @samp{$} is commonly @@ -4100,9 +4098,7 @@ be controlled using the @option{-fexec-charset} and The C and C++ standards allow identifiers to be composed of @samp{_} and the alphanumeric characters. C++ and C99 also allow universal character names, and C99 further permits implementation-defined -characters. GCC currently only permits universal character names if -@option{-fextended-identifiers} is used, because the implementation of -universal character names in identifiers is experimental. +characters. GCC allows the @samp{$} character in identifiers as an extension for most targets. This is true regardless of the @option{std=} switch, diff --git a/gcc/doc/cppopts.texi b/gcc/doc/cppopts.texi index c5c8a70a63b..150e74f3d90 100644 --- a/gcc/doc/cppopts.texi +++ b/gcc/doc/cppopts.texi @@ -560,8 +560,7 @@ Accept @samp{$} in identifiers. @item -fextended-identifiers @opindex fextended-identifiers Accept universal character names in identifiers. This option is -experimental; in a future version of GCC, it will be enabled by -default for C99 and C++. +enabled by default for C99 (and later C standard versions) and C++. @item -fno-canonical-system-headers @opindex fno-canonical-system-headers diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index b7c8001b044..a6429333c3c 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1674,8 +1674,7 @@ ISO C90 as modified in amendment 1. @itemx iso9899:1999 @itemx iso9899:199x ISO C99. This standard is substantially completely supported, modulo -bugs, extended identifiers (supported except for corner cases when -@option{-fextended-identifiers} is used) and floating-point issues +bugs, corner cases of extended identifiers and floating-point issues (mainly but not entirely relating to optional C99 features from Annexes F and G). See @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The @@ -1685,9 +1684,8 @@ names @samp{c9x} and @samp{iso9899:199x} are deprecated. @itemx c1x @itemx iso9899:2011 ISO C11, the 2011 revision of the ISO C standard. This standard is -substantially completely supported, modulo bugs, extended identifiers -(supported except for corner cases when -@option{-fextended-identifiers} is used), floating-point issues +substantially completely supported, modulo bugs, corner cases of +extended identifiers, floating-point issues (mainly but not entirely relating to optional C11 features from Annexes F and G) and the optional Annexes K (Bounds-checking interfaces) and L (Analyzability). The name @samp{c1x} is deprecated. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9dea355cd68..924ed28c1aa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,32 @@ +2014-11-05 Joseph Myers + + PR preprocessor/9449 + * lib/target-supports.exp (check_effective_target_ucn_nocache): + Don't use -fextended-identifiers. + * c-c++-common/cpp/normalize-3.c, c-c++-common/cpp/ucnid-2011-1.c, + g++.dg/cpp/ucn-1.C, g++.dg/cpp/ucnid-1.C, g++.dg/other/ucnid-1.C, + gcc.dg/cpp/normalize-1.c, gcc.dg/cpp/normalize-2.c, + gcc.dg/cpp/normalize-4.c: Don't use -fextended-identifiers. + * gcc.dg/cpp/ucnid-1.c: Don't use -fextended-identifiers. Use + -g3. + * gcc.dg/cpp/ucnid-10.c, gcc.dg/cpp/ucnid-2.c, + gcc.dg/cpp/ucnid-3.c, gcc.dg/cpp/ucnid-4.c, gcc.dg/cpp/ucnid-5.c, + gcc.dg/cpp/ucnid-7.c, gcc.dg/cpp/ucnid-9.c, + gcc.dg/cpp/warn-normalized-1.c, gcc.dg/cpp/warn-normalized-2.c, + gcc.dg/cpp/warn-normalized-3.c: Don't use -fextended-identifiers. + * gcc.dg/ucnid-1.c, gcc.dg/ucnid-2.c, gcc.dg/ucnid-3.c, + gcc.dg/ucnid-4.c, gcc.dg/ucnid-5.c, gcc.dg/ucnid-6.c: Don't use + -fextended-identifiers. Use -g. + * gcc.dg/ucnid-7.c, gcc.dg/ucnid-8.c: Don't use + -fextended-identifiers. + * gcc.dg/ucnid-9.c: Don't use -fextended-identifiers. Use -g. + * gcc.dg/ucnid-10.c: Don't use -fextended-identifiers. + * gcc.dg/ucnid-11.c, gcc.dg/ucnid-12.c: Don't use + -fextended-identifiers. Use -g. + * gcc.dg/ucnid-13.c: Don't use -fextended-identifiers. + * gcc.dg/cpp/ucnid-8.c: Remove test. + * gcc.dg/cpp/ucnid-10.c, gcc.dg/ucnid-14.c: New tests. + 2014-11-05 Christophe Lyon * gcc.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp: diff --git a/gcc/testsuite/c-c++-common/cpp/normalize-3.c b/gcc/testsuite/c-c++-common/cpp/normalize-3.c index ae0184cfbb0..faafdbff08e 100644 --- a/gcc/testsuite/c-c++-common/cpp/normalize-3.c +++ b/gcc/testsuite/c-c++-common/cpp/normalize-3.c @@ -1,6 +1,6 @@ /* { dg-do preprocess } */ -/* { dg-options "-std=c99 -fextended-identifiers -Wnormalized=id" { target c } } */ -/* { dg-options "-fextended-identifiers -Wnormalized=id" { target c++ } } */ +/* { dg-options "-std=c99 -Wnormalized=id" { target c } } */ +/* { dg-options "-Wnormalized=id" { target c++ } } */ \u00AA \u00B7 diff --git a/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c b/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c index e3c6d260855..b7ebce8ea60 100644 --- a/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c +++ b/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c @@ -1,6 +1,6 @@ /* { dg-do preprocess } */ -/* { dg-options "-std=c11 -pedantic -fextended-identifiers" { target c } } */ -/* { dg-options "-std=c++11 -pedantic -fextended-identifiers" { target c++ } } */ +/* { dg-options "-std=c11 -pedantic" { target c } } */ +/* { dg-options "-std=c++11 -pedantic" { target c++ } } */ \u00A8 diff --git a/gcc/testsuite/g++.dg/cpp/ucn-1.C b/gcc/testsuite/g++.dg/cpp/ucn-1.C index b2d4f98fa0b..880e899e9e6 100644 --- a/gcc/testsuite/g++.dg/cpp/ucn-1.C +++ b/gcc/testsuite/g++.dg/cpp/ucn-1.C @@ -1,6 +1,6 @@ // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2170.html // { dg-do compile { target c++11 } } -// { dg-options "-fextended-identifiers" } +// { dg-options "" } int main() { diff --git a/gcc/testsuite/g++.dg/cpp/ucnid-1.C b/gcc/testsuite/g++.dg/cpp/ucnid-1.C index 7a8f72a5dc4..65c8995baad 100644 --- a/gcc/testsuite/g++.dg/cpp/ucnid-1.C +++ b/gcc/testsuite/g++.dg/cpp/ucnid-1.C @@ -1,5 +1,5 @@ /* { dg-do preprocess } */ -/* { dg-options "-std=gnu++98 -pedantic -fextended-identifiers" } */ +/* { dg-options "-std=gnu++98 -pedantic" } */ \u00AA /* { dg-error "not valid in an identifier" } */ \u00AB /* { dg-error "not valid in an identifier" } */ diff --git a/gcc/testsuite/g++.dg/other/ucnid-1.C b/gcc/testsuite/g++.dg/other/ucnid-1.C index 9a2728f25bb..95a31cb80fd 100644 --- a/gcc/testsuite/g++.dg/other/ucnid-1.C +++ b/gcc/testsuite/g++.dg/other/ucnid-1.C @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-fextended-identifiers" } */ +/* { dg-options "" } */ /* { dg-xfail-if "" { powerpc-ibm-aix* } { "*" } { "" } } */ /* { dg-skip-if "" { ! ucn } { "*" } { "" } } */ #include diff --git a/gcc/testsuite/gcc.dg/cpp/normalize-1.c b/gcc/testsuite/gcc.dg/cpp/normalize-1.c index b20f235ee98..768e1930e7a 100644 --- a/gcc/testsuite/gcc.dg/cpp/normalize-1.c +++ b/gcc/testsuite/gcc.dg/cpp/normalize-1.c @@ -1,5 +1,5 @@ /* { dg-do preprocess } */ -/* { dg-options "-std=c99 -fextended-identifiers" } */ +/* { dg-options "-std=c99" } */ \u00AA \u00B7 diff --git a/gcc/testsuite/gcc.dg/cpp/normalize-2.c b/gcc/testsuite/gcc.dg/cpp/normalize-2.c index 6f2f4956430..28ef2f18e42 100644 --- a/gcc/testsuite/gcc.dg/cpp/normalize-2.c +++ b/gcc/testsuite/gcc.dg/cpp/normalize-2.c @@ -1,5 +1,5 @@ /* { dg-do preprocess } */ -/* { dg-options "-std=c99 -fextended-identifiers -Wnormalized=nfkc" } */ +/* { dg-options "-std=c99 -Wnormalized=nfkc" } */ \u00AA /* { dg-warning "not in NFKC" } */ \u00B7 diff --git a/gcc/testsuite/gcc.dg/cpp/normalize-4.c b/gcc/testsuite/gcc.dg/cpp/normalize-4.c index 0040c03aa29..1ee3ff545d5 100644 --- a/gcc/testsuite/gcc.dg/cpp/normalize-4.c +++ b/gcc/testsuite/gcc.dg/cpp/normalize-4.c @@ -1,5 +1,5 @@ /* { dg-do preprocess } */ -/* { dg-options "-std=c99 -fextended-identifiers -Wnormalized=none" } */ +/* { dg-options "-std=c99 -Wnormalized=none" } */ \u00AA \u00B7 diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-1.c b/gcc/testsuite/gcc.dg/cpp/ucnid-1.c index 3fad08831a6..c77111dbb3e 100644 --- a/gcc/testsuite/gcc.dg/cpp/ucnid-1.c +++ b/gcc/testsuite/gcc.dg/cpp/ucnid-1.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-std=c99 -fextended-identifiers" } */ +/* { dg-options "-std=c99 -g3" } */ void abort (void); #define \u00C0 1 diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-10.c b/gcc/testsuite/gcc.dg/cpp/ucnid-10.c new file mode 100644 index 00000000000..0ac035b8546 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/ucnid-10.c @@ -0,0 +1,8 @@ +/* Test UCNs are allowed in preprocessing numbers. */ +/* { dg-do compile } */ +/* { dg-options "-std=c99" } */ + +#define a(x) b(x) +#define b(x) 0 +#define p ) +int c = a(0\u00c0.p); diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-2.c b/gcc/testsuite/gcc.dg/cpp/ucnid-2.c index 6719c783f56..616680a969e 100644 --- a/gcc/testsuite/gcc.dg/cpp/ucnid-2.c +++ b/gcc/testsuite/gcc.dg/cpp/ucnid-2.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-std=c99 -fextended-identifiers" } */ +/* { dg-options "-std=c99" } */ #include #include diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-3.c b/gcc/testsuite/gcc.dg/cpp/ucnid-3.c index 6389b7ebfee..a910037c316 100644 --- a/gcc/testsuite/gcc.dg/cpp/ucnid-3.c +++ b/gcc/testsuite/gcc.dg/cpp/ucnid-3.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-std=c99 -fextended-identifiers" } */ +/* { dg-options "-std=c99" } */ #define paste(x, y) x ## y diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-4.c b/gcc/testsuite/gcc.dg/cpp/ucnid-4.c index 6a6699b942c..e41a3f5907d 100644 --- a/gcc/testsuite/gcc.dg/cpp/ucnid-4.c +++ b/gcc/testsuite/gcc.dg/cpp/ucnid-4.c @@ -1,5 +1,5 @@ /* { dg-do preprocess } */ -/* { dg-options "-std=c99 -fextended-identifiers" } */ +/* { dg-options "-std=c99" } */ \u00AA \u00AB /* { dg-error "not valid in an identifier" } */ diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-5.c b/gcc/testsuite/gcc.dg/cpp/ucnid-5.c index cdccd3cdf6a..8fcaeac6f31 100644 --- a/gcc/testsuite/gcc.dg/cpp/ucnid-5.c +++ b/gcc/testsuite/gcc.dg/cpp/ucnid-5.c @@ -1,5 +1,5 @@ /* { dg-do preprocess } */ -/* { dg-options "-std=c99 -pedantic -fextended-identifiers" } */ +/* { dg-options "-std=c99 -pedantic" } */ \u00AA \u00AB /* { dg-error "not valid in an identifier" } */ diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-7.c b/gcc/testsuite/gcc.dg/cpp/ucnid-7.c index 93404225de1..854c948341a 100644 --- a/gcc/testsuite/gcc.dg/cpp/ucnid-7.c +++ b/gcc/testsuite/gcc.dg/cpp/ucnid-7.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-std=c99 -fextended-identifiers" } */ +/* { dg-options "-std=c99" } */ #define a b( #define b(x) q int a\U0000000z ); diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-8.c b/gcc/testsuite/gcc.dg/cpp/ucnid-8.c deleted file mode 100644 index 1f0379a5bb5..00000000000 --- a/gcc/testsuite/gcc.dg/cpp/ucnid-8.c +++ /dev/null @@ -1,8 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-std=c99" } */ -/* Test that -std=c99 does not enable extended identifiers while the - feature is experimental; remove this test after audit of all - identifier uses in the compiler. */ -#define a b( -#define b(x) q -int a\u00aa); diff --git a/gcc/testsuite/gcc.dg/cpp/ucnid-9.c b/gcc/testsuite/gcc.dg/cpp/ucnid-9.c index 8dc43458ec2..8562f9bf01f 100644 --- a/gcc/testsuite/gcc.dg/cpp/ucnid-9.c +++ b/gcc/testsuite/gcc.dg/cpp/ucnid-9.c @@ -1,5 +1,5 @@ /* { dg-do preprocess } */ -/* { dg-options "-std=c99 -pedantic -fextended-identifiers" } */ +/* { dg-options "-std=c99 -pedantic" } */ \u2160 \u2182 diff --git a/gcc/testsuite/gcc.dg/cpp/warn-normalized-1.c b/gcc/testsuite/gcc.dg/cpp/warn-normalized-1.c index fe1c5753074..c047f5f00ad 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-normalized-1.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-normalized-1.c @@ -1,4 +1,4 @@ // { dg-do preprocess } -// { dg-options "-std=gnu99 -fdiagnostics-show-option -fextended-identifiers -Wnormalized=nfc" } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wnormalized=nfc" } \u0F43 // { dg-warning "`.U00000f43' is not in NFC .-Wnormalized=." } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-normalized-2.c b/gcc/testsuite/gcc.dg/cpp/warn-normalized-2.c index f1fb96833d7..5c8c7c5007e 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-normalized-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-normalized-2.c @@ -1,4 +1,4 @@ // { dg-do preprocess } -// { dg-options "-std=gnu99 -fdiagnostics-show-option -fextended-identifiers -Wnormalized=nfkc" } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wnormalized=nfkc" } \u00AA // { dg-warning "`.U000000aa' is not in NFKC .-Wnormalized=." } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c b/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c index d6cd56f0151..2251e2836b2 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c @@ -1,4 +1,4 @@ // { dg-do preprocess } -// { dg-options "-std=gnu99 -fdiagnostics-show-option -fextended-identifiers -Werror=normalized=" } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=normalized=" } /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ \u0F43 // { dg-error "`.U00000f43' is not in NFC .-Werror=normalized=." } diff --git a/gcc/testsuite/gcc.dg/ucnid-1.c b/gcc/testsuite/gcc.dg/ucnid-1.c index ed89cfdeec4..067a6922a70 100644 --- a/gcc/testsuite/gcc.dg/ucnid-1.c +++ b/gcc/testsuite/gcc.dg/ucnid-1.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-std=c99 -fextended-identifiers" } */ +/* { dg-options "-std=c99 -g" } */ void abort (void); int main (void) diff --git a/gcc/testsuite/gcc.dg/ucnid-10.c b/gcc/testsuite/gcc.dg/ucnid-10.c index 83425d3cf15..1438337b230 100644 --- a/gcc/testsuite/gcc.dg/ucnid-10.c +++ b/gcc/testsuite/gcc.dg/ucnid-10.c @@ -1,7 +1,7 @@ /* Verify diagnostics for extended identifiers refer to UCNs (in the C locale). Test #pragma pack diagnostics. */ /* { dg-do compile } */ -/* { dg-options "-std=gnu99 -fextended-identifiers" } */ +/* { dg-options "-std=gnu99" } */ /* { dg-require-ascii-locale "" } */ /* { dg-skip-if "" { powerpc-ibm-aix* } { "*" } { "" } } */ diff --git a/gcc/testsuite/gcc.dg/ucnid-11.c b/gcc/testsuite/gcc.dg/ucnid-11.c index 6d40ef4d791..0ef6bfe5e6c 100644 --- a/gcc/testsuite/gcc.dg/ucnid-11.c +++ b/gcc/testsuite/gcc.dg/ucnid-11.c @@ -2,6 +2,6 @@ /* { dg-xfail-if "" { powerpc-ibm-aix* } { "*" } { "" } } */ /* { dg-skip-if "" { ! ucn } { "*" } { "" } } */ /* { dg-skip-if "-fdata-sections not supported" { { hppa*-*-hpux* } && { ! lp64 } } { "*" } { "" } } */ -/* { dg-options "-std=c99 -fextended-identifiers -fdata-sections" } */ +/* { dg-options "-std=c99 -fdata-sections -g" } */ #include "ucnid-3.c" diff --git a/gcc/testsuite/gcc.dg/ucnid-12.c b/gcc/testsuite/gcc.dg/ucnid-12.c index dd5e6d5d7f7..ca50653f899 100644 --- a/gcc/testsuite/gcc.dg/ucnid-12.c +++ b/gcc/testsuite/gcc.dg/ucnid-12.c @@ -2,6 +2,6 @@ /* { dg-xfail-if "" { powerpc-ibm-aix* } { "*" } { "" } } */ /* { dg-skip-if "" { ! ucn } { "*" } { "" } } */ /* { dg-skip-if "-ffunction-sections not supported" { { hppa*-*-hpux* } && { ! lp64 } } { "*" } { "" } } */ -/* { dg-options "-std=c99 -fextended-identifiers -ffunction-sections" } */ +/* { dg-options "-std=c99 -ffunction-sections -g" } */ #include "ucnid-4.c" diff --git a/gcc/testsuite/gcc.dg/ucnid-13.c b/gcc/testsuite/gcc.dg/ucnid-13.c index 0b94247ba9f..871f1034571 100644 --- a/gcc/testsuite/gcc.dg/ucnid-13.c +++ b/gcc/testsuite/gcc.dg/ucnid-13.c @@ -1,7 +1,7 @@ /* Verify diagnostics for extended identifiers refer to UCNs (in the C locale). Miscellaneous diagnostics. */ /* { dg-do compile } */ -/* { dg-options "-std=gnu99 -fextended-identifiers -Wpacked" } */ +/* { dg-options "-std=gnu99 -Wpacked" } */ /* { dg-require-ascii-locale "" } */ /* { dg-skip-if "" { powerpc-ibm-aix* } { "*" } { "" } } */ diff --git a/gcc/testsuite/gcc.dg/ucnid-14.c b/gcc/testsuite/gcc.dg/ucnid-14.c new file mode 100644 index 00000000000..8d4eb71465b --- /dev/null +++ b/gcc/testsuite/gcc.dg/ucnid-14.c @@ -0,0 +1,23 @@ +/* Test miscellaneous uses of UCNs in identifiers compile and run OK, + with debug info enabled. */ +/* { dg-do run } */ +/* { dg-options "-std=c99 -g" } */ + +extern void abort (void); +extern void exit (int); + +int +main (void) +{ + struct \u00C0 { int \u00C1; } x; + struct \u00C0 *y = &x; + y->\u00C1 = 1; + if (x.\U000000C1 != 1) + abort (); + goto \u00ff; + \u00ff: ; + enum e { \u00C2 = 4 }; + if (\u00C2 != 4) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/ucnid-2.c b/gcc/testsuite/gcc.dg/ucnid-2.c index 9cbc7504cec..577df38f623 100644 --- a/gcc/testsuite/gcc.dg/ucnid-2.c +++ b/gcc/testsuite/gcc.dg/ucnid-2.c @@ -1,7 +1,7 @@ /* { dg-do run } */ /* { dg-xfail-if "" { powerpc-ibm-aix* } { "*" } { "" } } */ /* { dg-skip-if "" { ! ucn } { "*" } { "" } } */ -/* { dg-options "-std=c99 -fextended-identifiers" } */ +/* { dg-options "-std=c99 -g" } */ void abort (void); static int \u00C0 = 1; diff --git a/gcc/testsuite/gcc.dg/ucnid-3.c b/gcc/testsuite/gcc.dg/ucnid-3.c index 5ea0d03bca1..0f8d46b15c9 100644 --- a/gcc/testsuite/gcc.dg/ucnid-3.c +++ b/gcc/testsuite/gcc.dg/ucnid-3.c @@ -1,7 +1,7 @@ /* { dg-do run } */ /* { dg-xfail-if "" { powerpc-ibm-aix* } { "*" } { "" } } */ /* { dg-skip-if "" { ! ucn } { "*" } { "" } } */ -/* { dg-options "-std=c99 -fextended-identifiers" } */ +/* { dg-options "-std=c99 -g" } */ void abort (void); int \u00C0 = 1; diff --git a/gcc/testsuite/gcc.dg/ucnid-4.c b/gcc/testsuite/gcc.dg/ucnid-4.c index a18e6e302a6..443dcb91798 100644 --- a/gcc/testsuite/gcc.dg/ucnid-4.c +++ b/gcc/testsuite/gcc.dg/ucnid-4.c @@ -1,7 +1,7 @@ /* { dg-do run } */ /* { dg-xfail-if "" { powerpc-ibm-aix* } { "*" } { "" } } */ /* { dg-skip-if "" { ! ucn } { "*" } { "" } } */ -/* { dg-options "-std=c99 -fextended-identifiers" } */ +/* { dg-options "-std=c99 -g" } */ void abort (void); int \u00C0(void) { return 1; } diff --git a/gcc/testsuite/gcc.dg/ucnid-5.c b/gcc/testsuite/gcc.dg/ucnid-5.c index c7ad8ffb38d..a83dc8d8d29 100644 --- a/gcc/testsuite/gcc.dg/ucnid-5.c +++ b/gcc/testsuite/gcc.dg/ucnid-5.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-skip-if "No dollar in identfiers" { "avr-*-*" } { "*" } { "" } } */ -/* { dg-options "-std=c99 -fdollars-in-identifiers -fextended-identifiers" } */ +/* { dg-options "-std=c99 -fdollars-in-identifiers -g" } */ void abort (void); int a$b(void) { return 1; } diff --git a/gcc/testsuite/gcc.dg/ucnid-6.c b/gcc/testsuite/gcc.dg/ucnid-6.c index 5713a84f265..70dd7b63cbf 100644 --- a/gcc/testsuite/gcc.dg/ucnid-6.c +++ b/gcc/testsuite/gcc.dg/ucnid-6.c @@ -1,7 +1,7 @@ /* { dg-do run } */ /* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "*" } { "" } } */ /* { dg-skip-if "" { ! ucn } { "*" } { "" } } */ -/* { dg-options "-std=c99 -fextended-identifiers -save-temps" } */ +/* { dg-options "-std=c99 -save-temps -g" } */ void abort (void); int \u00C0(void) { return 1; } diff --git a/gcc/testsuite/gcc.dg/ucnid-7.c b/gcc/testsuite/gcc.dg/ucnid-7.c index 3f73e35d4b1..b90bf68cd31 100644 --- a/gcc/testsuite/gcc.dg/ucnid-7.c +++ b/gcc/testsuite/gcc.dg/ucnid-7.c @@ -1,7 +1,7 @@ /* Verify diagnostics for extended identifiers refer to UCNs (in the C locale). */ /* { dg-do compile } */ -/* { dg-options "-std=c99 -fextended-identifiers" } */ +/* { dg-options "-std=c99" } */ /* { dg-require-ascii-locale "" } */ /* { dg-skip-if "" { "powerpc-ibm-aix*" } { "*" } { "" } } */ diff --git a/gcc/testsuite/gcc.dg/ucnid-8.c b/gcc/testsuite/gcc.dg/ucnid-8.c index da72e2d8e91..703b77654b7 100644 --- a/gcc/testsuite/gcc.dg/ucnid-8.c +++ b/gcc/testsuite/gcc.dg/ucnid-8.c @@ -1,7 +1,7 @@ /* Verify diagnostics for extended identifiers refer to UCNs (in the C locale). Further tests of C front-end diagnostics. */ /* { dg-do compile } */ -/* { dg-options "-std=gnu99 -fextended-identifiers -Wvla" } */ +/* { dg-options "-std=gnu99 -Wvla" } */ /* { dg-require-ascii-locale "" } */ /* { dg-skip-if "" { powerpc-ibm-aix* } { "*" } { "" } } */ diff --git a/gcc/testsuite/gcc.dg/ucnid-9.c b/gcc/testsuite/gcc.dg/ucnid-9.c index a6f91184a98..6af6d7665f4 100644 --- a/gcc/testsuite/gcc.dg/ucnid-9.c +++ b/gcc/testsuite/gcc.dg/ucnid-9.c @@ -3,7 +3,7 @@ /* { dg-do run } */ /* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "*" } { "" } } */ /* { dg-skip-if "" { ! ucn } { "*" } { "" } } */ -/* { dg-options "-std=c99 -fextended-identifiers -fexec-charset=ISO-8859-1" } */ +/* { dg-options "-std=c99 -fexec-charset=ISO-8859-1 -g" } */ /* { dg-require-iconv "ISO-8859-1" } */ extern int strcmp (const char *, const char *); diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 5a386415220..5e5338de168 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -2020,8 +2020,9 @@ proc check_effective_target_ucn_nocache { } { # -std=c99 is only valid for C if [check_effective_target_c] { set ucnopts "-std=c99" + } else { + set ucnopts "" } - append ucnopts " -fextended-identifiers" verbose "check_effective_target_ucn_nocache: compiling source" 2 set ret [check_no_compiler_messages_nocache ucn object { int \u00C0; diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 9f69feb777c..fc577f1ac75 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,9 @@ +2014-11-05 Joseph Myers + + PR preprocessor/9449 + * init.c (lang_defaults): Enable extended identifiers for C++ and + C99-based standards. + 2014-10-22 Alan Modra * symtab.c (ht_create): Use obstack_specify_allocation in place of diff --git a/libcpp/init.c b/libcpp/init.c index 8e1a2f6b282..2add6ea62de 100644 --- a/libcpp/init.c +++ b/libcpp/init.c @@ -95,25 +95,21 @@ struct lang_flags static const struct lang_flags lang_defaults[] = { /* c99 c++ xnum xid c11 std digr ulit rlit udlit bincst digsep trig */ /* GNUC89 */ { 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, - /* GNUC99 */ { 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 }, - /* GNUC11 */ { 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0 }, + /* GNUC99 */ { 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0 }, + /* GNUC11 */ { 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0 }, /* STDC89 */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 }, /* STDC94 */ { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1 }, - /* STDC99 */ { 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1 }, - /* STDC11 */ { 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1 }, - /* GNUCXX */ { 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, - /* CXX98 */ { 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1 }, - /* GNUCXX11 */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0 }, - /* CXX11 */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1 }, - /* GNUCXX14 */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0 }, - /* CXX14 */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, - /* GNUCXX1Z */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0 }, - /* CXX1Z */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, + /* STDC99 */ { 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1 }, + /* STDC11 */ { 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1 }, + /* GNUCXX */ { 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, + /* CXX98 */ { 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1 }, + /* GNUCXX11 */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0 }, + /* CXX11 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1 }, + /* GNUCXX14 */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0 }, + /* CXX14 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + /* GNUCXX1Z */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0 }, + /* CXX1Z */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, /* ASM */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - /* xid should be 1 for GNUC99, STDC99, GNUCXX, CXX98, GNUCXX11, CXX11, - GNUCXX14, and CXX14 when no longer experimental (when all uses of - identifiers in the compiler have been audited for correct handling - of extended identifiers). */ }; /* Sets internal flags correctly for a given language. */ -- 2.30.2