Remove gdb_static_assert
C++17 makes the second parameter to static_assert optional, so we can remove gdb_static_assert now.
This commit is contained in:
parent
d02f31bb13
commit
69f6730df3
@ -137,7 +137,7 @@ fetch_gregs_from_thread (struct regcache *regcache)
|
||||
|
||||
/* Make sure REGS can hold all registers contents on both aarch64
|
||||
and arm. */
|
||||
gdb_static_assert (sizeof (regs) >= 18 * 4);
|
||||
static_assert (sizeof (regs) >= 18 * 4);
|
||||
|
||||
tid = regcache->ptid ().lwp ();
|
||||
|
||||
@ -175,7 +175,7 @@ store_gregs_to_thread (const struct regcache *regcache)
|
||||
|
||||
/* Make sure REGS can hold all registers contents on both aarch64
|
||||
and arm. */
|
||||
gdb_static_assert (sizeof (regs) >= 18 * 4);
|
||||
static_assert (sizeof (regs) >= 18 * 4);
|
||||
tid = regcache->ptid ().lwp ();
|
||||
|
||||
iovec.iov_base = ®s;
|
||||
@ -217,7 +217,7 @@ fetch_fpregs_from_thread (struct regcache *regcache)
|
||||
|
||||
/* Make sure REGS can hold all VFP registers contents on both aarch64
|
||||
and arm. */
|
||||
gdb_static_assert (sizeof regs >= ARM_VFP3_REGS_SIZE);
|
||||
static_assert (sizeof regs >= ARM_VFP3_REGS_SIZE);
|
||||
|
||||
tid = regcache->ptid ().lwp ();
|
||||
|
||||
@ -264,7 +264,7 @@ store_fpregs_to_thread (const struct regcache *regcache)
|
||||
|
||||
/* Make sure REGS can hold all VFP registers contents on both aarch64
|
||||
and arm. */
|
||||
gdb_static_assert (sizeof regs >= ARM_VFP3_REGS_SIZE);
|
||||
static_assert (sizeof regs >= ARM_VFP3_REGS_SIZE);
|
||||
tid = regcache->ptid ().lwp ();
|
||||
|
||||
iovec.iov_base = ®s;
|
||||
|
@ -3113,7 +3113,7 @@ aarch64_pseudo_read_value_1 (struct gdbarch *gdbarch,
|
||||
|
||||
/* Enough space for a full vector register. */
|
||||
gdb_byte reg_buf[register_size (gdbarch, AARCH64_V0_REGNUM)];
|
||||
gdb_static_assert (AARCH64_V0_REGNUM == AARCH64_SVE_Z0_REGNUM);
|
||||
static_assert (AARCH64_V0_REGNUM == AARCH64_SVE_Z0_REGNUM);
|
||||
|
||||
if (regcache->raw_read (v_regnum, reg_buf) != REG_VALID)
|
||||
result_value->mark_bytes_unavailable (0,
|
||||
@ -3323,7 +3323,7 @@ aarch64_pseudo_write_1 (struct gdbarch *gdbarch, struct regcache *regcache,
|
||||
|
||||
/* Enough space for a full vector register. */
|
||||
gdb_byte reg_buf[register_size (gdbarch, AARCH64_V0_REGNUM)];
|
||||
gdb_static_assert (AARCH64_V0_REGNUM == AARCH64_SVE_Z0_REGNUM);
|
||||
static_assert (AARCH64_V0_REGNUM == AARCH64_SVE_Z0_REGNUM);
|
||||
|
||||
/* Ensure the register buffer is zero, we want gdb writes of the
|
||||
various 'scalar' pseudo registers to behavior like architectural
|
||||
|
@ -24,8 +24,8 @@
|
||||
|
||||
/* Make sure splay trees can actually hold the values we want to
|
||||
store in them. */
|
||||
gdb_static_assert (sizeof (splay_tree_key) >= sizeof (CORE_ADDR *));
|
||||
gdb_static_assert (sizeof (splay_tree_value) >= sizeof (void *));
|
||||
static_assert (sizeof (splay_tree_key) >= sizeof (CORE_ADDR *));
|
||||
static_assert (sizeof (splay_tree_value) >= sizeof (void *));
|
||||
|
||||
|
||||
/* Fixed address maps. */
|
||||
|
@ -98,7 +98,7 @@ alpha_register_name (struct gdbarch *gdbarch, int regno)
|
||||
"pc", "", "unique"
|
||||
};
|
||||
|
||||
gdb_static_assert (ALPHA_NUM_REGS == ARRAY_SIZE (register_names));
|
||||
static_assert (ALPHA_NUM_REGS == ARRAY_SIZE (register_names));
|
||||
return register_names[regno];
|
||||
}
|
||||
|
||||
|
@ -549,7 +549,7 @@ arc_linux_supply_gregset (const struct regset *regset,
|
||||
struct regcache *regcache,
|
||||
int regnum, const void *gregs, size_t size)
|
||||
{
|
||||
gdb_static_assert (ARC_LAST_REGNUM
|
||||
static_assert (ARC_LAST_REGNUM
|
||||
< ARRAY_SIZE (arc_linux_core_reg_offsets));
|
||||
|
||||
const bfd_byte *buf = (const bfd_byte *) gregs;
|
||||
@ -612,7 +612,7 @@ arc_linux_collect_gregset (const struct regset *regset,
|
||||
const struct regcache *regcache,
|
||||
int regnum, void *gregs, size_t size)
|
||||
{
|
||||
gdb_static_assert (ARC_LAST_REGNUM
|
||||
static_assert (ARC_LAST_REGNUM
|
||||
< ARRAY_SIZE (arc_linux_core_reg_offsets));
|
||||
|
||||
gdb_byte *buf = (gdb_byte *) gregs;
|
||||
|
@ -344,7 +344,7 @@ arc_insn_get_operand_value_signed (const struct arc_instruction &insn,
|
||||
/* Convert unsigned raw value to signed one. This assumes 2's
|
||||
complement arithmetic, but so is the LONG_MIN value from generic
|
||||
defs.h and that assumption is true for ARC. */
|
||||
gdb_static_assert (sizeof (insn.limm_value) == sizeof (int));
|
||||
static_assert (sizeof (insn.limm_value) == sizeof (int));
|
||||
return (((LONGEST) insn.limm_value) ^ INT_MIN) - INT_MIN;
|
||||
case ARC_OPERAND_KIND_SHIMM:
|
||||
/* Sign conversion has been done by binutils. */
|
||||
|
@ -216,7 +216,7 @@ avr_register_name (struct gdbarch *gdbarch, int regnum)
|
||||
"SREG", "SP", "PC2",
|
||||
"pc"
|
||||
};
|
||||
gdb_static_assert (ARRAY_SIZE (register_names)
|
||||
static_assert (ARRAY_SIZE (register_names)
|
||||
== (AVR_NUM_REGS + AVR_NUM_PSEUDO_REGS));
|
||||
return register_names[regnum];
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ static const char *bpf_register_names[] =
|
||||
static const char *
|
||||
bpf_register_name (struct gdbarch *gdbarch, int reg)
|
||||
{
|
||||
gdb_static_assert (ARRAY_SIZE (bpf_register_names) == BPF_NUM_REGS);
|
||||
static_assert (ARRAY_SIZE (bpf_register_names) == BPF_NUM_REGS);
|
||||
return bpf_register_names[reg];
|
||||
}
|
||||
|
||||
|
@ -939,7 +939,7 @@ default_auto_wide_charset (void)
|
||||
|
||||
/* GDB cannot handle strings correctly if this size is different. */
|
||||
|
||||
gdb_static_assert (sizeof (gdb_wchar_t) == 2 || sizeof (gdb_wchar_t) == 4);
|
||||
static_assert (sizeof (gdb_wchar_t) == 2 || sizeof (gdb_wchar_t) == 4);
|
||||
|
||||
/* intermediate_encoding returns the charset used internally by
|
||||
GDB to convert between target and host encodings. As the test above
|
||||
|
@ -292,8 +292,8 @@ struct setting
|
||||
/* Getters and setters are cast to and from the arbitrary `void (*) ()`
|
||||
function pointer type. Make sure that the two types are really of the
|
||||
same size. */
|
||||
gdb_static_assert (sizeof (m_getter) == sizeof (getter));
|
||||
gdb_static_assert (sizeof (m_setter) == sizeof (setter));
|
||||
static_assert (sizeof (m_getter) == sizeof (getter));
|
||||
static_assert (sizeof (m_setter) == sizeof (setter));
|
||||
|
||||
m_getter = reinterpret_cast<erased_func> (getter);
|
||||
m_setter = reinterpret_cast<erased_func> (setter);
|
||||
|
@ -1669,7 +1669,7 @@ cris_register_name (struct gdbarch *gdbarch, int regno)
|
||||
if (regno < NUM_GENREGS)
|
||||
{
|
||||
/* General register. */
|
||||
gdb_static_assert (ARRAY_SIZE (cris_genreg_names) == NUM_GENREGS);
|
||||
static_assert (ARRAY_SIZE (cris_genreg_names) == NUM_GENREGS);
|
||||
return cris_genreg_names[regno];
|
||||
}
|
||||
else if (regno >= NUM_GENREGS && regno < gdbarch_num_regs (gdbarch))
|
||||
|
@ -229,7 +229,7 @@ enum language
|
||||
/* The number of bits needed to represent all languages, with enough
|
||||
padding to allow for reasonable growth. */
|
||||
#define LANGUAGE_BITS 5
|
||||
gdb_static_assert (nr_languages <= (1 << LANGUAGE_BITS));
|
||||
static_assert (nr_languages <= (1 << LANGUAGE_BITS));
|
||||
|
||||
/* The number of bytes needed to represent all languages. */
|
||||
#define LANGUAGE_BYTES ((LANGUAGE_BITS + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT)
|
||||
|
@ -1149,7 +1149,7 @@ gdb_disassembler::print_insn (CORE_ADDR memaddr,
|
||||
To do this we perform an in-place new, but this time turn on
|
||||
the styling support, then we can re-disassembly the
|
||||
instruction, and gain any minimal styling GDB might add. */
|
||||
gdb_static_assert ((std::is_same<decltype (m_buffer),
|
||||
static_assert ((std::is_same<decltype (m_buffer),
|
||||
string_file>::value));
|
||||
gdb_assert (!m_buffer.term_out ());
|
||||
m_buffer.~string_file ();
|
||||
|
@ -648,7 +648,7 @@ create_cus_from_gdb_index_list (dwarf2_per_bfd *per_bfd,
|
||||
{
|
||||
for (offset_type i = 0; i < n_elements; i += 2)
|
||||
{
|
||||
gdb_static_assert (sizeof (ULONGEST) >= 8);
|
||||
static_assert (sizeof (ULONGEST) >= 8);
|
||||
|
||||
sect_offset sect_off
|
||||
= (sect_offset) extract_unsigned_integer (cu_list, 8, BFD_ENDIAN_LITTLE);
|
||||
@ -700,7 +700,7 @@ create_signatured_type_table_from_gdb_index
|
||||
void **slot;
|
||||
cu_offset type_offset_in_tu;
|
||||
|
||||
gdb_static_assert (sizeof (ULONGEST) >= 8);
|
||||
static_assert (sizeof (ULONGEST) >= 8);
|
||||
sect_offset sect_off
|
||||
= (sect_offset) extract_unsigned_integer (bytes, 8, BFD_ENDIAN_LITTLE);
|
||||
type_offset_in_tu
|
||||
|
@ -10287,7 +10287,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
|
||||
/* We never call the destructor of call_site, so we must ensure it is
|
||||
trivially destructible. */
|
||||
gdb_static_assert(std::is_trivially_destructible<struct call_site>::value);
|
||||
static_assert(std::is_trivially_destructible<struct call_site>::value);
|
||||
|
||||
if (dwarf2_flag_true_p (die, DW_AT_call_tail_call, cu)
|
||||
|| dwarf2_flag_true_p (die, DW_AT_GNU_tail_call, cu))
|
||||
|
@ -187,7 +187,7 @@ class fortran_array_walker
|
||||
/* Ensure that Impl is derived from the required base class. This just
|
||||
ensures that all of the required API methods are available and have a
|
||||
sensible default implementation. */
|
||||
gdb_static_assert ((std::is_base_of<fortran_array_walker_base_impl,Impl>::value));
|
||||
static_assert ((std::is_base_of<fortran_array_walker_base_impl,Impl>::value));
|
||||
|
||||
public:
|
||||
/* Create a new array walker. TYPE is the type of the array being walked
|
||||
|
@ -96,7 +96,7 @@ static const char *const ft32_register_names[] =
|
||||
static const char *
|
||||
ft32_register_name (struct gdbarch *gdbarch, int reg_nr)
|
||||
{
|
||||
gdb_static_assert (ARRAY_SIZE (ft32_register_names) == FT32_NUM_REGS);
|
||||
static_assert (ARRAY_SIZE (ft32_register_names) == FT32_NUM_REGS);
|
||||
return ft32_register_names[reg_nr];
|
||||
}
|
||||
|
||||
|
@ -977,7 +977,7 @@ gdb_bfd_record_inclusion (bfd *includer, bfd *includee)
|
||||
|
||||
|
||||
|
||||
gdb_static_assert (ARRAY_SIZE (_bfd_std_section) == 4);
|
||||
static_assert (ARRAY_SIZE (_bfd_std_section) == 4);
|
||||
|
||||
/* See gdb_bfd.h. */
|
||||
|
||||
|
@ -632,7 +632,7 @@ hppa32_register_name (struct gdbarch *gdbarch, int i)
|
||||
"fr28", "fr28R", "fr29", "fr29R",
|
||||
"fr30", "fr30R", "fr31", "fr31R"
|
||||
};
|
||||
gdb_static_assert (ARRAY_SIZE (names) == hppa32_num_regs);
|
||||
static_assert (ARRAY_SIZE (names) == hppa32_num_regs);
|
||||
return names[i];
|
||||
}
|
||||
|
||||
@ -665,7 +665,7 @@ hppa64_register_name (struct gdbarch *gdbarch, int i)
|
||||
"fr24", "fr25", "fr26", "fr27",
|
||||
"fr28", "fr29", "fr30", "fr31"
|
||||
};
|
||||
gdb_static_assert (ARRAY_SIZE (names) == hppa64_num_regs);
|
||||
static_assert (ARRAY_SIZE (names) == hppa64_num_regs);
|
||||
return names[i];
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ iq2000_register_name (struct gdbarch *gdbarch, int regnum)
|
||||
"r30", "r31",
|
||||
"pc"
|
||||
};
|
||||
gdb_static_assert (ARRAY_SIZE (names) == E_NUM_REGS);
|
||||
static_assert (ARRAY_SIZE (names) == E_NUM_REGS);
|
||||
return names[regnum];
|
||||
}
|
||||
|
||||
|
@ -1129,7 +1129,7 @@ linux_read_core_file_mappings
|
||||
read_core_file_mappings_loop_ftype loop_cb)
|
||||
{
|
||||
/* Ensure that ULONGEST is big enough for reading 64-bit core files. */
|
||||
gdb_static_assert (sizeof (ULONGEST) >= 8);
|
||||
static_assert (sizeof (ULONGEST) >= 8);
|
||||
|
||||
/* It's not required that the NT_FILE note exists, so return silently
|
||||
if it's not found. Beyond this point though, we'll complain
|
||||
|
@ -91,7 +91,7 @@ lm32_register_name (struct gdbarch *gdbarch, int reg_nr)
|
||||
"PC", "EID", "EBA", "DEBA", "IE", "IM", "IP"
|
||||
};
|
||||
|
||||
gdb_static_assert (ARRAY_SIZE (register_names) == SIM_LM32_NUM_REGS);
|
||||
static_assert (ARRAY_SIZE (register_names) == SIM_LM32_NUM_REGS);
|
||||
return register_names[reg_nr];
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ static const char * const m32r_register_names[] = {
|
||||
static const char *
|
||||
m32r_register_name (struct gdbarch *gdbarch, int reg_nr)
|
||||
{
|
||||
gdb_static_assert (ARRAY_SIZE (m32r_register_names) == M32R_NUM_REGS);
|
||||
static_assert (ARRAY_SIZE (m32r_register_names) == M32R_NUM_REGS);
|
||||
return m32r_register_names[reg_nr];
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ m68k_register_name (struct gdbarch *gdbarch, int regnum)
|
||||
{
|
||||
m68k_gdbarch_tdep *tdep = gdbarch_tdep<m68k_gdbarch_tdep> (gdbarch);
|
||||
|
||||
gdb_static_assert (ARRAY_SIZE (m68k_register_names) == M68K_NUM_REGS);
|
||||
static_assert (ARRAY_SIZE (m68k_register_names) == M68K_NUM_REGS);
|
||||
if (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FPI_REGNUM
|
||||
&& tdep->fpregs_present == 0)
|
||||
return "";
|
||||
|
@ -43,7 +43,7 @@ static const char * const async_reason_string_lookup[] =
|
||||
NULL
|
||||
};
|
||||
|
||||
gdb_static_assert (ARRAY_SIZE (async_reason_string_lookup)
|
||||
static_assert (ARRAY_SIZE (async_reason_string_lookup)
|
||||
== EXEC_ASYNC_LAST + 1);
|
||||
|
||||
const char *
|
||||
|
@ -92,7 +92,7 @@ static unsigned int microblaze_debug_flag = 0;
|
||||
static const char *
|
||||
microblaze_register_name (struct gdbarch *gdbarch, int regnum)
|
||||
{
|
||||
gdb_static_assert (ARRAY_SIZE (microblaze_register_names)
|
||||
static_assert (ARRAY_SIZE (microblaze_register_names)
|
||||
== MICROBLAZE_NUM_REGS);
|
||||
return microblaze_register_names[regnum];
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ static const char * const moxie_register_names[] = {
|
||||
static const char *
|
||||
moxie_register_name (struct gdbarch *gdbarch, int reg_nr)
|
||||
{
|
||||
gdb_static_assert (ARRAY_SIZE (moxie_register_names) == MOXIE_NUM_REGS);
|
||||
static_assert (ARRAY_SIZE (moxie_register_names) == MOXIE_NUM_REGS);
|
||||
return moxie_register_names[reg_nr];
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ msp430_register_name (struct gdbarch *gdbarch, int regnr)
|
||||
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
|
||||
};
|
||||
|
||||
gdb_static_assert (ARRAY_SIZE (reg_names) == (MSP430_NUM_REGS
|
||||
static_assert (ARRAY_SIZE (reg_names) == (MSP430_NUM_REGS
|
||||
+ MSP430_NUM_PSEUDO_REGS));
|
||||
return reg_names[regnr];
|
||||
}
|
||||
|
@ -604,10 +604,10 @@ amd64_linux_siginfo_fixup_common (siginfo_t *ptrace, gdb_byte *inf,
|
||||
|
||||
/* Sanity check for the siginfo structure sizes. */
|
||||
|
||||
gdb_static_assert (sizeof (siginfo_t) == GDB_SI_SIZE);
|
||||
static_assert (sizeof (siginfo_t) == GDB_SI_SIZE);
|
||||
#ifndef __ILP32__
|
||||
gdb_static_assert (sizeof (nat_siginfo_t) == GDB_SI_SIZE);
|
||||
static_assert (sizeof (nat_siginfo_t) == GDB_SI_SIZE);
|
||||
#endif
|
||||
gdb_static_assert (sizeof (compat_x32_siginfo_t) == GDB_SI_SIZE);
|
||||
gdb_static_assert (sizeof (compat_siginfo_t) == GDB_SI_SIZE);
|
||||
gdb_static_assert (sizeof (ptrace_siginfo_t) == GDB_SI_SIZE);
|
||||
static_assert (sizeof (compat_x32_siginfo_t) == GDB_SI_SIZE);
|
||||
static_assert (sizeof (compat_siginfo_t) == GDB_SI_SIZE);
|
||||
static_assert (sizeof (ptrace_siginfo_t) == GDB_SI_SIZE);
|
||||
|
@ -140,7 +140,7 @@ static int nios2_dwarf2gdb_regno_map[] =
|
||||
NIOS2_MPUACC_REGNUM /* 48 */
|
||||
};
|
||||
|
||||
gdb_static_assert (ARRAY_SIZE (nios2_dwarf2gdb_regno_map) == NIOS2_NUM_REGS);
|
||||
static_assert (ARRAY_SIZE (nios2_dwarf2gdb_regno_map) == NIOS2_NUM_REGS);
|
||||
|
||||
/* Implement the dwarf2_reg_to_regnum gdbarch method. */
|
||||
|
||||
|
@ -51,7 +51,7 @@ static const notif_client *const notifs[] =
|
||||
¬if_client_stop,
|
||||
};
|
||||
|
||||
gdb_static_assert (ARRAY_SIZE (notifs) == REMOTE_NOTIF_LAST);
|
||||
static_assert (ARRAY_SIZE (notifs) == REMOTE_NOTIF_LAST);
|
||||
|
||||
/* Parse the BUF for the expected notification NC, and send packet to
|
||||
acknowledge. */
|
||||
|
@ -441,7 +441,7 @@ struct riscv_freg_feature : public riscv_register_feature
|
||||
RISCV_LAST_FP_REGNUM. */
|
||||
const char *register_name (int regnum) const
|
||||
{
|
||||
gdb_static_assert (RISCV_LAST_FP_REGNUM == RISCV_FIRST_FP_REGNUM + 31);
|
||||
static_assert (RISCV_LAST_FP_REGNUM == RISCV_FIRST_FP_REGNUM + 31);
|
||||
gdb_assert (regnum >= RISCV_FIRST_FP_REGNUM
|
||||
&& regnum <= RISCV_LAST_FP_REGNUM);
|
||||
regnum -= RISCV_FIRST_FP_REGNUM;
|
||||
|
@ -58,9 +58,9 @@
|
||||
/* Verify parameters of target_read_memory_bfd and target_read_memory are
|
||||
compatible. */
|
||||
|
||||
gdb_static_assert (sizeof (CORE_ADDR) >= sizeof (bfd_vma));
|
||||
gdb_static_assert (sizeof (gdb_byte) == sizeof (bfd_byte));
|
||||
gdb_static_assert (sizeof (ssize_t) <= sizeof (bfd_size_type));
|
||||
static_assert (sizeof (CORE_ADDR) >= sizeof (bfd_vma));
|
||||
static_assert (sizeof (gdb_byte) == sizeof (bfd_byte));
|
||||
static_assert (sizeof (ssize_t) <= sizeof (bfd_size_type));
|
||||
|
||||
/* Provide bfd/ compatible prototype for target_read_memory. Casting would not
|
||||
be enough as LEN width may differ. */
|
||||
|
@ -6392,7 +6392,7 @@ gdb::array_view<const struct symbol_impl> symbol_impls (symbol_impl);
|
||||
|
||||
/* Make sure we saved enough room in struct symbol. */
|
||||
|
||||
gdb_static_assert (MAX_SYMBOL_IMPLS <= (1 << SYMBOL_ACLASS_BITS));
|
||||
static_assert (MAX_SYMBOL_IMPLS <= (1 << SYMBOL_ACLASS_BITS));
|
||||
|
||||
/* Register a computed symbol type. ACLASS must be LOC_COMPUTED. OPS
|
||||
is the ops vector associated with this index. This returns the new
|
||||
|
@ -706,7 +706,7 @@ enum minimal_symbol_type
|
||||
/* The number of enum minimal_symbol_type values, with some padding for
|
||||
reasonable growth. */
|
||||
#define MINSYM_TYPE_BITS 4
|
||||
gdb_static_assert (nr_minsym_types <= (1 << MINSYM_TYPE_BITS));
|
||||
static_assert (nr_minsym_types <= (1 << MINSYM_TYPE_BITS));
|
||||
|
||||
/* Define a simple structure used to hold some very basic information about
|
||||
all defined global symbols (text, data, bss, abs, etc). The only required
|
||||
@ -924,7 +924,7 @@ enum domain_enum
|
||||
/* The number of bits in a symbol used to represent the domain. */
|
||||
|
||||
#define SYMBOL_DOMAIN_BITS 3
|
||||
gdb_static_assert (NR_DOMAINS <= (1 << SYMBOL_DOMAIN_BITS));
|
||||
static_assert (NR_DOMAINS <= (1 << SYMBOL_DOMAIN_BITS));
|
||||
|
||||
extern const char *domain_name (domain_enum);
|
||||
|
||||
@ -1070,7 +1070,7 @@ enum address_class
|
||||
verify that we have reserved enough space for synthetic address
|
||||
classes. */
|
||||
#define SYMBOL_ACLASS_BITS 5
|
||||
gdb_static_assert (LOC_FINAL_VALUE <= (1 << SYMBOL_ACLASS_BITS));
|
||||
static_assert (LOC_FINAL_VALUE <= (1 << SYMBOL_ACLASS_BITS));
|
||||
|
||||
/* The methods needed to implement LOC_COMPUTED. These methods can
|
||||
use the symbol's .aux_value for additional per-symbol information.
|
||||
|
@ -155,7 +155,7 @@ tilegx_register_name (struct gdbarch *gdbarch, int regnum)
|
||||
"pc", "faultnum",
|
||||
};
|
||||
|
||||
gdb_static_assert (TILEGX_NUM_REGS == ARRAY_SIZE (register_names));
|
||||
static_assert (TILEGX_NUM_REGS == ARRAY_SIZE (register_names));
|
||||
return register_names[regnum];
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ trad_frame_saved_reg *
|
||||
trad_frame_alloc_saved_regs (struct gdbarch *gdbarch)
|
||||
{
|
||||
#ifdef HAVE_IS_TRIVIALLY_CONSTRUCTIBLE
|
||||
gdb_static_assert (std::is_trivially_constructible<trad_frame_saved_reg>::value);
|
||||
static_assert (std::is_trivially_constructible<trad_frame_saved_reg>::value);
|
||||
#endif
|
||||
|
||||
int numregs = gdbarch_num_cooked_regs (gdbarch);
|
||||
|
@ -67,7 +67,7 @@ DEF_ENUM_FLAGS_TYPE (URE, UEF);
|
||||
|
||||
/* So that std::vectors of types that have enum_flags fields can
|
||||
reallocate efficiently memcpy. */
|
||||
gdb_static_assert (std::is_trivially_copyable<EF>::value);
|
||||
static_assert (std::is_trivially_copyable<EF>::value);
|
||||
|
||||
#endif
|
||||
|
||||
@ -407,7 +407,7 @@ self_test ()
|
||||
{
|
||||
constexpr test_flags f;
|
||||
|
||||
gdb_static_assert (f == 0);
|
||||
static_assert (f == 0);
|
||||
}
|
||||
|
||||
/* Check that assignment from zero works. */
|
||||
@ -428,16 +428,16 @@ self_test ()
|
||||
constexpr test_flags zero3 {0};
|
||||
constexpr test_flags zero4 = {0};
|
||||
|
||||
gdb_static_assert (zero1 == 0);
|
||||
gdb_static_assert (zero2 == 0);
|
||||
gdb_static_assert (zero3 == 0);
|
||||
gdb_static_assert (zero4 == 0);
|
||||
static_assert (zero1 == 0);
|
||||
static_assert (zero2 == 0);
|
||||
static_assert (zero3 == 0);
|
||||
static_assert (zero4 == 0);
|
||||
}
|
||||
|
||||
/* Check construction from enum value. */
|
||||
{
|
||||
gdb_static_assert (test_flags (FLAG1) == FLAG1);
|
||||
gdb_static_assert (test_flags (FLAG2) != FLAG1);
|
||||
static_assert (test_flags (FLAG1) == FLAG1);
|
||||
static_assert (test_flags (FLAG2) != FLAG1);
|
||||
}
|
||||
|
||||
/* Check copy/assignment. */
|
||||
@ -449,10 +449,10 @@ self_test ()
|
||||
constexpr test_flags f3 {src};
|
||||
constexpr test_flags f4 = {src};
|
||||
|
||||
gdb_static_assert (f1 == FLAG1);
|
||||
gdb_static_assert (f2 == FLAG1);
|
||||
gdb_static_assert (f3 == FLAG1);
|
||||
gdb_static_assert (f4 == FLAG1);
|
||||
static_assert (f1 == FLAG1);
|
||||
static_assert (f2 == FLAG1);
|
||||
static_assert (f3 == FLAG1);
|
||||
static_assert (f4 == FLAG1);
|
||||
}
|
||||
|
||||
/* Check moving. */
|
||||
@ -470,7 +470,7 @@ self_test ()
|
||||
to test_flags would fail. */
|
||||
{
|
||||
constexpr test_flags f = FLAG1 | FLAG2;
|
||||
gdb_static_assert (f == (FLAG1 | FLAG2));
|
||||
static_assert (f == (FLAG1 | FLAG2));
|
||||
}
|
||||
|
||||
/* Similarly, check that "FLAG1 | FLAG2" on the rhs of an assignment
|
||||
@ -492,8 +492,8 @@ self_test ()
|
||||
constexpr int some_bits (FLAG1 | FLAG2);
|
||||
|
||||
/* And comparison with int works too. */
|
||||
gdb_static_assert (some_bits == (FLAG1 | FLAG2));
|
||||
gdb_static_assert (some_bits == test_flags (FLAG1 | FLAG2));
|
||||
static_assert (some_bits == (FLAG1 | FLAG2));
|
||||
static_assert (some_bits == test_flags (FLAG1 | FLAG2));
|
||||
}
|
||||
|
||||
/* Check operator| and operator|=. Particularly interesting is
|
||||
@ -536,7 +536,7 @@ self_test ()
|
||||
/* Check the ^/^= operators. */
|
||||
{
|
||||
constexpr test_flags f = FLAG1 ^ FLAG2;
|
||||
gdb_static_assert (f == (FLAG1 ^ FLAG2));
|
||||
static_assert (f == (FLAG1 ^ FLAG2));
|
||||
}
|
||||
|
||||
{
|
||||
@ -554,7 +554,7 @@ self_test ()
|
||||
{
|
||||
constexpr test_uflags f1 = ~UFLAG1;
|
||||
constexpr test_uflags f2 = ~f1;
|
||||
gdb_static_assert (f2 == UFLAG1);
|
||||
static_assert (f2 == UFLAG1);
|
||||
}
|
||||
|
||||
/* Check the ternary operator. */
|
||||
@ -562,18 +562,18 @@ self_test ()
|
||||
{
|
||||
/* raw enum, raw enum */
|
||||
constexpr test_flags f1 = true ? FLAG1 : FLAG2;
|
||||
gdb_static_assert (f1 == FLAG1);
|
||||
static_assert (f1 == FLAG1);
|
||||
constexpr test_flags f2 = false ? FLAG1 : FLAG2;
|
||||
gdb_static_assert (f2 == FLAG2);
|
||||
static_assert (f2 == FLAG2);
|
||||
}
|
||||
|
||||
{
|
||||
/* enum flags, raw enum */
|
||||
constexpr test_flags src = FLAG1;
|
||||
constexpr test_flags f1 = true ? src : FLAG2;
|
||||
gdb_static_assert (f1 == FLAG1);
|
||||
static_assert (f1 == FLAG1);
|
||||
constexpr test_flags f2 = false ? src : FLAG2;
|
||||
gdb_static_assert (f2 == FLAG2);
|
||||
static_assert (f2 == FLAG2);
|
||||
}
|
||||
|
||||
{
|
||||
@ -581,9 +581,9 @@ self_test ()
|
||||
constexpr test_flags src1 = FLAG1;
|
||||
constexpr test_flags src2 = FLAG2;
|
||||
constexpr test_flags f1 = true ? src1 : src2;
|
||||
gdb_static_assert (f1 == src1);
|
||||
static_assert (f1 == src1);
|
||||
constexpr test_flags f2 = false ? src1 : src2;
|
||||
gdb_static_assert (f2 == src2);
|
||||
static_assert (f2 == src2);
|
||||
}
|
||||
|
||||
/* Check that we can use flags in switch expressions (requires
|
||||
|
@ -32,15 +32,15 @@ enum test_enum
|
||||
TE_D = 4,
|
||||
};
|
||||
|
||||
gdb_static_assert (sizeof (packed<test_enum, 1>) == 1);
|
||||
gdb_static_assert (sizeof (packed<test_enum, 2>) == 2);
|
||||
gdb_static_assert (sizeof (packed<test_enum, 3>) == 3);
|
||||
gdb_static_assert (sizeof (packed<test_enum, 4>) == 4);
|
||||
static_assert (sizeof (packed<test_enum, 1>) == 1);
|
||||
static_assert (sizeof (packed<test_enum, 2>) == 2);
|
||||
static_assert (sizeof (packed<test_enum, 3>) == 3);
|
||||
static_assert (sizeof (packed<test_enum, 4>) == 4);
|
||||
|
||||
gdb_static_assert (alignof (packed<test_enum, 1>) == 1);
|
||||
gdb_static_assert (alignof (packed<test_enum, 2>) == 1);
|
||||
gdb_static_assert (alignof (packed<test_enum, 3>) == 1);
|
||||
gdb_static_assert (alignof (packed<test_enum, 4>) == 1);
|
||||
static_assert (alignof (packed<test_enum, 1>) == 1);
|
||||
static_assert (alignof (packed<test_enum, 2>) == 1);
|
||||
static_assert (alignof (packed<test_enum, 3>) == 1);
|
||||
static_assert (alignof (packed<test_enum, 4>) == 1);
|
||||
|
||||
/* Triviality checks. */
|
||||
#define CHECK_TRAIT(TRAIT) \
|
||||
|
@ -312,7 +312,7 @@ v850_register_name (struct gdbarch *gdbarch, int regnum)
|
||||
"sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31",
|
||||
"pc", "fp"
|
||||
};
|
||||
gdb_static_assert (E_NUM_OF_V850_REGS == ARRAY_SIZE (v850_reg_names));
|
||||
static_assert (E_NUM_OF_V850_REGS == ARRAY_SIZE (v850_reg_names));
|
||||
return v850_reg_names[regnum];
|
||||
}
|
||||
|
||||
@ -331,7 +331,7 @@ v850e_register_name (struct gdbarch *gdbarch, int regnum)
|
||||
"sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31",
|
||||
"pc", "fp"
|
||||
};
|
||||
gdb_static_assert (E_NUM_OF_V850E_REGS == ARRAY_SIZE (v850e_reg_names));
|
||||
static_assert (E_NUM_OF_V850E_REGS == ARRAY_SIZE (v850e_reg_names));
|
||||
return v850e_reg_names[regnum];
|
||||
}
|
||||
|
||||
@ -477,7 +477,7 @@ v850e3v5_register_name (struct gdbarch *gdbarch, int regnum)
|
||||
"vr24", "vr25", "vr26", "vr27", "vr28", "vr29", "vr30", "vr31",
|
||||
};
|
||||
|
||||
gdb_static_assert (E_NUM_OF_V850E3V5_REGS
|
||||
static_assert (E_NUM_OF_V850E3V5_REGS
|
||||
== ARRAY_SIZE (v850e3v5_reg_names));
|
||||
return v850e3v5_reg_names[regnum];
|
||||
}
|
||||
|
@ -762,7 +762,7 @@ static int max_value_size = 65536; /* 64k bytes */
|
||||
is bigger than LONGEST on all GDB supported hosts we're fine. */
|
||||
|
||||
#define MIN_VALUE_FOR_MAX_VALUE_SIZE 16
|
||||
gdb_static_assert (sizeof (LONGEST) <= MIN_VALUE_FOR_MAX_VALUE_SIZE);
|
||||
static_assert (sizeof (LONGEST) <= MIN_VALUE_FOR_MAX_VALUE_SIZE);
|
||||
|
||||
/* Implement the "set max-value-size" command. */
|
||||
|
||||
|
@ -45,7 +45,7 @@ vax_register_name (struct gdbarch *gdbarch, int regnum)
|
||||
"ps",
|
||||
};
|
||||
|
||||
gdb_static_assert (VAX_NUM_REGS == ARRAY_SIZE (register_names));
|
||||
static_assert (VAX_NUM_REGS == ARRAY_SIZE (register_names));
|
||||
return register_names[regnum];
|
||||
}
|
||||
|
||||
|
@ -975,7 +975,7 @@ struct pe_import_directory_entry
|
||||
uint32_t import_address_table_rva;
|
||||
};
|
||||
|
||||
gdb_static_assert (sizeof (pe_import_directory_entry) == 20);
|
||||
static_assert (sizeof (pe_import_directory_entry) == 20);
|
||||
|
||||
/* See windows-tdep.h. */
|
||||
|
||||
|
@ -108,7 +108,7 @@ xstormy16_register_name (struct gdbarch *gdbarch, int regnum)
|
||||
"psw", "sp", "pc"
|
||||
};
|
||||
|
||||
gdb_static_assert (ARRAY_SIZE (register_names) == E_NUM_REGS);
|
||||
static_assert (ARRAY_SIZE (register_names) == E_NUM_REGS);
|
||||
return register_names[regnum];
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ struct i387_fxsave
|
||||
unsigned char xmm_space[256];
|
||||
};
|
||||
|
||||
gdb_static_assert (sizeof(i387_fxsave) == 416);
|
||||
static_assert (sizeof(i387_fxsave) == 416);
|
||||
|
||||
struct i387_xsave : public i387_fxsave
|
||||
{
|
||||
@ -147,7 +147,7 @@ public:
|
||||
{ return xsave () + xsave_layout.pkru_offset; }
|
||||
};
|
||||
|
||||
gdb_static_assert (sizeof(i387_xsave) == 576);
|
||||
static_assert (sizeof(i387_xsave) == 576);
|
||||
|
||||
void
|
||||
i387_cache_to_fsave (struct regcache *regcache, void *buf)
|
||||
|
@ -55,7 +55,7 @@
|
||||
/* PBUFSIZ must also be at least as big as IPA_CMD_BUF_SIZE, because
|
||||
the client state data is passed directly to some agent
|
||||
functions. */
|
||||
gdb_static_assert (PBUFSIZ >= IPA_CMD_BUF_SIZE);
|
||||
static_assert (PBUFSIZ >= IPA_CMD_BUF_SIZE);
|
||||
|
||||
#define require_running_or_return(BUF) \
|
||||
if (!target_running ()) \
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
gdb_static_assert (sizeof (CORE_ADDR) >= sizeof (void *));
|
||||
static_assert (sizeof (CORE_ADDR) >= sizeof (void *));
|
||||
|
||||
#include "gdbsupport/version.h"
|
||||
|
||||
|
@ -21,11 +21,6 @@
|
||||
|
||||
#include "errors.h"
|
||||
|
||||
/* A static assertion. This will cause a compile-time error if EXPR,
|
||||
which must be a compile-time constant, is false. */
|
||||
|
||||
#define gdb_static_assert(expr) static_assert (expr, "")
|
||||
|
||||
/* PRAGMATICS: "gdb_assert.h":gdb_assert() is a lower case (rather
|
||||
than upper case) macro since that provides the closest fit to the
|
||||
existing lower case macro <assert.h>:assert() that it is
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
|
||||
packed (T val)
|
||||
{
|
||||
gdb_static_assert (sizeof (ULONGEST) >= sizeof (T));
|
||||
static_assert (sizeof (ULONGEST) >= sizeof (T));
|
||||
|
||||
#if PACKED_USE_ARRAY
|
||||
ULONGEST tmp = val;
|
||||
@ -76,17 +76,17 @@ public:
|
||||
#endif
|
||||
|
||||
/* Ensure size and aligment are what we expect. */
|
||||
gdb_static_assert (sizeof (packed) == Bytes);
|
||||
gdb_static_assert (alignof (packed) == 1);
|
||||
static_assert (sizeof (packed) == Bytes);
|
||||
static_assert (alignof (packed) == 1);
|
||||
|
||||
/* Make sure packed can be wrapped with std::atomic. */
|
||||
#if HAVE_IS_TRIVIALLY_COPYABLE
|
||||
gdb_static_assert (std::is_trivially_copyable<packed>::value);
|
||||
static_assert (std::is_trivially_copyable<packed>::value);
|
||||
#endif
|
||||
gdb_static_assert (std::is_copy_constructible<packed>::value);
|
||||
gdb_static_assert (std::is_move_constructible<packed>::value);
|
||||
gdb_static_assert (std::is_copy_assignable<packed>::value);
|
||||
gdb_static_assert (std::is_move_assignable<packed>::value);
|
||||
static_assert (std::is_copy_constructible<packed>::value);
|
||||
static_assert (std::is_move_constructible<packed>::value);
|
||||
static_assert (std::is_copy_assignable<packed>::value);
|
||||
static_assert (std::is_move_assignable<packed>::value);
|
||||
}
|
||||
|
||||
operator T () const noexcept
|
||||
|
@ -76,7 +76,7 @@ std::string
|
||||
path_join (Args... paths)
|
||||
{
|
||||
/* It doesn't make sense to join less than two paths. */
|
||||
gdb_static_assert (sizeof... (Args) >= 2);
|
||||
static_assert (sizeof... (Args) >= 2);
|
||||
|
||||
std::array<const char *, sizeof... (Args)> path_array
|
||||
{ paths... };
|
||||
|
Loading…
x
Reference in New Issue
Block a user