summaryrefslogtreecommitdiff
path: root/gcc/cpplib.h
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-07-19 20:18:08 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-07-19 20:18:08 +0000
commit316744619de1b120399985e6b8f5ae475da07ed4 (patch)
treefb27fc4ef85133963af7127518d36e07b5e1d021 /gcc/cpplib.h
parent91d4291d407bed3bc47e9dca4af564a601e1c0b2 (diff)
downloadgcc-316744619de1b120399985e6b8f5ae475da07ed4.tar.gz
* cpplib.h (TTYPE_TABLE): Move CPP_MIN and CPP_MAX into block
of operators allowed in #if and having an _EQ variant. Add CPP_MIN_EQ, CPP_MAX_EQ, and CPP_DEFINED. (cpp_token flags): Add NAMED_OP. (enum node_type): Add T_OPERATOR. (struct cpp_hashnode): Add code slot to value union. * cpphash.h (spec_nodes): Remove n_defined. * cpplex.c (lex_line): Convert T_OPERATOR nodes to their proper types. (spell_token, can_paste, maybe_paste_with_next): Handle named operators. (is_macro_disabled): Tweak error messages. * cpplib.c (get_define_node): Disallow all named operators as macro names. Tweak error messages. (_cpp_init_stacks): Don't set up spec_nodes->n_defined. * cppinit.c (builtin_array): Add entries for the named operators. * cppexp.c (lex): Check for CPP_DEFINED token. (priority table): Add entries for CPP_MIN and CPP_MAX. (_cpp_parse_expr): Handle CPP_MIN and CPP_MAX. testsuite: * gcc.dg/cpp/directiv.c, gcc.dg/cpp/macsyntx.c, gcc.dg/cpp/undef1.c: Tweak error regexps. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35137 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpplib.h')
-rw-r--r--gcc/cpplib.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
index b8da90aa61e..4cec348811d 100644
--- a/gcc/cpplib.h
+++ b/gcc/cpplib.h
@@ -64,6 +64,8 @@ typedef struct cpp_hashnode cpp_hashnode;
OP(CPP_XOR, "^") \
OP(CPP_RSHIFT, ">>") \
OP(CPP_LSHIFT, "<<") \
+ OP(CPP_MIN, "<?") /* extension */ \
+ OP(CPP_MAX, ">?") \
\
OP(CPP_COMPL, "~") \
OP(CPP_AND_AND, "&&") /* logical */ \
@@ -88,6 +90,8 @@ typedef struct cpp_hashnode cpp_hashnode;
OP(CPP_XOR_EQ, "^=") \
OP(CPP_RSHIFT_EQ, ">>=") \
OP(CPP_LSHIFT_EQ, "<<=") \
+ OP(CPP_MIN_EQ, "<?=") /* extension */ \
+ OP(CPP_MAX_EQ, ">?=") \
/* Digraphs together, beginning with CPP_FIRST_DIGRAPH. */ \
OP(CPP_HASH, "#") /* digraphs */ \
OP(CPP_PASTE, "##") \
@@ -106,8 +110,7 @@ typedef struct cpp_hashnode cpp_hashnode;
OP(CPP_SCOPE, "::") \
OP(CPP_DEREF_STAR, "->*") \
OP(CPP_DOT_STAR, ".*") \
- OP(CPP_MIN, "<?") /* extension */ \
- OP(CPP_MAX, ">?") \
+ OP(CPP_DEFINED, "defined") /* #if */ \
\
TK(CPP_NAME, SPELL_IDENT) /* word */ \
TK(CPP_INT, SPELL_STRING) /* 23 */ \
@@ -147,10 +150,11 @@ struct cpp_string
/* Flags for the cpp_token structure. */
#define PREV_WHITE (1 << 0) /* If whitespace before this token. */
#define BOL (1 << 1) /* Beginning of logical line. */
-#define DIGRAPH (1 << 2) /* If it was a digraph. */
+#define DIGRAPH (1 << 2) /* If it was a digraph. */
#define STRINGIFY_ARG (1 << 3) /* If macro argument to be stringified. */
#define PASTE_LEFT (1 << 4) /* If on LHS of a ## operator. */
#define PASTED (1 << 5) /* The result of a ## operator. */
+#define NAMED_OP (1 << 6) /* C++ named operators, also defined */
/* A preprocessing token. This has been carefully packed and should
occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts. */
@@ -603,6 +607,7 @@ enum node_type
T_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */
T_TIME, /* `__TIME__' */
T_STDC, /* `__STDC__' */
+ T_OPERATOR, /* operator with a name; val.code is token type */
T_POISON, /* poisoned identifier */
T_MACRO, /* a macro, either object-like or function-like */
T_ASSERTION /* predicate for #assert */
@@ -624,6 +629,7 @@ struct cpp_hashnode
{
const cpp_toklist *expansion; /* a macro's replacement list. */
struct answer *answers; /* answers to an assertion. */
+ enum cpp_ttype code; /* code for a named operator. */
} value;
union tree_node *fe_value; /* front end value */