diff options
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index a614540..d682f3a 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -1787,6 +1787,16 @@ cp_parser_is_keyword (cp_token* token, enum rid keyword) return token->keyword == keyword; } +/* A minimum or maximum operator has been seen. As these are + deprecated, issue a warning. */ + +static inline void +cp_parser_warn_min_max (void) +{ + if (warn_deprecated && !in_system_header) + warning ("minimum/maximum operators are deprecated"); +} + /* If not parsing tentatively, issue a diagnostic of the form FILE:LINE: MESSAGE before TOKEN where TOKEN is the next token in the input stream. MESSAGE @@ -5401,6 +5411,9 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p) { /* Get an operator token. */ token = cp_lexer_peek_token (parser->lexer); + if (token->type == CPP_MIN || token->type == CPP_MAX) + cp_parser_warn_min_max (); + new_prec = TOKEN_PRECEDENCE (token); /* Popping an entry off the stack means we completed a subexpression: @@ -5656,10 +5669,12 @@ cp_parser_assignment_operator_opt (cp_parser* parser) case CPP_MIN_EQ: op = MIN_EXPR; + cp_parser_warn_min_max (); break; case CPP_MAX_EQ: op = MAX_EXPR; + cp_parser_warn_min_max (); break; default: @@ -8039,18 +8054,22 @@ cp_parser_operator (cp_parser* parser) /* Extensions. */ case CPP_MIN: id = ansi_opname (MIN_EXPR); + cp_parser_warn_min_max (); break; case CPP_MAX: id = ansi_opname (MAX_EXPR); + cp_parser_warn_min_max (); break; case CPP_MIN_EQ: id = ansi_assopname (MIN_EXPR); + cp_parser_warn_min_max (); break; case CPP_MAX_EQ: id = ansi_assopname (MAX_EXPR); + cp_parser_warn_min_max (); break; default: |