aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppinit.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2003-05-17 20:29:34 +0000
committerNeil Booth <neil@gcc.gnu.org>2003-05-17 20:29:34 +0000
commitb1822ccc44ac015fac2558ca151fa6154bd66880 (patch)
treecc833b5eaad739137055c876d152a481427bc136 /gcc/cppinit.c
parenta69e127ba7e8e92dee6620fd692672955247b51b (diff)
downloadgcc-b1822ccc44ac015fac2558ca151fa6154bd66880.zip
gcc-b1822ccc44ac015fac2558ca151fa6154bd66880.tar.gz
gcc-b1822ccc44ac015fac2558ca151fa6154bd66880.tar.bz2
c-common.c, c-common.h (dollars_in_ident): Remove.
* c-common.c, c-common.h (dollars_in_ident): Remove. * c-opts.c (DOLLARS_IN_IDENTIFIERS): Default to true. (c_common_init_options, c_common_decode_option): Set dollars_in_ident. * cpphash.h (warned_dollar): Rename warn_dollars. * cppinit.c (struct lang_flags, lang_defaults, cpp_set_lang) Permit dollars regardless of -std=. (post_options): Set warn_dollars. * cpplex.c (forms_identifier_p): Use warn_dollars. * config/darwin.h, config/alpha/vms.h, config/m68hc11/m68hc11.h: Remove redundant definitions of DOLLARS_IN_IDENTIFIERS. * doc/cpp.texi, doc/cppopts.texi, doc/invoke.texi, doc/tm.texi: Update documentation. testsuite: * gcc.dg/dollar.c: New test. From-SVN: r66911
Diffstat (limited to 'gcc/cppinit.c')
-rw-r--r--gcc/cppinit.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index cdcac25..d6e7ae4 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -73,22 +73,20 @@ struct lang_flags
char cplusplus;
char extended_numbers;
char std;
- char dollars_in_ident;
char cplusplus_comments;
char digraphs;
};
-/* ??? Enable $ in identifiers in assembly? */
static const struct lang_flags lang_defaults[] =
-{ /* c99 c++ xnum std dollar c++comm digr */
- /* GNUC89 */ { 0, 0, 1, 0, 1, 1, 1 },
- /* GNUC99 */ { 1, 0, 1, 0, 1, 1, 1 },
- /* STDC89 */ { 0, 0, 0, 1, 0, 0, 0 },
- /* STDC94 */ { 0, 0, 0, 1, 0, 0, 1 },
- /* STDC99 */ { 1, 0, 1, 1, 0, 1, 1 },
- /* GNUCXX */ { 0, 1, 1, 0, 1, 1, 1 },
- /* CXX98 */ { 0, 1, 1, 1, 0, 1, 1 },
- /* ASM */ { 0, 0, 1, 0, 0, 1, 0 }
+{ /* 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 }
};
/* Sets internal flags correctly for a given language. */
@@ -106,7 +104,6 @@ cpp_set_lang (pfile, lang)
CPP_OPTION (pfile, extended_numbers) = l->extended_numbers;
CPP_OPTION (pfile, std) = l->std;
CPP_OPTION (pfile, trigraphs) = l->std;
- CPP_OPTION (pfile, dollars_in_ident) = l->dollars_in_ident;
CPP_OPTION (pfile, cplusplus_comments) = l->cplusplus_comments;
CPP_OPTION (pfile, digraphs) = l->digraphs;
}
@@ -153,6 +150,7 @@ cpp_create_reader (lang, table)
CPP_OPTION (pfile, warn_endif_labels) = 1;
CPP_OPTION (pfile, warn_deprecated) = 1;
CPP_OPTION (pfile, warn_long_long) = !CPP_OPTION (pfile, c99);
+ CPP_OPTION (pfile, dollars_in_ident) = 1;
/* Default CPP arithmetic to something sensible for the host for the
benefit of dumb users like fix-header. */
@@ -572,4 +570,11 @@ post_options (pfile)
CPP_OPTION (pfile, trigraphs) = 0;
CPP_OPTION (pfile, warn_trigraphs) = 0;
}
+
+ /* C99 permits implementation-defined characters in identifiers.
+ The documented meaning of -std= is to turn off extensions that
+ conflict with the specified standard, and since a strictly
+ conforming program cannot contain a '$', we do not condition
+ their acceptance on the -std= setting. */
+ pfile->warn_dollars = CPP_PEDANTIC (pfile) && !CPP_OPTION (pfile, c99);
}