summaryrefslogtreecommitdiff
path: root/gcc/c-lex.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1996-10-09 20:19:12 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1996-10-09 20:19:12 +0000
commit23d42a4b85e7fed42ffcb3f41962197ab73db92f (patch)
tree6c564514ca465425ae9ef5f1c09d29f573ecdf85 /gcc/c-lex.c
parenteef780a02bca5f8a83b1fc92e66183ed86a6a325 (diff)
downloadgcc-23d42a4b85e7fed42ffcb3f41962197ab73db92f.tar.gz
(yylex): Treat `$' just like `_', except issue a diagnostic if
!dollars_in_ident or if pedantic. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@12927 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r--gcc/c-lex.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index d8e9e80da40..2bf91532a58 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -986,11 +986,6 @@ yylex ()
value = ENDFILE;
break;
- case '$':
- if (dollars_in_ident)
- goto letter;
- return '$';
-
case 'L':
/* Capital L may start a wide-string or wide-character constant. */
{
@@ -1041,6 +1036,7 @@ yylex ()
case 'u': case 'v': case 'w': case 'x': case 'y':
case 'z':
case '_':
+ case '$':
letter:
p = token_buffer;
while (isalnum (c) || c == '_' || c == '$' || c == '@')
@@ -1048,8 +1044,13 @@ yylex ()
/* Make sure this char really belongs in an identifier. */
if (c == '@' && ! doing_objc_thang)
break;
- 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);
@@ -1658,7 +1659,7 @@ yylex ()
ungetc (c, finput);
*p = 0;
- if (isalnum (c) || c == '.' || c == '_'
+ if (isalnum (c) || c == '.' || c == '_' || c == '$'
|| (!flag_traditional && (c == '-' || c == '+')
&& (p[-1] == 'e' || p[-1] == 'E')))
error ("missing white space after number `%s'", token_buffer);