diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-05 16:19:10 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-05 16:19:10 +0000 |
commit | 957957232f138bc80adeb9e759c5f483dda350c3 (patch) | |
tree | a5b5e4b6d1278ce3bdbc1a037dcffa589ea593a2 /libcpp | |
parent | 05e7532b756dd2061dfd429eb270622f6c6766c0 (diff) | |
download | gcc-957957232f138bc80adeb9e759c5f483dda350c3.tar.gz |
Enable -fextended-identifiers by default.
As proposed at <https://gcc.gnu.org/ml/gcc/2014-11/msg00014.html>,
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217144 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 6 | ||||
-rw-r--r-- | libcpp/init.c | 28 |
2 files changed, 18 insertions, 16 deletions
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 <joseph@codesourcery.com> + + PR preprocessor/9449 + * init.c (lang_defaults): Enable extended identifiers for C++ and + C99-based standards. + 2014-10-22 Alan Modra <amodra@gmail.com> * 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. */ |