aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplib.h
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2002-04-26 06:32:50 +0000
committerNeil Booth <neil@gcc.gnu.org>2002-04-26 06:32:50 +0000
commitf8b954fcdc0446691171bd20e6cb218799d4d1a9 (patch)
tree41b138ea9b50f42af72e2ae19543c9e1a16ce126 /gcc/cpplib.h
parent6052bef039abf0676722cd1df243c1cf5ab99431 (diff)
downloadgcc-f8b954fcdc0446691171bd20e6cb218799d4d1a9.zip
gcc-f8b954fcdc0446691171bd20e6cb218799d4d1a9.tar.gz
gcc-f8b954fcdc0446691171bd20e6cb218799d4d1a9.tar.bz2
cppexp.c (CPP_UMINUS, CPP_UPLUS): New.
* cppexp.c (CPP_UMINUS, CPP_UPLUS): New. (HAVE_NO_R_OPERAND): Remove. (HAVE_VALUE): Remove. (op_to_prio): Update. (UNARY): Don't alter flags. (_cpp_parse_expr): want_value used to indicate whether a number or unary operator is expected next. Distinguish unary and binary +/-. (op_as_text): Update for unary operators. From-SVN: r52780
Diffstat (limited to 'gcc/cpplib.h')
-rw-r--r--gcc/cpplib.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
index 765d65a..164c4c8 100644
--- a/gcc/cpplib.h
+++ b/gcc/cpplib.h
@@ -46,9 +46,9 @@ typedef struct cpp_callbacks cpp_callbacks;
struct answer;
struct file_name_map_list;
-/* The first two groups, apart from '=', can appear in preprocessor
- expressions. This allows a lookup table to be implemented in
- _cpp_parse_expr.
+/* The first three groups, apart from '=', can appear in preprocessor
+ expressions (+= and -= are used to indicate unary + and - resp.).
+ This allows a lookup table to be implemented in _cpp_parse_expr.
The first group, to CPP_LAST_EQ, can be immediately followed by an
'='. The lexer needs operators ending in '=', like ">>=", to be in
@@ -58,6 +58,7 @@ struct file_name_map_list;
#define CPP_LAST_EQ CPP_MAX
#define CPP_FIRST_DIGRAPH CPP_HASH
#define CPP_LAST_PUNCTUATOR CPP_DOT_STAR
+#define CPP_LAST_CPP_OP CPP_EOF
#define TTYPE_TABLE \
OP(CPP_EQ = 0, "=") \
@@ -90,8 +91,11 @@ struct file_name_map_list;
OP(CPP_GREATER_EQ, ">=") \
OP(CPP_LESS_EQ, "<=") \
\
+ /* These 3 are special in preprocessor expressions. */ \
+ TK(CPP_EOF, SPELL_NONE) \
OP(CPP_PLUS_EQ, "+=") /* math */ \
OP(CPP_MINUS_EQ, "-=") \
+\
OP(CPP_MULT_EQ, "*=") \
OP(CPP_DIV_EQ, "/=") \
OP(CPP_MOD_EQ, "%=") \
@@ -135,8 +139,7 @@ struct file_name_map_list;
TK(CPP_COMMENT, SPELL_NUMBER) /* Only if output comments. */ \
/* SPELL_NUMBER happens to DTRT. */ \
TK(CPP_MACRO_ARG, SPELL_NONE) /* Macro argument. */ \
- TK(CPP_PADDING, SPELL_NONE) /* Whitespace for cpp0. */ \
- TK(CPP_EOF, SPELL_NONE) /* End of line or file. */
+ TK(CPP_PADDING, SPELL_NONE) /* Whitespace for cpp0. */
#define OP(e, s) e,
#define TK(e, s) e,