+2014-11-05 Joseph Myers <joseph@codesourcery.com>
+
+ 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 <ilya.tocar@intel.com>
* config/i386/i386.c (expand_vec_perm_pshufb): Try vpermq/vpermd
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
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
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,
@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
@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
@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.
+2014-11-05 Joseph Myers <joseph@codesourcery.com>
+
+ 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 <christophe.lyon@linaro.org>
* gcc.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp:
/* { 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
/* { 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
// 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()
{
/* { 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" } */
/* { dg-do run } */
-/* { dg-options "-fextended-identifiers" } */
+/* { dg-options "" } */
/* { dg-xfail-if "" { powerpc-ibm-aix* } { "*" } { "" } } */
/* { dg-skip-if "" { ! ucn } { "*" } { "" } } */
#include <cstdlib>
/* { dg-do preprocess } */
-/* { dg-options "-std=c99 -fextended-identifiers" } */
+/* { dg-options "-std=c99" } */
\u00AA
\u00B7
/* { dg-do preprocess } */
-/* { dg-options "-std=c99 -fextended-identifiers -Wnormalized=nfkc" } */
+/* { dg-options "-std=c99 -Wnormalized=nfkc" } */
\u00AA /* { dg-warning "not in NFKC" } */
\u00B7
/* { dg-do preprocess } */
-/* { dg-options "-std=c99 -fextended-identifiers -Wnormalized=none" } */
+/* { dg-options "-std=c99 -Wnormalized=none" } */
\u00AA
\u00B7
/* { dg-do run } */
-/* { dg-options "-std=c99 -fextended-identifiers" } */
+/* { dg-options "-std=c99 -g3" } */
void abort (void);
#define \u00C0 1
--- /dev/null
+/* 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);
/* { dg-do run } */
-/* { dg-options "-std=c99 -fextended-identifiers" } */
+/* { dg-options "-std=c99" } */
#include <stdlib.h>
#include <string.h>
/* { dg-do compile } */
-/* { dg-options "-std=c99 -fextended-identifiers" } */
+/* { dg-options "-std=c99" } */
#define paste(x, y) x ## y
/* { dg-do preprocess } */
-/* { dg-options "-std=c99 -fextended-identifiers" } */
+/* { dg-options "-std=c99" } */
\u00AA
\u00AB /* { dg-error "not valid in an identifier" } */
/* { dg-do preprocess } */
-/* { dg-options "-std=c99 -pedantic -fextended-identifiers" } */
+/* { dg-options "-std=c99 -pedantic" } */
\u00AA
\u00AB /* { dg-error "not valid in an identifier" } */
/* { dg-do compile } */
-/* { dg-options "-std=c99 -fextended-identifiers" } */
+/* { dg-options "-std=c99" } */
#define a b(
#define b(x) q
int a\U0000000z );
+++ /dev/null
-/* { 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);
/* { dg-do preprocess } */
-/* { dg-options "-std=c99 -pedantic -fextended-identifiers" } */
+/* { dg-options "-std=c99 -pedantic" } */
\u2160
\u2182
// { 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=." }
// { 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=." }
// { 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=." }
/* { dg-do run } */
-/* { dg-options "-std=c99 -fextended-identifiers" } */
+/* { dg-options "-std=c99 -g" } */
void abort (void);
int main (void)
/* 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* } { "*" } { "" } } */
/* { 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"
/* { 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"
/* 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* } { "*" } { "" } } */
--- /dev/null
+/* 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);
+}
/* { 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;
/* { 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;
/* { 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; }
/* { 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; }
/* { 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; }
/* 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*" } { "*" } { "" } } */
/* 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* } { "*" } { "" } } */
/* { 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 *);
# -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;
+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
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. */