This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch to restrict extended identifiers to -fextended-identifiersoption


As per <http://gcc.gnu.org/ml/gcc-patches/2005-03/msg01665.html>, Zack
no longer being in GCC development to do this patch himself, there
having been no sign on the GCC lists of an audit of all uses of
identifiers in the compiler for assumptions that break when
identifiers have characters outside A-Za-z0-9_$ (and there being at
least the case of diagnostic output as a known unfixed case of such an
assumption), this patch restricts UCNs in identifiers only to be
accepted when a special option -fextended-identifiers is passed.  In
so doing, it updates documentation which still indicated this feature
was not implemented at all to indicate that there is a limited (UCNs
but not the characters they denote accepted) experimental
implementation conditional on the new option.  It doesn't deal with
the general question of documenting the phase 1 handling properly
(under "Implementation-defined behavior" in cpp.texi), but some
possible wording for that to improve on the present situation is
suggested in bug 9449.

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
commit?

gcc:
2005-09-16  Joseph S. Myers  <joseph@codesourcery.com>

	* c.opt (fextended-identifiers): New.
	* c-opts.c (c_common_handle_option): Handle
	-fextended-identifiers.
	* doc/cpp.texi: Update documentation of extended identifiers.
	* doc/cppopts.texi (-fextended-identifiers): Document.

gcc/testsuite:
2005-09-16  Joseph S. Myers  <joseph@codesourcery.com>

	* g++.dg/cpp/ucnid-1.C, g++.dg/cpp/normalize-1.C,
	g++.dg/other/ucnid-1.C, gcc.dg/cpp/normalize-1.c,
	gcc.dg/cpp/normalize-2.c, gcc.dg/cpp/normalize-3.c,
	gcc.dg/cpp/normalize-4.c, gcc.dg/cpp/ucnid-1.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/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: Add -fextended-identifiers.
	* gcc.dg/cpp/ucnid-8.c: New test.

libcpp:
2005-09-16  Joseph S. Myers  <joseph@codesourcery.com>

	* include/cpplib.h (struct cpp_options): Add extended_identifiers.
	* init.c (struct lang_flags, lang_defaults): Add
	extended_identifiers.
	(cpp_set_lang): Use it.
	* lex.c (forms_identifier_p): Check extended_identifiers.

