Remove "typedef enum ..."

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.

Tested by rebuilding.
This commit is contained in:
Tom Tromey 2022-04-27 14:32:49 -06:00
parent c42dd30d73
commit 0d1703b8fb
14 changed files with 35 additions and 38 deletions

View file

@ -10701,18 +10701,18 @@ enum arm_record_result
ARM_RECORD_FAILURE = 1
};
typedef enum
enum arm_record_strx_t
{
ARM_RECORD_STRH=1,
ARM_RECORD_STRD
} arm_record_strx_t;
};
typedef enum
enum record_type_t
{
ARM_RECORD=1,
THUMB_RECORD,
THUMB2_RECORD
} record_type_t;
};
static int

View file

@ -197,12 +197,11 @@ create_fork_vfork_event_catchpoint (struct gdbarch *gdbarch,
install_breakpoint (0, std::move (c), 1);
}
typedef enum
enum catch_fork_kind
{
catch_fork_temporary, catch_vfork_temporary,
catch_fork_permanent, catch_vfork_permanent
}
catch_fork_kind;
};
static void
catch_fork_command_1 (const char *arg, int from_tty,

View file

@ -71,7 +71,7 @@ enum command_class
};
/* 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;
};
/* Return true if a setting of type VAR_TYPE is backed with type T.

View file

@ -1639,7 +1639,7 @@ yylex (void)
{
std::string tmp = copy_name (yylval.sval);
struct block_symbol result;
const enum domain_enum_tag lookup_domains[] =
const domain_enum lookup_domains[] =
{
STRUCT_DOMAIN,
VAR_DOMAIN,

View file

@ -75,7 +75,7 @@ static gdb::optional<gdb::byte_vector> ktab_buf;
/* An enumeration of the different IA-64 instruction types. */
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;
};
/* We represent IA-64 PC addresses as the value of the instruction
pointer or'd with some bit combination in the low nibble which

View file

@ -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. */
typedef enum
enum jit_actions_t
{
JIT_NOACTION = 0,
JIT_REGISTER,
JIT_UNREGISTER
} jit_actions_t;
};
/* This struct describes a single symbol file in a linked list of
symbol files describing generated code. As the inferior generates

View file

@ -228,7 +228,7 @@ struct symbol_searcher_collect_info
/* Token types */
enum ls_token_type
enum linespec_token_type
{
/* A keyword */
LSTOKEN_KEYWORD = 0,
@ -251,7 +251,6 @@ enum ls_token_type
/* Consumed token */
LSTOKEN_CONSUMED
};
typedef enum ls_token_type linespec_token_type;
/* List of keywords. This is NULL-terminated so that it can be used
as enum completer. */

View file

@ -129,12 +129,12 @@ struct pending_stop
DEBUG_EVENT event;
};
typedef enum
enum handle_exception_result
{
HANDLE_EXCEPTION_UNHANDLED = 0,
HANDLE_EXCEPTION_HANDLED,
HANDLE_EXCEPTION_IGNORED
} handle_exception_result;
};
/* A single Windows process. An object of this type (or subclass) is
created by the client. Some methods must be provided by the client

View file

@ -206,7 +206,7 @@ x86_get_debug_register_length ()
#define X86_DR_WATCH_HIT(dr6, i) ((dr6) & (1 << (i)))
/* 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 };
/* Print the values of the mirrored debug registers. */

View file

@ -71,7 +71,7 @@ struct partial_symbol
/* Name space code. */
ENUM_BITFIELD(domain_enum_tag) domain : SYMBOL_DOMAIN_BITS;
ENUM_BITFIELD(domain_enum) domain : SYMBOL_DOMAIN_BITS;
/* Address class (for info_symbols). Note that we don't allow
synthetic "aclass" values here at present, simply because there's

View file

@ -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. */
typedef enum
enum inferior_call_kind
{
/* Before the call */
INFERIOR_CALL_PRE,
/* after the call */
INFERIOR_CALL_POST,
} inferior_call_kind;
};
extern int emit_inferior_call_event (inferior_call_kind kind,
ptid_t thread, CORE_ADDR addr);

View file

@ -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. */
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
/* This must remain last. */
NR_DOMAINS
} domain_enum;
};
/* The number of bits in a symbol used to represent the domain. */
@ -1418,7 +1418,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
/* Domain code. */
ENUM_BITFIELD(domain_enum_tag) m_domain : SYMBOL_DOMAIN_BITS;
ENUM_BITFIELD(domain_enum) m_domain : SYMBOL_DOMAIN_BITS;
/* Address class. This holds an index into the 'symbol_impls'
table. The actual enum address_class value is stored there,

View file

@ -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
instruction decoding (libisa) from the semantics of prologue analysis. */
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;
};
/* Return true, if OPCNAME is RSR, WRS, or XSR instruction. */
@ -2753,12 +2753,12 @@ execute_s32e (struct gdbarch *gdbarch, int at, int as, int offset, CORE_ADDR wb)
#define XTENSA_MAX_WINDOW_INTERRUPT_HANDLER_LEN 200
typedef enum
enum xtensa_exception_handler_t
{
xtWindowOverflow,
xtWindowUnderflow,
xtNoExceptionHandler
} xtensa_exception_handler_t;
};
/* Execute instruction stream from current PC until hitting RFWU or RFWO.
Return type of Xtensa Window Interrupt Handler on success. */

View file

@ -31,7 +31,7 @@
/* Xtensa register type. */
typedef enum
enum xtensa_register_type_t
{
xtRegisterTypeArRegfile = 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;
};
/* Xtensa register group. */
#define XTENSA_MAX_COPROCESSOR 0x10 /* Number of Xtensa coprocessors. */
typedef enum
enum xtensa_register_group_t
{
xtRegisterGroupUnknown = 0,
xtRegisterGroupRegFile = 0x0001, /* Register files without ARx. */
@ -75,16 +75,16 @@ typedef enum
xtRegisterGroupCP6 = 0x40000000, /* CP6. */
xtRegisterGroupCP7 = 0x80000000, /* CP7. */
} xtensa_register_group_t;
};
/* Xtensa target flags. */
typedef enum
enum xtensa_target_flags_t
{
xtTargetFlagsNonVisibleRegs = 0x0001,
xtTargetFlagsUseFetchStore = 0x0002,
} xtensa_target_flags_t;
};
/* Mask. */
@ -143,11 +143,11 @@ typedef struct
/* Call-ABI for stack frame. */
typedef enum
enum call_abi_t
{
CallAbiDefault = 0, /* Any 'callX' instructions; default stack. */
CallAbiCall0Only, /* Only 'call0' instructions; flat stack. */
} call_abi_t;
};
struct ctype_cache