diff options
author | Hans-Peter Nilsson <hp@axis.com> | 2003-06-12 06:09:15 +0000 |
---|---|---|
committer | Hans-Peter Nilsson <hp@gcc.gnu.org> | 2003-06-12 06:09:15 +0000 |
commit | 78b8811a387bd5f91d4b0a70fdd63e043ffa4bf9 (patch) | |
tree | 0ab8d16523fbcbfca756131fa06162d509f6269a /gcc/c-opts.c | |
parent | ed44683592f6503ce41f466aa075aa146235ca11 (diff) | |
download | gcc-78b8811a387bd5f91d4b0a70fdd63e043ffa4bf9.zip gcc-78b8811a387bd5f91d4b0a70fdd63e043ffa4bf9.tar.gz gcc-78b8811a387bd5f91d4b0a70fdd63e043ffa4bf9.tar.bz2 |
Don't warn on dollars in builtin macro definitions,
e.g. __REGISTER_PREFIX__.
* cpphash.h (struct cpp_reader): Move member warn_dollars...
* cpplib.h (struct cpp_options): ...to here. Change type to
unsigned char.
* cppinit.c (cpp_create_reader): Set it to 1 here.
(post_options): Don't set it here.
* c-opts.c (c_common_init_options): Reset it to 0 here.
(finish_options): Set it here.
* cpplex.c (forms_identifier_p): Tweak for new location of
warn_dollars.
From-SVN: r67824
Diffstat (limited to 'gcc/c-opts.c')
-rw-r--r-- | gcc/c-opts.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/c-opts.c b/gcc/c-opts.c index 43057ab..6f449a0 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -225,6 +225,11 @@ c_common_init_options (lang) ident_hash); cpp_opts = cpp_get_options (parse_in); cpp_opts->dollars_in_ident = DOLLARS_IN_IDENTIFIERS; + + /* Reset to avoid warnings on internal definitions. We set it just + before passing on command-line options to cpplib. */ + cpp_opts->warn_dollars = 0; + if (flag_objc) cpp_opts->objc = 1; @@ -1356,6 +1361,18 @@ finish_options () cpp_change_file (parse_in, LC_RENAME, _("<built-in>")); cpp_init_builtins (parse_in, flag_hosted); c_cpp_builtins (parse_in); + + /* We're about to send user input to cpplib, so make it warn for + things that we previously (when we sent it internal definitions) + told it to not warn. + + 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. */ + cpp_opts->warn_dollars = (cpp_opts->pedantic && !cpp_opts->c99); + cpp_change_file (parse_in, LC_RENAME, _("<command line>")); for (i = 0; i < deferred_count; i++) { |