This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFA: Get rid of CPP_BACKSLASH
- To: gcc-patches at gcc dot gnu dot org
- Subject: RFA: Get rid of CPP_BACKSLASH
- From: Neil Booth <NeilB at earthling dot net>
- Date: Tue, 31 Oct 2000 20:08:55 +0000
A small cleanup; with the lexer rewrite of a month ago there is no
need for a separate backslash token.
This touches a couple of non-cpplib files; OK to commit?
Neil.
* c-parse.in (_yylex): Remove CPP_BACKSLASH case.
* cp/spew.c: Similarly.
* cpplex.c (_cpp_lex_token): Backslashes are now CPP_OTHER.
* cppmacro.c (stringify_arg): Similarly.
* cpplib.h (CPP_BACKSLASH): Delete.
Index: c-parse.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-parse.in,v
retrieving revision 1.60
diff -u -p -r1.60 c-parse.in
--- c-parse.in 2000/09/17 07:38:10 1.60
+++ c-parse.in 2000/10/31 20:04:44
@@ -3259,7 +3259,6 @@ _yylex ()
/* These tokens should not survive translation phase 4. */
case CPP_HASH:
case CPP_PASTE:
- case CPP_BACKSLASH:
error ("syntax error before '%s' token", NAME(last_token));
goto retry;
Index: cpplex.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpplex.c,v
retrieving revision 1.109
diff -u -p -r1.109 cpplex.c
--- cpplex.c 2000/10/30 22:28:59 1.109
+++ cpplex.c 2000/10/31 20:04:48
@@ -931,7 +931,7 @@ _cpp_lex_token (pfile, result)
result->type = CPP_QUERY;
buffer->read_ahead = EOF;
if (c == '\\')
- result->type = CPP_BACKSLASH;
+ goto random_char;
else if (c != '?')
goto do_switch;
}
Index: cpplib.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpplib.h,v
retrieving revision 1.129
diff -u -p -r1.129 cpplib.h
--- cpplib.h 2000/10/30 22:29:00 1.129
+++ cpplib.h 2000/10/31 20:04:54
@@ -116,7 +116,6 @@ struct htab;
/* The remainder of the punctuation. Order is not significant. */ \
OP(CPP_SEMICOLON, ";") /* structure */ \
OP(CPP_ELLIPSIS, "...") \
- OP(CPP_BACKSLASH, "\\") \
OP(CPP_PLUS_PLUS, "++") /* increment */ \
OP(CPP_MINUS_MINUS, "--") \
OP(CPP_DEREF, "->") /* accessors */ \
Index: cppmacro.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cppmacro.c,v
retrieving revision 1.17
diff -u -p -r1.17 cppmacro.c
--- cppmacro.c 2000/10/31 19:59:42 1.17
+++ cppmacro.c 2000/10/31 20:04:57
@@ -386,7 +386,7 @@ stringify_arg (pfile, arg)
dest = cpp_spell_token (pfile, token, dest);
total_len = dest - start;
- if (token->type == CPP_BACKSLASH)
+ if (token->type == CPP_OTHER && token->val.aux == '\\')
backslash_count++;
else
backslash_count = 0;
Index: cp/spew.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/spew.c,v
retrieving revision 1.34
diff -u -p -r1.34 spew.c
--- spew.c 2000/10/18 02:19:56 1.34
+++ spew.c 2000/10/31 20:05:06
@@ -361,10 +361,6 @@ read_token (t)
error ("syntax error before '#' token");
goto retry;
- case CPP_BACKSLASH:
- error ("syntax error before '\\' token");
- goto retry;
-
default:
abort ();
}