diff -rupN GCC.orig/gcc/c-opts.c GCC/gcc/c-opts.c
--- GCC.orig/gcc/c-opts.c	2005-07-19 15:28:10.000000000 +0000
+++ GCC/gcc/c-opts.c	2005-09-15 23:30:13.000000000 +0000
@@ -647,6 +647,10 @@ c_common_handle_option (size_t scode, co
       flag_enforce_eh_specs = value;
       break;
 
+    case OPT_fextended_identifiers:
+      cpp_opts->extended_identifiers = value;
+      break;
+
     case OPT_ffixed_form:
     case OPT_ffixed_line_length_:
       /* Fortran front end options ignored when preprocessing only.  */
diff -rupN GCC.orig/gcc/c.opt GCC/gcc/c.opt
--- GCC.orig/gcc/c.opt	2005-09-13 15:46:23.000000000 +0000
+++ GCC/gcc/c.opt	2005-09-15 23:28:47.000000000 +0000
@@ -495,6 +495,10 @@ fexec-charset=
 C ObjC C++ ObjC++ Joined RejectNegative
 -fexec-charset=<cset>	Convert all strings and character constants to character set <cset>
 
+fextended-identifiers
+C ObjC C++ ObjC++
+Permit universal character names (\\u and \\U) in identifiers
+
 finput-charset=
 C ObjC C++ ObjC++ Joined RejectNegative
 -finput-charset=<cset>	Specify the default character set for source files
diff -rupN GCC.orig/gcc/doc/cpp.texi GCC/gcc/doc/cpp.texi
--- GCC.orig/gcc/doc/cpp.texi	2005-08-19 12:07:32.000000000 +0000
+++ GCC/gcc/doc/cpp.texi	2005-09-15 23:50:19.000000000 +0000
@@ -281,11 +281,11 @@ the character in the source character se
 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.  We hope this will
-change eventually, but there are problems with the standard semantics
-of such ``extended identifiers'' which must be resolved through the
-ISO C and C++ committees first.
+@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.
 
 @node Initial processing
 @section Initial processing
@@ -510,8 +510,10 @@ In the 1999 C standard, identifiers may 
 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.  GCC does not presently
-implement either feature in the preprocessor or the compiler.
+@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.
 
 As an extension, GCC treats @samp{$} as a letter.  This is for
 compatibility with some systems, such as VMS, where @samp{$} is commonly
@@ -3791,7 +3793,9 @@ character set may be controlled by the u
 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.
+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.
 
 GCC allows the @samp{$} character in identifiers as an extension for
 most targets.  This is true regardless of the @option{std=} switch,
diff -rupN GCC.orig/gcc/doc/cppopts.texi GCC/gcc/doc/cppopts.texi
--- GCC.orig/gcc/doc/cppopts.texi	2005-07-26 11:50:16.000000000 +0000
+++ GCC/gcc/doc/cppopts.texi	2005-09-15 23:43:04.000000000 +0000
@@ -511,6 +511,12 @@ Accept @samp{$} in identifiers.
   @xref{Identifier characters}.
 @end ifset
 
+@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++.
+
 @item -fpreprocessed
 @opindex fpreprocessed
 Indicate to the preprocessor that the input file has already been
diff -rupN GCC.orig/gcc/testsuite/g++.dg/cpp/normalize-1.C GCC/gcc/testsuite/g++.dg/cpp/normalize-1.C
--- GCC.orig/gcc/testsuite/g++.dg/cpp/normalize-1.C	2005-03-15 00:36:27.000000000 +0000
+++ GCC/gcc/testsuite/g++.dg/cpp/normalize-1.C	2005-09-16 00:50:34.000000000 +0000
@@ -1,5 +1,5 @@
 /* { dg-do preprocess } */
-/* { dg-options "-Wnormalized=id" } */
+/* { dg-options "-fextended-identifiers -Wnormalized=id" } */
 
 \u00AA
 \u00B7
diff -rupN GCC.orig/gcc/testsuite/g++.dg/cpp/ucnid-1.C GCC/gcc/testsuite/g++.dg/cpp/ucnid-1.C
--- GCC.orig/gcc/testsuite/g++.dg/cpp/ucnid-1.C	2005-03-15 00:36:27.000000000 +0000
+++ GCC/gcc/testsuite/g++.dg/cpp/ucnid-1.C	2005-09-15 23:25:26.000000000 +0000
@@ -1,5 +1,5 @@
 /* { dg-do preprocess } */
-/* { dg-options "-pedantic" } */
+/* { dg-options "-pedantic -fextended-identifiers" } */
 
 \u00AA /* { dg-error "not valid in an identifier" } */
 \u00AB /* { dg-error "not valid in an identifier" } */
diff -rupN GCC.orig/gcc/testsuite/g++.dg/other/ucnid-1.C GCC/gcc/testsuite/g++.dg/other/ucnid-1.C
--- GCC.orig/gcc/testsuite/g++.dg/other/ucnid-1.C	2005-06-30 09:22:16.000000000 +0000
+++ GCC/gcc/testsuite/g++.dg/other/ucnid-1.C	2005-09-15 23:25:17.000000000 +0000
@@ -1,4 +1,5 @@
 /* { dg-do run } */
+/* { dg-options "-fextended-identifiers" } */
 /* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "*" } { "" } } */
 #include <cstdlib>
 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/normalize-1.c GCC/gcc/testsuite/gcc.dg/cpp/normalize-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/normalize-1.c	2005-03-15 00:36:30.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/normalize-1.c	2005-09-16 01:17:30.000000000 +0000
@@ -1,5 +1,5 @@
 /* { dg-do preprocess } */
-/* { dg-options "-std=c99" } */
+/* { dg-options "-std=c99 -fextended-identifiers" } */
 
 \u00AA
 \u00B7
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/normalize-2.c GCC/gcc/testsuite/gcc.dg/cpp/normalize-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/normalize-2.c	2005-03-15 00:36:30.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/normalize-2.c	2005-09-16 01:17:35.000000000 +0000
@@ -1,5 +1,5 @@
 /* { dg-do preprocess } */
-/* { dg-options "-std=c99 -Wnormalized=nfkc" } */
+/* { dg-options "-std=c99 -fextended-identifiers -Wnormalized=nfkc" } */
 
 \u00AA  /* { dg-warning "not in NFKC" } */
 \u00B7
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/normalize-3.c GCC/gcc/testsuite/gcc.dg/cpp/normalize-3.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/normalize-3.c	2005-03-15 00:36:30.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/normalize-3.c	2005-09-16 01:17:40.000000000 +0000
@@ -1,5 +1,5 @@
 /* { dg-do preprocess } */
-/* { dg-options "-std=c99 -Wnormalized=id" } */
+/* { dg-options "-std=c99 -fextended-identifiers -Wnormalized=id" } */
 
 \u00AA
 \u00B7
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/normalize-4.c GCC/gcc/testsuite/gcc.dg/cpp/normalize-4.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/normalize-4.c	2005-03-15 00:36:30.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/normalize-4.c	2005-09-16 01:17:47.000000000 +0000
@@ -1,5 +1,5 @@
 /* { dg-do preprocess } */
-/* { dg-options "-std=c99 -Wnormalized=none" } */
+/* { dg-options "-std=c99 -fextended-identifiers -Wnormalized=none" } */
 
 \u00AA
 \u00B7
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/ucnid-1.c GCC/gcc/testsuite/gcc.dg/cpp/ucnid-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/ucnid-1.c	2005-03-12 10:44:06.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/ucnid-1.c	2005-09-15 23:23:43.000000000 +0000
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-std=c99" } */
+/* { dg-options "-std=c99 -fextended-identifiers" } */
 void abort (void);
 
 #define \u00C0 1
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/ucnid-2.c GCC/gcc/testsuite/gcc.dg/cpp/ucnid-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/ucnid-2.c	2005-03-12 10:44:06.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/ucnid-2.c	2005-09-15 23:23:48.000000000 +0000
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-std=c99" } */
+/* { dg-options "-std=c99 -fextended-identifiers" } */
 #include <stdlib.h>
 #include <string.h>
 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/ucnid-3.c GCC/gcc/testsuite/gcc.dg/cpp/ucnid-3.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/ucnid-3.c	2005-03-12 10:44:06.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/ucnid-3.c	2005-09-15 23:23:52.000000000 +0000
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-std=c99" } */
+/* { dg-options "-std=c99 -fextended-identifiers" } */
 
 #define paste(x, y) x ## y
 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/ucnid-4.c GCC/gcc/testsuite/gcc.dg/cpp/ucnid-4.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/ucnid-4.c	2005-03-15 00:36:30.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/ucnid-4.c	2005-09-15 23:23:57.000000000 +0000
@@ -1,5 +1,5 @@
 /* { dg-do preprocess } */
-/* { dg-options "-std=c99" } */
+/* { dg-options "-std=c99 -fextended-identifiers" } */
 
 \u00AA
 \u00AB /* { dg-error "not valid in an identifier" } */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/ucnid-5.c GCC/gcc/testsuite/gcc.dg/cpp/ucnid-5.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/ucnid-5.c	2005-03-15 00:36:30.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/ucnid-5.c	2005-09-15 23:24:03.000000000 +0000
@@ -1,5 +1,5 @@
 /* { dg-do preprocess } */
-/* { dg-options "-std=c99 -pedantic" } */
+/* { dg-options "-std=c99 -pedantic -fextended-identifiers" } */
 
 \u00AA
 \u00AB /* { dg-error "not valid in an identifier" } */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/ucnid-7.c GCC/gcc/testsuite/gcc.dg/cpp/ucnid-7.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/ucnid-7.c	2005-03-16 00:59:31.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/ucnid-7.c	2005-09-15 23:24:16.000000000 +0000
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-std=c99" } */
+/* { dg-options "-std=c99 -fextended-identifiers" } */
 #define a b(
 #define b(x) q
 int a\U0000000z );
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/ucnid-8.c GCC/gcc/testsuite/gcc.dg/cpp/ucnid-8.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/ucnid-8.c	1970-01-01 00:00:00.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/ucnid-8.c	2005-09-15 23:26:36.000000000 +0000
@@ -0,0 +1,8 @@
+/* { 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 -rupN GCC.orig/gcc/testsuite/gcc.dg/ucnid-1.c GCC/gcc/testsuite/gcc.dg/ucnid-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/ucnid-1.c	2005-03-12 10:44:05.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/ucnid-1.c	2005-09-15 23:24:29.000000000 +0000
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-std=c99" } */
+/* { dg-options "-std=c99 -fextended-identifiers" } */
 void abort (void);
 
 int main (void)
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/ucnid-2.c GCC/gcc/testsuite/gcc.dg/ucnid-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/ucnid-2.c	2005-04-13 21:20:26.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/ucnid-2.c	2005-09-15 23:24:33.000000000 +0000
@@ -1,6 +1,6 @@
 /* { dg-do run } */
 /* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "*" } { "" } } */
