From 79ab486e97be04fb719b3ef91ea3e2b3c9c345c8 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 8 Mar 2021 07:27:57 -0700 Subject: [PATCH] Remove BINOP_END BINOP_END is used only as a "meaningless" value in various tables. This patch changes these to use OP_NULL instead, and removes BINOP_END. gdb/ChangeLog 2021-03-08 Tom Tromey * std-operator.def (BINOP_END): Remove. * p-exp.y (tokentab3, tokentab2): Use OP_NULL, not BINOP_END. * go-exp.y (tokentab2): Use OP_NULL, not BINOP_END. * f-exp.y (dot_ops, f77_keywords): Use OP_NULL, not BINOP_END. * d-exp.y (tokentab2, ident_tokens): Use OP_NULL, not BINOP_END. * c-exp.y (tokentab3, tokentab2, ident_tokens): Use OP_NULL, not BINOP_END. --- gdb/ChangeLog | 10 ++++++ gdb/c-exp.y | 36 ++++++++++----------- gdb/d-exp.y | 28 ++++++++--------- gdb/f-exp.y | 74 ++++++++++++++++++++++---------------------- gdb/go-exp.y | 26 ++++++++-------- gdb/p-exp.y | 30 +++++++++--------- gdb/std-operator.def | 3 -- 7 files changed, 107 insertions(+), 100 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 82b2c45ea53..97f029f402c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2021-03-08 Tom Tromey + + * std-operator.def (BINOP_END): Remove. + * p-exp.y (tokentab3, tokentab2): Use OP_NULL, not BINOP_END. + * go-exp.y (tokentab2): Use OP_NULL, not BINOP_END. + * f-exp.y (dot_ops, f77_keywords): Use OP_NULL, not BINOP_END. + * d-exp.y (tokentab2, ident_tokens): Use OP_NULL, not BINOP_END. + * c-exp.y (tokentab3, tokentab2, ident_tokens): Use OP_NULL, not + BINOP_END. + 2021-03-08 Tom Tromey * expression.h (enum exp_opcode) : Remove. diff --git a/gdb/c-exp.y b/gdb/c-exp.y index ad26a7cd2c5..8bc7a97e0ac 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -2479,8 +2479,8 @@ static const struct token tokentab3[] = { {">>=", ASSIGN_MODIFY, BINOP_RSH, 0}, {"<<=", ASSIGN_MODIFY, BINOP_LSH, 0}, - {"->*", ARROW_STAR, BINOP_END, FLAG_CXX}, - {"...", DOTDOTDOT, BINOP_END, 0} + {"->*", ARROW_STAR, OP_NULL, FLAG_CXX}, + {"...", DOTDOTDOT, OP_NULL, 0} }; static const struct token tokentab2[] = @@ -2493,21 +2493,21 @@ static const struct token tokentab2[] = {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR, 0}, {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND, 0}, {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR, 0}, - {"++", INCREMENT, BINOP_END, 0}, - {"--", DECREMENT, BINOP_END, 0}, - {"->", ARROW, BINOP_END, 0}, - {"&&", ANDAND, BINOP_END, 0}, - {"||", OROR, BINOP_END, 0}, + {"++", INCREMENT, OP_NULL, 0}, + {"--", DECREMENT, OP_NULL, 0}, + {"->", ARROW, OP_NULL, 0}, + {"&&", ANDAND, OP_NULL, 0}, + {"||", OROR, OP_NULL, 0}, /* "::" is *not* only C++: gdb overrides its meaning in several different ways, e.g., 'filename'::func, function::variable. */ - {"::", COLONCOLON, BINOP_END, 0}, - {"<<", LSH, BINOP_END, 0}, - {">>", RSH, BINOP_END, 0}, - {"==", EQUAL, BINOP_END, 0}, - {"!=", NOTEQUAL, BINOP_END, 0}, - {"<=", LEQ, BINOP_END, 0}, - {">=", GEQ, BINOP_END, 0}, - {".*", DOT_STAR, BINOP_END, FLAG_CXX} + {"::", COLONCOLON, OP_NULL, 0}, + {"<<", LSH, OP_NULL, 0}, + {">>", RSH, OP_NULL, 0}, + {"==", EQUAL, OP_NULL, 0}, + {"!=", NOTEQUAL, OP_NULL, 0}, + {"<=", LEQ, OP_NULL, 0}, + {">=", GEQ, OP_NULL, 0}, + {".*", DOT_STAR, OP_NULL, FLAG_CXX} }; /* Identifier-like tokens. Only type-specifiers than can appear in @@ -2546,14 +2546,14 @@ static const struct token ident_tokens[] = {"delete", DELETE, OP_NULL, FLAG_CXX}, {"operator", OPERATOR, OP_NULL, FLAG_CXX}, - {"and", ANDAND, BINOP_END, FLAG_CXX}, + {"and", ANDAND, OP_NULL, FLAG_CXX}, {"and_eq", ASSIGN_MODIFY, BINOP_BITWISE_AND, FLAG_CXX}, {"bitand", '&', OP_NULL, FLAG_CXX}, {"bitor", '|', OP_NULL, FLAG_CXX}, {"compl", '~', OP_NULL, FLAG_CXX}, {"not", '!', OP_NULL, FLAG_CXX}, - {"not_eq", NOTEQUAL, BINOP_END, FLAG_CXX}, - {"or", OROR, BINOP_END, FLAG_CXX}, + {"not_eq", NOTEQUAL, OP_NULL, FLAG_CXX}, + {"or", OROR, OP_NULL, FLAG_CXX}, {"or_eq", ASSIGN_MODIFY, BINOP_BITWISE_IOR, FLAG_CXX}, {"xor", '^', OP_NULL, FLAG_CXX}, {"xor_eq", ASSIGN_MODIFY, BINOP_BITWISE_XOR, FLAG_CXX}, diff --git a/gdb/d-exp.y b/gdb/d-exp.y index 1a75431ea27..d74fb8711a0 100644 --- a/gdb/d-exp.y +++ b/gdb/d-exp.y @@ -965,25 +965,25 @@ static const struct token tokentab2[] = {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR}, {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND}, {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR}, - {"++", INCREMENT, BINOP_END}, - {"--", DECREMENT, BINOP_END}, - {"&&", ANDAND, BINOP_END}, - {"||", OROR, BINOP_END}, - {"^^", HATHAT, BINOP_END}, - {"<<", LSH, BINOP_END}, - {">>", RSH, BINOP_END}, - {"==", EQUAL, BINOP_END}, - {"!=", NOTEQUAL, BINOP_END}, - {"<=", LEQ, BINOP_END}, - {">=", GEQ, BINOP_END}, - {"..", DOTDOT, BINOP_END}, + {"++", INCREMENT, OP_NULL}, + {"--", DECREMENT, OP_NULL}, + {"&&", ANDAND, OP_NULL}, + {"||", OROR, OP_NULL}, + {"^^", HATHAT, OP_NULL}, + {"<<", LSH, OP_NULL}, + {">>", RSH, OP_NULL}, + {"==", EQUAL, OP_NULL}, + {"!=", NOTEQUAL, OP_NULL}, + {"<=", LEQ, OP_NULL}, + {">=", GEQ, OP_NULL}, + {"..", DOTDOT, OP_NULL}, }; /* Identifier-like tokens. */ static const struct token ident_tokens[] = { - {"is", IDENTITY, BINOP_END}, - {"!is", NOTIDENTITY, BINOP_END}, + {"is", IDENTITY, OP_NULL}, + {"!is", NOTIDENTITY, OP_NULL}, {"cast", CAST_KEYWORD, OP_NULL}, {"const", CONST_KEYWORD, OP_NULL}, diff --git a/gdb/f-exp.y b/gdb/f-exp.y index 0e56669f0a3..c33b5079158 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -1066,24 +1066,24 @@ struct token static const struct token fortran_operators[] = { - { ".and.", BOOL_AND, BINOP_END, false }, - { ".or.", BOOL_OR, BINOP_END, false }, - { ".not.", BOOL_NOT, BINOP_END, false }, - { ".eq.", EQUAL, BINOP_END, false }, - { ".eqv.", EQUAL, BINOP_END, false }, - { ".neqv.", NOTEQUAL, BINOP_END, false }, - { ".xor.", NOTEQUAL, BINOP_END, false }, - { "==", EQUAL, BINOP_END, false }, - { ".ne.", NOTEQUAL, BINOP_END, false }, - { "/=", NOTEQUAL, BINOP_END, false }, - { ".le.", LEQ, BINOP_END, false }, - { "<=", LEQ, BINOP_END, false }, - { ".ge.", GEQ, BINOP_END, false }, - { ">=", GEQ, BINOP_END, false }, - { ".gt.", GREATERTHAN, BINOP_END, false }, - { ">", GREATERTHAN, BINOP_END, false }, - { ".lt.", LESSTHAN, BINOP_END, false }, - { "<", LESSTHAN, BINOP_END, false }, + { ".and.", BOOL_AND, OP_NULL, false }, + { ".or.", BOOL_OR, OP_NULL, false }, + { ".not.", BOOL_NOT, OP_NULL, false }, + { ".eq.", EQUAL, OP_NULL, false }, + { ".eqv.", EQUAL, OP_NULL, false }, + { ".neqv.", NOTEQUAL, OP_NULL, false }, + { ".xor.", NOTEQUAL, OP_NULL, false }, + { "==", EQUAL, OP_NULL, false }, + { ".ne.", NOTEQUAL, OP_NULL, false }, + { "/=", NOTEQUAL, OP_NULL, false }, + { ".le.", LEQ, OP_NULL, false }, + { "<=", LEQ, OP_NULL, false }, + { ".ge.", GEQ, OP_NULL, false }, + { ">=", GEQ, OP_NULL, false }, + { ".gt.", GREATERTHAN, OP_NULL, false }, + { ">", GREATERTHAN, OP_NULL, false }, + { ".lt.", LESSTHAN, OP_NULL, false }, + { "<", LESSTHAN, OP_NULL, false }, { "**", STARSTAR, BINOP_EXP, false }, }; @@ -1108,27 +1108,27 @@ static const struct f77_boolean_val boolean_values[] = static const struct token f77_keywords[] = { /* Historically these have always been lowercase only in GDB. */ - { "complex_16", COMPLEX_S16_KEYWORD, BINOP_END, true }, - { "complex_32", COMPLEX_S32_KEYWORD, BINOP_END, true }, - { "character", CHARACTER, BINOP_END, true }, - { "integer_2", INT_S2_KEYWORD, BINOP_END, true }, - { "logical_1", LOGICAL_S1_KEYWORD, BINOP_END, true }, - { "logical_2", LOGICAL_S2_KEYWORD, BINOP_END, true }, - { "logical_8", LOGICAL_S8_KEYWORD, BINOP_END, true }, - { "complex_8", COMPLEX_S8_KEYWORD, BINOP_END, true }, - { "integer", INT_KEYWORD, BINOP_END, true }, - { "logical", LOGICAL_KEYWORD, BINOP_END, true }, - { "real_16", REAL_S16_KEYWORD, BINOP_END, true }, - { "complex", COMPLEX_KEYWORD, BINOP_END, true }, - { "sizeof", SIZEOF, BINOP_END, true }, - { "real_8", REAL_S8_KEYWORD, BINOP_END, true }, - { "real", REAL_KEYWORD, BINOP_END, true }, - { "single", SINGLE, BINOP_END, true }, - { "double", DOUBLE, BINOP_END, true }, - { "precision", PRECISION, BINOP_END, true }, + { "complex_16", COMPLEX_S16_KEYWORD, OP_NULL, true }, + { "complex_32", COMPLEX_S32_KEYWORD, OP_NULL, true }, + { "character", CHARACTER, OP_NULL, true }, + { "integer_2", INT_S2_KEYWORD, OP_NULL, true }, + { "logical_1", LOGICAL_S1_KEYWORD, OP_NULL, true }, + { "logical_2", LOGICAL_S2_KEYWORD, OP_NULL, true }, + { "logical_8", LOGICAL_S8_KEYWORD, OP_NULL, true }, + { "complex_8", COMPLEX_S8_KEYWORD, OP_NULL, true }, + { "integer", INT_KEYWORD, OP_NULL, true }, + { "logical", LOGICAL_KEYWORD, OP_NULL, true }, + { "real_16", REAL_S16_KEYWORD, OP_NULL, true }, + { "complex", COMPLEX_KEYWORD, OP_NULL, true }, + { "sizeof", SIZEOF, OP_NULL, true }, + { "real_8", REAL_S8_KEYWORD, OP_NULL, true }, + { "real", REAL_KEYWORD, OP_NULL, true }, + { "single", SINGLE, OP_NULL, true }, + { "double", DOUBLE, OP_NULL, true }, + { "precision", PRECISION, OP_NULL, true }, /* The following correspond to actual functions in Fortran and are case insensitive. */ - { "kind", KIND, BINOP_END, false }, + { "kind", KIND, OP_NULL, false }, { "abs", UNOP_INTRINSIC, UNOP_ABS, false }, { "mod", BINOP_INTRINSIC, BINOP_MOD, false }, { "floor", UNOP_INTRINSIC, UNOP_FORTRAN_FLOOR, false }, diff --git a/gdb/go-exp.y b/gdb/go-exp.y index 6e070a7f4ff..d096cc8b7c9 100644 --- a/gdb/go-exp.y +++ b/gdb/go-exp.y @@ -966,19 +966,19 @@ static const struct token tokentab2[] = {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR}, {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND}, {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR}, - {"++", INCREMENT, BINOP_END}, - {"--", DECREMENT, BINOP_END}, - /*{"->", RIGHT_ARROW, BINOP_END}, Doesn't exist in Go. */ - {"<-", LEFT_ARROW, BINOP_END}, - {"&&", ANDAND, BINOP_END}, - {"||", OROR, BINOP_END}, - {"<<", LSH, BINOP_END}, - {">>", RSH, BINOP_END}, - {"==", EQUAL, BINOP_END}, - {"!=", NOTEQUAL, BINOP_END}, - {"<=", LEQ, BINOP_END}, - {">=", GEQ, BINOP_END}, - /*{"&^", ANDNOT, BINOP_END}, TODO */ + {"++", INCREMENT, OP_NULL}, + {"--", DECREMENT, OP_NULL}, + /*{"->", RIGHT_ARROW, OP_NULL}, Doesn't exist in Go. */ + {"<-", LEFT_ARROW, OP_NULL}, + {"&&", ANDAND, OP_NULL}, + {"||", OROR, OP_NULL}, + {"<<", LSH, OP_NULL}, + {">>", RSH, OP_NULL}, + {"==", EQUAL, OP_NULL}, + {"!=", NOTEQUAL, OP_NULL}, + {"<=", LEQ, OP_NULL}, + {">=", GEQ, OP_NULL}, + /*{"&^", ANDNOT, OP_NULL}, TODO */ }; /* Identifier-like tokens. */ diff --git a/gdb/p-exp.y b/gdb/p-exp.y index fc9984c996a..963e8989bf1 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -1048,25 +1048,25 @@ struct token static const struct token tokentab3[] = { - {"shr", RSH, BINOP_END}, - {"shl", LSH, BINOP_END}, - {"and", ANDAND, BINOP_END}, - {"div", DIV, BINOP_END}, - {"not", NOT, BINOP_END}, - {"mod", MOD, BINOP_END}, - {"inc", INCREMENT, BINOP_END}, - {"dec", DECREMENT, BINOP_END}, - {"xor", XOR, BINOP_END} + {"shr", RSH, OP_NULL}, + {"shl", LSH, OP_NULL}, + {"and", ANDAND, OP_NULL}, + {"div", DIV, OP_NULL}, + {"not", NOT, OP_NULL}, + {"mod", MOD, OP_NULL}, + {"inc", INCREMENT, OP_NULL}, + {"dec", DECREMENT, OP_NULL}, + {"xor", XOR, OP_NULL} }; static const struct token tokentab2[] = { - {"or", OR, BINOP_END}, - {"<>", NOTEQUAL, BINOP_END}, - {"<=", LEQ, BINOP_END}, - {">=", GEQ, BINOP_END}, - {":=", ASSIGN, BINOP_END}, - {"::", COLONCOLON, BINOP_END} }; + {"or", OR, OP_NULL}, + {"<>", NOTEQUAL, OP_NULL}, + {"<=", LEQ, OP_NULL}, + {">=", GEQ, OP_NULL}, + {":=", ASSIGN, OP_NULL}, + {"::", COLONCOLON, OP_NULL} }; /* Allocate uppercased var: */ /* make an uppercased copy of tokstart. */ diff --git a/gdb/std-operator.def b/gdb/std-operator.def index 82daabeaa9b..b0c6beb4628 100644 --- a/gdb/std-operator.def +++ b/gdb/std-operator.def @@ -87,9 +87,6 @@ OP (BINOP_VAL) the second operand with itself that many times. */ OP (BINOP_CONCAT) -/* This must be the highest BINOP_ value, for expprint.c. */ -OP (BINOP_END) - /* Operates on three values computed by following subexpressions. */ OP (TERNOP_COND) /* ?: */ -- 2.30.2