+1997-09-29 Paul Eggert <eggert@twinsun.com>
+
+ * lex.c (real_yylex): Treat `$' just like `_', except issue a
+ diagnostic if !dollars_in_ident or if pedantic.
+
+ * lang-specs.h (@c++): -ansi no longer implies -$.
+
+ * decl2.c (lang_decode_option):
+ -traditional and -ansi now do not mess with
+ dollars_in_ident.
+
Mon Sep 29 19:57:51 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
* Makefile.in (parse.o, decl.o): Also depend on
int warn_old_style_cast;
-/* Nonzero means `$' can be in an identifier.
- See cccp.c for reasons why this breaks some obscure ANSI C programs. */
+/* Nonzero means `$' can be in an identifier. */
#ifndef DOLLARS_IN_IDENTIFIERS
#define DOLLARS_IN_IDENTIFIERS 1
char *p;
{
if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional"))
- dollars_in_ident = 1, flag_writable_strings = 1,
+ flag_writable_strings = 1,
flag_this_is_variable = 1, flag_new_for_scope = 0;
/* The +e options are for cfront compatibility. They come in as
`-+eN', to kludge around gcc.c's argument handling. */
else return 0;
}
else if (!strcmp (p, "-ansi"))
- dollars_in_ident = 0, flag_no_nonansi_builtin = 1, flag_ansi = 1,
+ flag_no_nonansi_builtin = 1, flag_ansi = 1,
flag_no_gnu_keywords = 1, flag_operator_names = 1;
#ifdef SPEW_DEBUG
/* Undocumented, only ever used when you're invoking cc1plus by hand, since
%{C:%{!E:%eGNU C++ does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
-undef -D__GNUC__=%v1 -D__GNUG__=%v1 -D__cplusplus -D__GNUC_MINOR__=%v2\
- %{ansi:-trigraphs -$ -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\
+ %{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\
%{!fno-exceptions:-D__EXCEPTIONS}\
%c %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
break;
case '$':
- if (dollars_in_ident)
- {
- dollar_seen = 1;
- goto letter;
- }
- value = '$';
- goto done;
+ if (! dollars_in_ident)
+ error ("`$' in identifier");
+ else if (pedantic)
+ pedwarn ("`$' in identifier");
+ dollar_seen = 1;
+ goto letter;
case 'L':
/* Capital L may start a wide-string or wide-character constant. */
input sources. */
while (isalnum (c) || (c == '_') || c == '$')
{
- if (c == '$' && ! dollars_in_ident)
- break;
+ if (c == '$')
+ {
+ if (! dollars_in_ident)
+ error ("`$' in identifier");
+ else if (pedantic)
+ pedwarn ("`$' in identifier");
+ }
+
if (p >= token_buffer + maxtoken)
p = extend_token_buffer (p);
while (isalnum (c) || (c == '_') || c == '$')
{
- if (c == '$' && ! dollars_in_ident)
- break;
+ if (c == '$')
+ {
+ if (! dollars_in_ident)
+ error ("`$' in identifier");
+ else if (pedantic)
+ pedwarn ("`$' in identifier");
+ }
+
if (p >= token_buffer + maxtoken)
p = extend_token_buffer (p);