diff options
author | Joseph Myers <joseph@codesourcery.com> | 2005-09-20 21:31:37 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2005-09-20 21:31:37 +0100 |
commit | af15a2fed76b5da2faf0c2ee9e052923c7562e8f (patch) | |
tree | 00694b7f29cada5340d6da00c4838abdd73404a6 /libcpp | |
parent | 6fff2603132ecacd4e5cdd97ea92ab5443de613f (diff) | |
download | gcc-af15a2fed76b5da2faf0c2ee9e052923c7562e8f.zip gcc-af15a2fed76b5da2faf0c2ee9e052923c7562e8f.tar.gz gcc-af15a2fed76b5da2faf0c2ee9e052923c7562e8f.tar.bz2 |
c.opt (fextended-identifiers): New.
gcc:
* 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:
* 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:
* 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.
From-SVN: r104462
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 8 | ||||
-rw-r--r-- | libcpp/include/cpplib.h | 3 | ||||
-rw-r--r-- | libcpp/init.c | 38 | ||||
-rw-r--r-- | libcpp/lex.c | 2 |
4 files changed, 34 insertions, 17 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 1b62fcc..faf6b93 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,11 @@ +2005-09-20 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. + 2005-08-30 Jakub Jelinek <jakub@redhat.com> PR preprocessor/20348 diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index ef42d04..c84f624 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -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 --git a/libcpp/init.c b/libcpp/init.c index 515e254..8d564c9 100644 --- a/libcpp/init.c +++ b/libcpp/init.c @@ -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_lang lang) 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 --git a/libcpp/lex.c b/libcpp/lex.c index ee38a55..0313161 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -476,7 +476,7 @@ forms_identifier_p (cpp_reader *pfile, int first, } /* 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')) { |