-/* { dg-options "-std=c99" } */
+/* { dg-options "-std=c99 -fextended-identifiers" } */
 void abort (void);
 
 static int \u00C0 = 1;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/ucnid-3.c GCC/gcc/testsuite/gcc.dg/ucnid-3.c
--- GCC.orig/gcc/testsuite/gcc.dg/ucnid-3.c	2005-04-13 21:20:26.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/ucnid-3.c	2005-09-15 23:24:38.000000000 +0000
@@ -1,6 +1,6 @@
 /* { dg-do run } */
 /* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "*" } { "" } } */
-/* { dg-options "-std=c99" } */
+/* { dg-options "-std=c99 -fextended-identifiers" } */
 void abort (void);
 
 int \u00C0 = 1;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/ucnid-4.c GCC/gcc/testsuite/gcc.dg/ucnid-4.c
--- GCC.orig/gcc/testsuite/gcc.dg/ucnid-4.c	2005-04-13 21:20:27.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/ucnid-4.c	2005-09-15 23:24:42.000000000 +0000
@@ -1,6 +1,6 @@
 /* { dg-do run */
 /* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "*" } { "" } } */
-/* { dg-options "-std=c99" } */
+/* { dg-options "-std=c99 -fextended-identifiers" } */
 void abort (void);
 
 int \u00C0(void) { return 1; }
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/ucnid-5.c GCC/gcc/testsuite/gcc.dg/ucnid-5.c
--- GCC.orig/gcc/testsuite/gcc.dg/ucnid-5.c	2005-04-13 21:20:27.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/ucnid-5.c	2005-09-15 23:24:48.000000000 +0000
@@ -1,6 +1,6 @@
 /* { dg-do run } */
 /* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "*" } { "" } } */
