This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Remove more legacy baggage
- From: Neil Booth <neil at daikokuya dot co dot uk>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 26 Jul 2002 17:20:16 +0100
- Subject: Remove more legacy baggage
Integrating cppilb/C/C++ switch handling looks to be a bigger job
than I originally thought, but it's well worthwhile so I'm going
to go ahead anyway.
This is a preliminary step: removing handling of operator names
that cpplib has been doing for a long time.
I've bootstrapped, regtested and am about to commit this.
Neil.
* c-common.h (RID_AND, RID_AND_EQ, RID_NOT, RID_NOT_EQ,
RID_OR, RID_OR_EQ, RID_XOR, RID_XOR_EQ, RID_BITAND, RID_BITOR,
RID_COMPL): Remove.
* c-parse.in (rid_to_yy): Similarly.
cp:
* cp-tree.h (flag_operator_names): Remove.
* decl2.c (flag_operator_names): Remove.
(lang_f_options): Remove operator-names.
* lex.c (D_OPNAME): Remove.
(reswords): Remove operator names.
(rid_to_yy): Remove operator names.
(init_reswords): No need to handle D_OPNAME.
* cp/spew.c (read_process_identifier): There are no operator
names.
============================================================
Index: gcc/c-common.h
--- gcc/c-common.h 26 Jul 2002 13:45:33 -0000 1.145
+++ gcc/c-common.h 26 Jul 2002 16:16:15 -0000
@@ -93,11 +93,6 @@ enum rid
/* casts */
RID_CONSTCAST, RID_DYNCAST, RID_REINTCAST, RID_STATCAST,
- /* alternate spellings */
- RID_AND, RID_AND_EQ, RID_NOT, RID_NOT_EQ,
- RID_OR, RID_OR_EQ, RID_XOR, RID_XOR_EQ,
- RID_BITAND, RID_BITOR, RID_COMPL,
-
/* Objective C */
RID_ID, RID_AT_ENCODE, RID_AT_END,
RID_AT_CLASS, RID_AT_ALIAS, RID_AT_DEFS,
============================================================
Index: gcc/c-parse.in
--- gcc/c-parse.in 16 Jul 2002 02:16:31 -0000 1.149
+++ gcc/c-parse.in 26 Jul 2002 16:16:15 -0000
@@ -3522,19 +3522,6 @@ static const short rid_to_yy[RID_MAX] =
/* RID_REINTCAST */ 0,
/* RID_STATCAST */ 0,
- /* alternate spellings */
- /* RID_AND */ 0,
- /* RID_AND_EQ */ 0,
- /* RID_NOT */ 0,
- /* RID_NOT_EQ */ 0,
- /* RID_OR */ 0,
- /* RID_OR_EQ */ 0,
- /* RID_XOR */ 0,
- /* RID_XOR_EQ */ 0,
- /* RID_BITAND */ 0,
- /* RID_BITOR */ 0,
- /* RID_COMPL */ 0,
-
/* Objective C */
/* RID_ID */ OBJECTNAME,
/* RID_AT_ENCODE */ ENCODE,
============================================================
Index: gcc/cp/cp-tree.h
--- gcc/cp/cp-tree.h 25 Jul 2002 08:58:05 -0000 1.733
+++ gcc/cp/cp-tree.h 26 Jul 2002 16:16:17 -0000
@@ -945,10 +945,6 @@ extern int flag_no_asm;
extern int flag_no_gnu_keywords;
-/* Nonzero means recognize the named operators from C++98. */
-
-extern int flag_operator_names;
-
/* For environments where you can use GNU binutils (as, ld in particular). */
extern int flag_gnu_binutils;
============================================================
Index: gcc/cp/decl2.c
--- gcc/cp/decl2.c 25 Jul 2002 08:58:06 -0000 1.549
+++ gcc/cp/decl2.c 26 Jul 2002 16:16:18 -0000
@@ -331,10 +331,6 @@ int flag_conserve_space;
int flag_access_control = 1;
-/* Nonzero if we want to understand the operator names, i.e. 'bitand'. */
-
-int flag_operator_names = 1;
-
/* Nonzero if we want to check the return value of new and avoid calling
constructors if it is a null pointer. */
@@ -420,7 +416,6 @@ lang_f_options[] =
{"implicit-templates", &flag_implicit_templates, 1},
{"ms-extensions", &flag_ms_extensions, 1},
{"nonansi-builtins", &flag_no_nonansi_builtin, 0},
- {"operator-names", &flag_operator_names, 1},
{"optional-diags", &flag_optional_diags, 1},
{"permissive", &flag_permissive, 1},
{"repo", &flag_use_repository, 1},
============================================================
Index: gcc/cp/lex.c
--- gcc/cp/lex.c 10 Jul 2002 18:16:23 -0000 1.287
+++ gcc/cp/lex.c 26 Jul 2002 16:16:19 -0000
@@ -328,7 +328,6 @@ struct resword
_true_. */
#define D_EXT 0x01 /* GCC extension */
#define D_ASM 0x02 /* in C99, but has a switch to turn it off */
-#define D_OPNAME 0x04 /* operator names */
CONSTRAINT(ridbits_fit, RID_LAST_MODIFIER < sizeof(unsigned long) * CHAR_BIT);
@@ -368,18 +367,13 @@ static const struct resword reswords[] =
{ "__volatile", RID_VOLATILE, 0 },
{ "__volatile__", RID_VOLATILE, 0 },
{ "asm", RID_ASM, D_ASM },
- { "and", RID_AND, D_OPNAME },
- { "and_eq", RID_AND_EQ, D_OPNAME },
{ "auto", RID_AUTO, 0 },
- { "bitand", RID_BITAND, D_OPNAME },
- { "bitor", RID_BITOR, D_OPNAME },
{ "bool", RID_BOOL, 0 },
{ "break", RID_BREAK, 0 },
{ "case", RID_CASE, 0 },
{ "catch", RID_CATCH, 0 },
{ "char", RID_CHAR, 0 },
{ "class", RID_CLASS, 0 },
- { "compl", RID_COMPL, D_OPNAME },
{ "const", RID_CONST, 0 },
{ "const_cast", RID_CONSTCAST, 0 },
{ "continue", RID_CONTINUE, 0 },
@@ -405,11 +399,7 @@ static const struct resword reswords[] =
{ "mutable", RID_MUTABLE, 0 },
{ "namespace", RID_NAMESPACE, 0 },
{ "new", RID_NEW, 0 },
- { "not", RID_NOT, D_OPNAME },
- { "not_eq", RID_NOT_EQ, D_OPNAME },
{ "operator", RID_OPERATOR, 0 },
- { "or", RID_OR, D_OPNAME },
- { "or_eq", RID_OR_EQ, D_OPNAME },
{ "private", RID_PRIVATE, 0 },
{ "protected", RID_PROTECTED, 0 },
{ "public", RID_PUBLIC, 0 },
@@ -440,8 +430,6 @@ static const struct resword reswords[] =
{ "volatile", RID_VOLATILE, 0 },
{ "wchar_t", RID_WCHAR, 0 },
{ "while", RID_WHILE, 0 },
- { "xor", RID_XOR, D_OPNAME },
- { "xor_eq", RID_XOR_EQ, D_OPNAME },
};
@@ -557,19 +545,6 @@ const short rid_to_yy[RID_MAX] =
/* RID_REINTCAST */ REINTERPRET_CAST,
/* RID_STATCAST */ STATIC_CAST,
- /* alternate spellings */
- /* RID_AND */ ANDAND,
- /* RID_AND_EQ */ ASSIGN,
- /* RID_NOT */ '!',
- /* RID_NOT_EQ */ EQCOMPARE,
- /* RID_OR */ OROR,
- /* RID_OR_EQ */ ASSIGN,
- /* RID_XOR */ '^',
- /* RID_XOR_EQ */ ASSIGN,
- /* RID_BITAND */ '&',
- /* RID_BITOR */ '|',
- /* RID_COMPL */ '~',
-
/* Objective C */
/* RID_ID */ 0,
/* RID_AT_ENCODE */ 0,
@@ -591,8 +566,7 @@ init_reswords ()
{
unsigned int i;
tree id;
- int mask = ((flag_operator_names ? 0 : D_OPNAME)
- | (flag_no_asm ? D_ASM : 0)
+ int mask = ((flag_no_asm ? D_ASM : 0)
| (flag_no_gnu_keywords ? D_EXT : 0));
/* It is not necessary to register ridpointers as a GC root, because
============================================================
Index: gcc/cp/spew.c
--- gcc/cp/spew.c 20 Jul 2002 12:45:45 -0000 1.68
+++ gcc/cp/spew.c 26 Jul 2002 16:16:19 -0000
@@ -207,23 +207,8 @@ read_process_identifier (pyylval)
if (C_IS_RESERVED_WORD (id))
{
- /* Possibly replace the IDENTIFIER_NODE with a magic cookie.
- Can't put yylval.code numbers in ridpointers[]. Bleah. */
-
- switch (C_RID_CODE (id))
- {
- case RID_BITAND: pyylval->code = BIT_AND_EXPR; return '&';
- case RID_AND_EQ: pyylval->code = BIT_AND_EXPR; return ASSIGN;
- case RID_BITOR: pyylval->code = BIT_IOR_EXPR; return '|';
- case RID_OR_EQ: pyylval->code = BIT_IOR_EXPR; return ASSIGN;
- case RID_XOR: pyylval->code = BIT_XOR_EXPR; return '^';
- case RID_XOR_EQ: pyylval->code = BIT_XOR_EXPR; return ASSIGN;
- case RID_NOT_EQ: pyylval->code = NE_EXPR; return EQCOMPARE;
-
- default:
- pyylval->ttype = ridpointers[C_RID_CODE (id)];
- return C_RID_YYCODE (id);
- }
+ pyylval->ttype = ridpointers[C_RID_CODE (id)];
+ return C_RID_YYCODE (id);
}
/* Make sure that user does not collide with our internal naming