diff options
author | Tom Tromey <tom@tromey.com> | 2023-10-18 20:44:11 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-11-29 14:29:44 -0700 |
commit | 69f6730df3d18216126283864246eaf538bdf91d (patch) | |
tree | e17002e214e8d6d2ea423575e29b56f90005b778 | |
parent | d02f31bb130fd54fa2891cbc28fbc01f603eca6c (diff) | |
download | binutils-69f6730df3d18216126283864246eaf538bdf91d.zip binutils-69f6730df3d18216126283864246eaf538bdf91d.tar.gz binutils-69f6730df3d18216126283864246eaf538bdf91d.tar.bz2 |
Remove gdb_static_assert
C++17 makes the second parameter to static_assert optional, so we can
remove gdb_static_assert now.
50 files changed, 106 insertions, 111 deletions
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index 0e87aaa..5b4e3c2 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -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; diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index ba37b49..4a7ce68 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -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 diff --git a/gdb/addrmap.c b/gdb/addrmap.c index 076062a..b108880 100644 --- a/gdb/addrmap.c +++ b/gdb/addrmap.c @@ -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. */ diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 9fb9735..0d3a495 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -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]; } diff --git a/gdb/arc-linux-tdep.c b/gdb/arc-linux-tdep.c index 8c0f7ae..33dabc7 100644 --- a/gdb/arc-linux-tdep.c +++ b/gdb/arc-linux-tdep.c @@ -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; diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c index a22b5bf..44e26ae 100644 --- a/gdb/arc-tdep.c +++ b/gdb/arc-tdep.c @@ -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. */ diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 598d740..be06010 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -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]; } diff --git a/gdb/bpf-tdep.c b/gdb/bpf-tdep.c index 97a6d75..d2b0d3f 100644 --- a/gdb/bpf-tdep.c +++ b/gdb/bpf-tdep.c @@ -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]; } diff --git a/gdb/charset.c b/gdb/charset.c index bce6050..ac2613f 100644 --- a/gdb/charset.c +++ b/gdb/charset.c @@ -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 diff --git a/gdb/command.h b/gdb/command.h index 1ab953b..9d84957 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -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); diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 9847516..783042a 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -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) diff --git a/gdb/disasm.c b/gdb/disasm.c index 82b7e99..32eabb7 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -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 (); diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c index 7788626..da180fa 100644 --- a/gdb/dwarf2/read-gdb-index.c +++ b/gdb/dwarf2/read-gdb-index.c @@ -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 diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 468e76d..9311666 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -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)) diff --git a/gdb/f-array-walker.h b/gdb/f-array-walker.h index 5696367..de40837 100644 --- a/gdb/f-array-walker.h +++ b/gdb/f-array-walker.h @@ -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 diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c index cac4b9b..8ec0aab 100644 --- a/gdb/ft32-tdep.c +++ b/gdb/ft32-tdep.c @@ -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]; } diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c index b72821f..1c496c4 100644 --- a/gdb/gdb_bfd.c +++ b/gdb/gdb_bfd.c @@ -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. */ diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index c9452a1..32793aa 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -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]; } diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c index d4509f9..48316e7 100644 --- a/gdb/iq2000-tdep.c +++ b/gdb/iq2000-tdep.c @@ -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]; } diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 5fd64aa..82e8bc3 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -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 diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c index 0eecdb6..6744ba9 100644 --- a/gdb/lm32-tdep.c +++ b/gdb/lm32-tdep.c @@ -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]; } diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index ba52599..dfb2fdf 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -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]; } diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 5b2a29a..0b761d0 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -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 ""; diff --git a/gdb/mi/mi-common.c b/gdb/mi/mi-common.c index ce70d11..1c1424a 100644 --- a/gdb/mi/mi-common.c +++ b/gdb/mi/mi-common.c @@ -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 * diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c index 74e7040..e975b7c 100644 --- a/gdb/microblaze-tdep.c +++ b/gdb/microblaze-tdep.c @@ -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]; } diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c index 600fb06..14d20be 100644 --- a/gdb/moxie-tdep.c +++ b/gdb/moxie-tdep.c @@ -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]; } diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c index f65948f..c03e12c 100644 --- a/gdb/msp430-tdep.c +++ b/gdb/msp430-tdep.c @@ -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]; } diff --git a/gdb/nat/amd64-linux-siginfo.c b/gdb/nat/amd64-linux-siginfo.c index 00bb5e5..0de370d 100644 --- a/gdb/nat/amd64-linux-siginfo.c +++ b/gdb/nat/amd64-linux-siginfo.c @@ -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); diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c index 40d65b6..91c0389 100644 --- a/gdb/nios2-tdep.c +++ b/gdb/nios2-tdep.c @@ -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. */ diff --git a/gdb/remote-notif.c b/gdb/remote-notif.c index dfa1d33..997b6e7 100644 --- a/gdb/remote-notif.c +++ b/gdb/remote-notif.c @@ -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. */ diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 8849483..2b4b9e2 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -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; diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c index 8ec6119..d35d45c 100644 --- a/gdb/symfile-mem.c +++ b/gdb/symfile-mem.c @@ -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. */ diff --git a/gdb/symtab.c b/gdb/symtab.c index 1547155..9fd886c 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -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 diff --git a/gdb/symtab.h b/gdb/symtab.h index ec2ac49..c224f47 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -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. diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c index 1ec37d4..d2140ad 100644 --- a/gdb/tilegx-tdep.c +++ b/gdb/tilegx-tdep.c @@ -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]; } diff --git a/gdb/trad-frame.c b/gdb/trad-frame.c index 6dc7e9a..755d3b9 100644 --- a/gdb/trad-frame.c +++ b/gdb/trad-frame.c @@ -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); diff --git a/gdb/unittests/enum-flags-selftests.c b/gdb/unittests/enum-flags-selftests.c index 2d3c555..460cb7f 100644 --- a/gdb/unittests/enum-flags-selftests.c +++ b/gdb/unittests/enum-flags-selftests.c @@ -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 diff --git a/gdb/unittests/packed-selftests.c b/gdb/unittests/packed-selftests.c index c5dd843..797a453 100644 --- a/gdb/unittests/packed-selftests.c +++ b/gdb/unittests/packed-selftests.c @@ -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); - -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 (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); + +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) \ diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 2405368..f93d57d 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -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]; } diff --git a/gdb/value.c b/gdb/value.c index b4da967..1a39855 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -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. */ diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index 0f92a46..54f7dd1 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -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]; } diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index c65cdb8..ee25896 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -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. */ diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 3f47c8d..27be5af 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -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]; } diff --git a/gdbserver/i387-fp.cc b/gdbserver/i387-fp.cc index 27f8e2d..f3457a8 100644 --- a/gdbserver/i387-fp.cc +++ b/gdbserver/i387-fp.cc @@ -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) diff --git a/gdbserver/server.cc b/gdbserver/server.cc index f91f70d..d73d637 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -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 ()) \ diff --git a/gdbserver/server.h b/gdbserver/server.h index 306d75d..2bca471 100644 --- a/gdbserver/server.h +++ b/gdbserver/server.h @@ -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" diff --git a/gdbsupport/gdb_assert.h b/gdbsupport/gdb_assert.h index f399036..e5da39e 100644 --- a/gdbsupport/gdb_assert.h +++ b/gdbsupport/gdb_assert.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 diff --git a/gdbsupport/packed.h b/gdbsupport/packed.h index c9fcc50..9407b59 100644 --- a/gdbsupport/packed.h +++ b/gdbsupport/packed.h @@ -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 diff --git a/gdbsupport/pathstuff.h b/gdbsupport/pathstuff.h index b22a521..4a0a19e 100644 --- a/gdbsupport/pathstuff.h +++ b/gdbsupport/pathstuff.h @@ -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... }; |