aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorSteve Ellcey <sje@cup.hp.com>2006-08-14 23:13:54 +0000
committerSteve Ellcey <sje@gcc.gnu.org>2006-08-14 23:13:54 +0000
commitb52dbbf86510c011400a97e204cf9384fef83b0c (patch)
tree3997bb50dfd7d49e1c239b1d5843cf07e8405f16 /libcpp
parentac1ed908de999523efc36f38e69bca1aadfe0808 (diff)
re PR c++/28288 (ICE with min/max operator)
PR c++/28288 PR c++/14556 * operators.def: Remove <?, ?>, <?=, and >?= operators. * parser.c: Remove CPP_MIN, CPP_MAX, CPP_MIN_EQ, and CPP_MAX_EQ. (cp_parser_warn_min_max): Remove. * include/cpplib.h: Remove <?, >?, <?=, and >?= tokens. (CPP_LAST_EQ): Change. (CPP_LAST_PUNCTUATOR): Change. * expr.c (cpp_operator): Remove MIN and MAX. (reduce): Remove CPP_MIN and CPP_MAX. (num_binary_op): Ditto. * lex.c (_cpp_lex_direct): Ditto. (cpp_avoid_paste): Remove ? as legal symbol after > or <. From-SVN: r116140
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog13
-rw-r--r--libcpp/expr.c21
-rw-r--r--libcpp/include/cpplib.h13
-rw-r--r--libcpp/lex.c14
4 files changed, 21 insertions, 40 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 865287b2545..98d2cc22e7f 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,16 @@
+2006-08-14 Steve Ellcey <sje@cup.hp.com>
+
+ PR c++/28288
+ PR c++/14556
+ * include/cpplib.h: Remove <?, >?, <?=, and >?= tokens.
+ (CPP_LAST_EQ): Change.
+ (CPP_LAST_PUNCTUATOR): Change.
+ * expr.c (cpp_operator): Remove MIN and MAX.
+ (reduce): Remove CPP_MIN and CPP_MAX.
+ (num_binary_op): Ditto.
+ * lex.c (_cpp_lex_direct): Ditto.
+ (cpp_avoid_paste): Remove ? as legal symbol after > or <.
+
2006-06-09 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/27746
diff --git a/libcpp/expr.c b/libcpp/expr.c
index a61ff665ec0..574b85ff656 100644
--- a/libcpp/expr.c
+++ b/libcpp/expr.c
@@ -668,9 +668,6 @@ static const struct cpp_operator
/* RSHIFT */ {13, LEFT_ASSOC},
/* LSHIFT */ {13, LEFT_ASSOC},
- /* MIN */ {10, LEFT_ASSOC | CHECK_PROMOTION},
- /* MAX */ {10, LEFT_ASSOC | CHECK_PROMOTION},
-
/* COMPL */ {16, NO_L_OPERAND},
/* AND_AND */ {6, LEFT_ASSOC},
/* OR_OR */ {5, LEFT_ASSOC},
@@ -882,8 +879,6 @@ reduce (cpp_reader *pfile, struct op *top, enum cpp_ttype op)
case CPP_MINUS:
case CPP_RSHIFT:
case CPP_LSHIFT:
- case CPP_MIN:
- case CPP_MAX:
case CPP_COMMA:
top[-1].value = num_binary_op (pfile, top[-1].value,
top->value, top->op);
@@ -1309,7 +1304,6 @@ num_binary_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op)
{
cpp_num result;
size_t precision = CPP_OPTION (pfile, precision);
- bool gte;
size_t n;
switch (op)
@@ -1336,21 +1330,6 @@ num_binary_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op)
lhs = num_rshift (lhs, precision, n);
break;
- /* Min / Max. */
- case CPP_MIN:
- case CPP_MAX:
- {
- bool unsignedp = lhs.unsignedp || rhs.unsignedp;
-
- gte = num_greater_eq (lhs, rhs, precision);
- if (op == CPP_MIN)
- gte = !gte;
- if (!gte)
- lhs = rhs;
- lhs.unsignedp = unsignedp;
- }
- break;
-
/* Arithmetic. */
case CPP_MINUS:
rhs = num_negate (rhs, precision);
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 2cea1f5afd2..5fb80d9e820 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -51,7 +51,10 @@ struct _cpp_file;
The first group, to CPP_LAST_EQ, can be immediately followed by an
'='. The lexer needs operators ending in '=', like ">>=", to be in
- the same order as their counterparts without the '=', like ">>". */
+ the same order as their counterparts without the '=', like ">>".
+
+ See the cpp_operator table optab in expr.c if you change the order or
+ add or remove anything in the first group. */
#define TTYPE_TABLE \
OP(EQ, "=") \
@@ -68,8 +71,6 @@ struct _cpp_file;
OP(XOR, "^") \
OP(RSHIFT, ">>") \
OP(LSHIFT, "<<") \
- OP(MIN, "<?") /* extension */ \
- OP(MAX, ">?") \
\
OP(COMPL, "~") \
OP(AND_AND, "&&") /* logical */ \
@@ -97,8 +98,6 @@ struct _cpp_file;
OP(XOR_EQ, "^=") \
OP(RSHIFT_EQ, ">>=") \
OP(LSHIFT_EQ, "<<=") \
- OP(MIN_EQ, "<?=") /* extension */ \
- OP(MAX_EQ, ">?=") \
/* Digraphs together, beginning with CPP_FIRST_DIGRAPH. */ \
OP(HASH, "#") /* digraphs */ \
OP(PASTE, "##") \
@@ -146,9 +145,9 @@ enum cpp_ttype
N_TTYPES,
/* Positions in the table. */
- CPP_LAST_EQ = CPP_MAX,
+ CPP_LAST_EQ = CPP_LSHIFT,
CPP_FIRST_DIGRAPH = CPP_HASH,
- CPP_LAST_PUNCTUATOR= CPP_DOT_STAR,
+ CPP_LAST_PUNCTUATOR= CPP_ATSIGN,
CPP_LAST_CPP_OP = CPP_LESS_EQ
};
#undef OP
diff --git a/libcpp/lex.c b/libcpp/lex.c
index cae9b037663..6dc0fd9d8df 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -1052,11 +1052,6 @@ _cpp_lex_direct (cpp_reader *pfile)
buffer->cur++;
IF_NEXT_IS ('=', CPP_LSHIFT_EQ, CPP_LSHIFT);
}
- else if (*buffer->cur == '?' && CPP_OPTION (pfile, cplusplus))
- {
- buffer->cur++;
- IF_NEXT_IS ('=', CPP_MIN_EQ, CPP_MIN);
- }
else if (CPP_OPTION (pfile, digraphs))
{
if (*buffer->cur == ':')
@@ -1083,11 +1078,6 @@ _cpp_lex_direct (cpp_reader *pfile)
buffer->cur++;
IF_NEXT_IS ('=', CPP_RSHIFT_EQ, CPP_RSHIFT);
}
- else if (*buffer->cur == '?' && CPP_OPTION (pfile, cplusplus))
- {
- buffer->cur++;
- IF_NEXT_IS ('=', CPP_MAX_EQ, CPP_MAX);
- }
break;
case '%':
@@ -1472,8 +1462,8 @@ cpp_avoid_paste (cpp_reader *pfile, const cpp_token *token1,
switch (a)
{
- case CPP_GREATER: return c == '>' || c == '?';
- case CPP_LESS: return c == '<' || c == '?' || c == '%' || c == ':';
+ case CPP_GREATER: return c == '>';
+ case CPP_LESS: return c == '<' || c == '%' || c == ':';
case CPP_PLUS: return c == '+';
case CPP_MINUS: return c == '-' || c == '>';
case CPP_DIV: return c == '/' || c == '*'; /* Comments. */