From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id C21153838034; Thu, 28 Apr 2022 15:34:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C21153838034 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Remove "typedef enum ..." X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: c42dd30d73ec441ed9cab207597c7f5ce88ee231 X-Git-Newrev: 0d1703b8fb611f978577a70ad6aa308a12a53980 Message-Id: <20220428153444.C21153838034@sourceware.org> Date: Thu, 28 Apr 2022 15:34:44 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2022 15:34:44 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D0d1703b8fb61= 1f978577a70ad6aa308a12a53980 commit 0d1703b8fb611f978577a70ad6aa308a12a53980 Author: Tom Tromey Date: Wed Apr 27 14:32:49 2022 -0600 Remove "typedef enum ..." =20 I noticed a few spots in GDB that use "typedef enum". However, in C++ this isn't as useful, as the tag is automatically entered as a typedef. This patch removes most uses of "typedef enum" -- the exceptions being in some nat-* code I can't compile, and glibc_thread_db.h, which I think is more or less a copy of some C code from elsewhere. =20 Tested by rebuilding. Diff: --- gdb/arm-tdep.c | 8 ++++---- gdb/break-catch-fork.c | 5 ++--- gdb/command.h | 5 ++--- gdb/f-exp.y | 2 +- gdb/ia64-tdep.c | 4 ++-- gdb/jit.h | 4 ++-- gdb/linespec.c | 3 +-- gdb/nat/windows-nat.h | 4 ++-- gdb/nat/x86-dregs.c | 2 +- gdb/psympriv.h | 2 +- gdb/python/py-event.h | 4 ++-- gdb/symtab.h | 6 +++--- gdb/xtensa-tdep.c | 8 ++++---- gdb/xtensa-tdep.h | 16 ++++++++-------- 14 files changed, 35 insertions(+), 38 deletions(-) diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 7274752c2b9..aa5d8e6e6bd 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -10701,18 +10701,18 @@ enum arm_record_result ARM_RECORD_FAILURE =3D 1 }; =20 -typedef enum +enum arm_record_strx_t { ARM_RECORD_STRH=3D1, ARM_RECORD_STRD -} arm_record_strx_t; +}; =20 -typedef enum +enum record_type_t { ARM_RECORD=3D1, THUMB_RECORD, THUMB2_RECORD -} record_type_t; +}; =20 =20 static int diff --git a/gdb/break-catch-fork.c b/gdb/break-catch-fork.c index c2c87e89361..ca3c44f9381 100644 --- a/gdb/break-catch-fork.c +++ b/gdb/break-catch-fork.c @@ -197,12 +197,11 @@ create_fork_vfork_event_catchpoint (struct gdbarch *g= dbarch, install_breakpoint (0, std::move (c), 1); } =20 -typedef enum +enum catch_fork_kind { catch_fork_temporary, catch_vfork_temporary, catch_fork_permanent, catch_vfork_permanent -} -catch_fork_kind; +}; =20 static void catch_fork_command_1 (const char *arg, int from_tty, diff --git a/gdb/command.h b/gdb/command.h index cd798146ae0..d901da3c8cb 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -71,7 +71,7 @@ enum command_class }; =20 /* Types of "set" or "show" command. */ -typedef enum var_types +enum var_types { /* "on" or "off". *VAR is a bool which is true for on, false for off. */ @@ -120,8 +120,7 @@ typedef enum var_types *VAR is a char pointer to the name of the element that we find. */ var_enum - } -var_types; + }; =20 /* Return true if a setting of type VAR_TYPE is backed with type T. =20 diff --git a/gdb/f-exp.y b/gdb/f-exp.y index adc59a52a05..90cc2c65c7b 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -1639,7 +1639,7 @@ yylex (void) { std::string tmp =3D copy_name (yylval.sval); struct block_symbol result; - const enum domain_enum_tag lookup_domains[] =3D + const domain_enum lookup_domains[] =3D { STRUCT_DOMAIN, VAR_DOMAIN, diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 69a4b4db4fd..dd6d5b199b2 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -75,7 +75,7 @@ static gdb::optional ktab_buf; =20 /* An enumeration of the different IA-64 instruction types. */ =20 -typedef enum instruction_type +enum instruction_type { A, /* Integer ALU ; I-unit or M-unit */ I, /* Non-ALU integer; I-unit */ @@ -85,7 +85,7 @@ typedef enum instruction_type L, /* Extended (L+X) ; I-unit */ X, /* Extended (L+X) ; I-unit */ undefined /* undefined or reserved */ -} instruction_type; +}; =20 /* We represent IA-64 PC addresses as the value of the instruction pointer or'd with some bit combination in the low nibble which diff --git a/gdb/jit.h b/gdb/jit.h index 274ce456f47..68547637b0b 100644 --- a/gdb/jit.h +++ b/gdb/jit.h @@ -28,12 +28,12 @@ struct minimal_symbol; these actions. These values are used by the inferior, so the values of these enums cannot be changed. */ =20 -typedef enum +enum jit_actions_t { JIT_NOACTION =3D 0, JIT_REGISTER, JIT_UNREGISTER -} jit_actions_t; +}; =20 /* This struct describes a single symbol file in a linked list of symbol files describing generated code. As the inferior generates diff --git a/gdb/linespec.c b/gdb/linespec.c index 3cbb8f821f1..c9558c8ae36 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -228,7 +228,7 @@ struct symbol_searcher_collect_info =20 /* Token types */ =20 -enum ls_token_type +enum linespec_token_type { /* A keyword */ LSTOKEN_KEYWORD =3D 0, @@ -251,7 +251,6 @@ enum ls_token_type /* Consumed token */ LSTOKEN_CONSUMED }; -typedef enum ls_token_type linespec_token_type; =20 /* List of keywords. This is NULL-terminated so that it can be used as enum completer. */ diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h index 29fd0a3a69b..27b653674c3 100644 --- a/gdb/nat/windows-nat.h +++ b/gdb/nat/windows-nat.h @@ -129,12 +129,12 @@ struct pending_stop DEBUG_EVENT event; }; =20 -typedef enum +enum handle_exception_result { HANDLE_EXCEPTION_UNHANDLED =3D 0, HANDLE_EXCEPTION_HANDLED, HANDLE_EXCEPTION_IGNORED -} handle_exception_result; +}; =20 /* A single Windows process. An object of this type (or subclass) is created by the client. Some methods must be provided by the client diff --git a/gdb/nat/x86-dregs.c b/gdb/nat/x86-dregs.c index 230b99c0a23..94de0265cf6 100644 --- a/gdb/nat/x86-dregs.c +++ b/gdb/nat/x86-dregs.c @@ -206,7 +206,7 @@ x86_get_debug_register_length () #define X86_DR_WATCH_HIT(dr6, i) ((dr6) & (1 << (i))) =20 /* Types of operations supported by x86_handle_nonaligned_watchpoint. */ -typedef enum { WP_INSERT, WP_REMOVE, WP_COUNT } x86_wp_op_t; +enum x86_wp_op_t { WP_INSERT, WP_REMOVE, WP_COUNT }; =20 /* Print the values of the mirrored debug registers. */ =20 diff --git a/gdb/psympriv.h b/gdb/psympriv.h index 9964c102403..677a57edee8 100644 --- a/gdb/psympriv.h +++ b/gdb/psympriv.h @@ -71,7 +71,7 @@ struct partial_symbol =20 /* Name space code. */ =20 - ENUM_BITFIELD(domain_enum_tag) domain : SYMBOL_DOMAIN_BITS; + ENUM_BITFIELD(domain_enum) domain : SYMBOL_DOMAIN_BITS; =20 /* Address class (for info_symbols). Note that we don't allow synthetic "aclass" values here at present, simply because there's diff --git a/gdb/python/py-event.h b/gdb/python/py-event.h index 56e53b7a1e7..831dd10fc85 100644 --- a/gdb/python/py-event.h +++ b/gdb/python/py-event.h @@ -45,13 +45,13 @@ extern int emit_exited_event (const LONGEST *exit_code,= struct inferior *inf); /* For inferior function call events, discriminate whether event is before or after the call. */ =20 -typedef enum +enum inferior_call_kind { /* Before the call */ INFERIOR_CALL_PRE, /* after the call */ INFERIOR_CALL_POST, -} inferior_call_kind; +}; =20 extern int emit_inferior_call_event (inferior_call_kind kind, ptid_t thread, CORE_ADDR addr); diff --git a/gdb/symtab.h b/gdb/symtab.h index 8c2837cfa8b..b1cf84f756f 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -866,7 +866,7 @@ struct minimal_symbol : public general_symbol_info /* Different name domains for symbols. Looking up a symbol specifies a domain and ignores symbol definitions in other name domains. */ =20 -typedef enum domain_enum_tag +enum domain_enum { /* UNDEF_DOMAIN is used when a domain has not been discovered or none of the following apply. This usually indicates an error either @@ -899,7 +899,7 @@ typedef enum domain_enum_tag =20 /* This must remain last. */ NR_DOMAINS -} domain_enum; +}; =20 /* The number of bits in a symbol used to represent the domain. */ =20 @@ -1418,7 +1418,7 @@ struct symbol : public general_symbol_info, public al= locate_on_obstack =20 /* Domain code. */ =20 - ENUM_BITFIELD(domain_enum_tag) m_domain : SYMBOL_DOMAIN_BITS; + ENUM_BITFIELD(domain_enum) m_domain : SYMBOL_DOMAIN_BITS; =20 /* Address class. This holds an index into the 'symbol_impls' table. The actual enum address_class value is stored there, diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index 89bdd7ffd28..b6558838e44 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -2058,7 +2058,7 @@ call0_ret (CORE_ADDR start_pc, CORE_ADDR finish_pc) The purpose of this is to simplify prologue analysis by separating=20 instruction decoding (libisa) from the semantics of prologue analysis. = */ =20 -typedef enum +enum xtensa_insn_kind { c0opc_illegal, /* Unknown to libisa (invalid) or 'ill' opcode. */ c0opc_uninteresting, /* Not interesting for Call0 prologue analysis. */ @@ -2079,7 +2079,7 @@ typedef enum c0opc_rfwo, /* RFWO instruction. */ c0opc_rfwu, /* RFWU instruction. */ c0opc_NrOf /* Number of opcode classifications. */ -} xtensa_insn_kind; +}; =20 /* Return true, if OPCNAME is RSR, WRS, or XSR instruction. */ =20 @@ -2753,12 +2753,12 @@ execute_s32e (struct gdbarch *gdbarch, int at, int = as, int offset, CORE_ADDR wb) =20 #define XTENSA_MAX_WINDOW_INTERRUPT_HANDLER_LEN 200 =20 -typedef enum +enum xtensa_exception_handler_t { xtWindowOverflow, xtWindowUnderflow, xtNoExceptionHandler -} xtensa_exception_handler_t; +}; =20 /* Execute instruction stream from current PC until hitting RFWU or RFWO. Return type of Xtensa Window Interrupt Handler on success. */ diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h index a1e7188d523..1840ef98b49 100644 --- a/gdb/xtensa-tdep.h +++ b/gdb/xtensa-tdep.h @@ -31,7 +31,7 @@ =20 /* Xtensa register type. */ =20 -typedef enum=20 +enum xtensa_register_type_t { xtRegisterTypeArRegfile =3D 1, /* Register File ar0..arXX. */ xtRegisterTypeSpecialReg, /* CPU states, such as PS, Booleans, (rsr). */ @@ -43,14 +43,14 @@ typedef enum xtRegisterTypeWindow, /* Live window registers (a0..a15). */ xtRegisterTypeVirtual, /* PC, FP. */ xtRegisterTypeUnknown -} xtensa_register_type_t; +}; =20 =20 /* Xtensa register group. */ =20 #define XTENSA_MAX_COPROCESSOR 0x10 /* Number of Xtensa coprocessors. */ =20 -typedef enum=20 +enum xtensa_register_group_t { xtRegisterGroupUnknown =3D 0, xtRegisterGroupRegFile =3D 0x0001, /* Register files without ARx. */ @@ -75,16 +75,16 @@ typedef enum xtRegisterGroupCP6 =3D 0x40000000, /* CP6. */ xtRegisterGroupCP7 =3D 0x80000000, /* CP7. */ =20 -} xtensa_register_group_t; +}; =20 =20 /* Xtensa target flags. */ =20 -typedef enum=20 +enum xtensa_target_flags_t { xtTargetFlagsNonVisibleRegs =3D 0x0001, xtTargetFlagsUseFetchStore =3D 0x0002, -} xtensa_target_flags_t; +}; =20 =20 /* Mask. */ @@ -143,11 +143,11 @@ typedef struct =20 /* Call-ABI for stack frame. */ =20 -typedef enum=20 +enum call_abi_t { CallAbiDefault =3D 0, /* Any 'callX' instructions; default stack. */ CallAbiCall0Only, /* Only 'call0' instructions; flat stack. */ -} call_abi_t; +}; =20 =20 struct ctype_cache