-/* { dg-options "-std=c99 -fdollars-in-identifiers" } */
+/* { dg-options "-std=c99 -fdollars-in-identifiers -fextended-identifiers" } */
 void abort (void);
 
 int a$b(void) { return 1; }
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/ucnid-6.c GCC/gcc/testsuite/gcc.dg/ucnid-6.c
--- GCC.orig/gcc/testsuite/gcc.dg/ucnid-6.c	2005-09-14 14:09:40.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/ucnid-6.c	2005-09-15 23:24:54.000000000 +0000
@@ -1,6 +1,6 @@
 /* { dg-do run */
 /* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "*" } { "" } } */
-/* { dg-options "-std=c99 -save-temps" } */
+/* { dg-options "-std=c99 -fextended-identifiers -save-temps" } */
 void abort (void);
 
 int \u00C0(void) { return 1; }
diff -rupN GCC.orig/libcpp/include/cpplib.h GCC/libcpp/include/cpplib.h
--- GCC.orig/libcpp/include/cpplib.h	2005-06-29 09:44:46.000000000 +0000
+++ GCC/libcpp/include/cpplib.h	2005-09-15 23:19:20.000000000 +0000
@@ -345,6 +345,9 @@ struct cpp_options
   /* Zero means dollar signs are punctuation.  */
   unsigned char dollars_in_ident;
 
