From e72b937dddaf24d99ec1bf3beda4d8ecf3cd368c Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Mon, 14 Aug 2023 18:32:29 +0200 Subject: [gdb/build] Fix struct token odr violation When building gdb with -O2 -flto I run into: ... /data/vries/gdb/src/gdb/c-exp.y:2450:8: warning: type 'struct token' \ violates the C++ One Definition Rule [-Wodr] struct token ^ /data/vries/gdb/src/gdb/d-exp.y:939:8: note: a different type is defined in \ another translation unit struct token ^ ... Fix this by renaming to c_token and d_token. Likewise in: - fortran-exp.y, renaming to f_token, - go-exp.y, renaming to go_token, and - p-exp.y, renaming to p_token. Tested on x86_64-linux. Approved-By: Tom Tromey PR build/22395 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395 --- gdb/d-exp.y | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gdb/d-exp.y') diff --git a/gdb/d-exp.y b/gdb/d-exp.y index 8620a67..6c5569a 100644 --- a/gdb/d-exp.y +++ b/gdb/d-exp.y @@ -936,21 +936,21 @@ parse_string_or_char (const char *tokptr, const char **outptr, return quote == '\'' ? CHARACTER_LITERAL : STRING_LITERAL; } -struct token +struct d_token { const char *oper; int token; enum exp_opcode opcode; }; -static const struct token tokentab3[] = +static const struct d_token tokentab3[] = { {"^^=", ASSIGN_MODIFY, BINOP_EXP}, {"<<=", ASSIGN_MODIFY, BINOP_LSH}, {">>=", ASSIGN_MODIFY, BINOP_RSH}, }; -static const struct token tokentab2[] = +static const struct d_token tokentab2[] = { {"+=", ASSIGN_MODIFY, BINOP_ADD}, {"-=", ASSIGN_MODIFY, BINOP_SUB}, @@ -975,7 +975,7 @@ static const struct token tokentab2[] = }; /* Identifier-like tokens. */ -static const struct token ident_tokens[] = +static const struct d_token ident_tokens[] = { {"is", IDENTITY, OP_NULL}, {"!is", NOTIDENTITY, OP_NULL}, -- cgit v1.1