+  /* Nonzero means UCNs are accepted in identifiers.  */
+  unsigned char extended_identifiers;
+
   /* True if we should warn about dollars in identifiers or numbers
      for this translation unit.  */
   unsigned char warn_dollars;
diff -rupN GCC.orig/libcpp/init.c GCC/libcpp/init.c
--- GCC.orig/libcpp/init.c	2005-06-29 09:44:46.000000000 +0000
+++ GCC/libcpp/init.c	2005-09-15 23:22:51.000000000 +0000
@@ -72,21 +72,26 @@ struct lang_flags
   char c99;
   char cplusplus;
   char extended_numbers;
+  char extended_identifiers;
   char std;
   char cplusplus_comments;
   char digraphs;
 };
 
 static const struct lang_flags lang_defaults[] =
-{ /*              c99 c++ xnum std  //   digr  */
-  /* GNUC89 */  { 0,  0,  1,   0,   1,   1     },
-  /* GNUC99 */  { 1,  0,  1,   0,   1,   1     },
-  /* STDC89 */  { 0,  0,  0,   1,   0,   0     },
-  /* STDC94 */  { 0,  0,  0,   1,   0,   1     },
-  /* STDC99 */  { 1,  0,  1,   1,   1,   1     },
-  /* GNUCXX */  { 0,  1,  1,   0,   1,   1     },
-  /* CXX98  */  { 0,  1,  1,   1,   1,   1     },
-  /* ASM    */  { 0,  0,  1,   0,   1,   0     }
+{ /*              c99 c++ xnum xid std  //   digr  */
+  /* GNUC89 */  { 0,  0,  1,   0,  0,   1,   1     },
+  /* GNUC99 */  { 1,  0,  1,   0,  0,   1,   1     },
+  /* STDC89 */  { 0,  0,  0,   0,  1,   0,   0     },
+  /* STDC94 */  { 0,  0,  0,   0,  1,   0,   1     },
+  /* STDC99 */  { 1,  0,  1,   0,  1,   1,   1     },
+  /* GNUCXX */  { 0,  1,  1,   0,  0,   1,   1     },
+  /* CXX98  */  { 0,  1,  1,   0,  1,   1,   1     },
+  /* ASM    */  { 0,  0,  1,   0,  0,   1,   0     }
+  /* xid should be 1 for GNUC99, STDC99, GNUCXX and CXX98 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.  */
@@ -97,13 +102,14 @@ cpp_set_lang (cpp_reader *pfile, enum c_
 
   CPP_OPTION (pfile, lang) = lang;
 
-  CPP_OPTION (pfile, c99)		 = l->c99;
-  CPP_OPTION (pfile, cplusplus)		 = l->cplusplus;
-  CPP_OPTION (pfile, extended_numbers)	 = l->extended_numbers;
-  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, c99)			 = l->c99;
+  CPP_OPTION (pfile, cplusplus)			 = l->cplusplus;
+  CPP_OPTION (pfile, extended_numbers)		 = l->extended_numbers;
+  CPP_OPTION (pfile, extended_identifiers)	 = l->extended_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;
 }
 
 /* Initialize library global state.  */
diff -rupN GCC.orig/libcpp/lex.c GCC/libcpp/lex.c
--- GCC.orig/libcpp/lex.c	2005-06-29 09:44:46.000000000 +0000
+++ GCC/libcpp/lex.c	2005-09-15 23:20:00.000000000 +0000
@@ -476,7 +476,7 @@ forms_identifier_p (cpp_reader *pfile, i
     }
 
   /* Is this a syntactically valid UCN?  */
-  if ((CPP_OPTION (pfile, cplusplus) || CPP_OPTION (pfile, c99))
+  if (CPP_OPTION (pfile, extended_identifiers)
       && *buffer->cur == '\\'
       && (buffer->cur[1] == 'u' || buffer->cur[1] == 'U'))
     {

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]