@@ -161,7 +161,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 = ptid_get_lwp (regcache_get_ptid (regcache));
@@ -199,7 +199,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 = ptid_get_lwp (regcache_get_ptid (regcache));
iovec.iov_base = ®s;
@@ -242,7 +242,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 >= VFP_REGS_SIZE);
+ static_assert (sizeof regs >= VFP_REGS_SIZE, "");
tid = ptid_get_lwp (regcache_get_ptid (regcache));
@@ -290,7 +290,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 >= VFP_REGS_SIZE);
+ static_assert (sizeof regs >= VFP_REGS_SIZE, "");
tid = ptid_get_lwp (regcache_get_ptid (regcache));
iovec.iov_base = ®s;
@@ -190,7 +190,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. */
@@ -19,12 +19,6 @@
#ifndef GDB_ASSERT_H
#define GDB_ASSERT_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) \
- extern int never_defined_just_used_for_checking[(expr) ? 1 : -1]
-
/* 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
@@ -223,7 +223,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), "");
enum precision_type
{
@@ -3062,7 +3062,7 @@ create_cus_from_index_list (struct objfile *objfile,
for (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);
@@ -3135,7 +3135,7 @@ create_signatured_type_table_from_index (struct objfile *objfile,
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
@@ -880,7 +880,7 @@ gdb_bfd_fdopenr (const char *filename, const char *target, int fd)
-gdb_static_assert (ARRAY_SIZE (_bfd_std_section) == 4);
+static_assert (ARRAY_SIZE (_bfd_std_section) == 4, "");
/* See gdb_bfd.h. */
@@ -21,7 +21,7 @@
#include "common-defs.h"
-gdb_static_assert (sizeof (CORE_ADDR) >= sizeof (void *));
+static_assert (sizeof (CORE_ADDR) >= sizeof (void *), "");
#ifdef __MINGW32CE__
#include "wincecompat.h"
@@ -107,24 +107,24 @@ static const gdb_byte i386fbsd_osigtramp_end[] =
};
/* The three different trampolines are all the same size. */
-gdb_static_assert (sizeof i386fbsd_sigtramp_start
- == sizeof i386fbsd_freebsd4_sigtramp_start);
-gdb_static_assert (sizeof i386fbsd_sigtramp_start
- == sizeof i386fbsd_osigtramp_start);
-gdb_static_assert (sizeof i386fbsd_sigtramp_middle
- == sizeof i386fbsd_freebsd4_sigtramp_middle);
-gdb_static_assert (sizeof i386fbsd_sigtramp_middle
- == sizeof i386fbsd_osigtramp_middle);
-gdb_static_assert (sizeof i386fbsd_sigtramp_end
- == sizeof i386fbsd_freebsd4_sigtramp_end);
-gdb_static_assert (sizeof i386fbsd_sigtramp_end
- == sizeof i386fbsd_osigtramp_end);
+static_assert (sizeof i386fbsd_sigtramp_start
+ == sizeof i386fbsd_freebsd4_sigtramp_start, "");
+static_assert (sizeof i386fbsd_sigtramp_start
+ == sizeof i386fbsd_osigtramp_start, "");
+static_assert (sizeof i386fbsd_sigtramp_middle
+ == sizeof i386fbsd_freebsd4_sigtramp_middle, "");
+static_assert (sizeof i386fbsd_sigtramp_middle
+ == sizeof i386fbsd_osigtramp_middle, "");
+static_assert (sizeof i386fbsd_sigtramp_end
+ == sizeof i386fbsd_freebsd4_sigtramp_end, "");
+static_assert (sizeof i386fbsd_sigtramp_end
+ == sizeof i386fbsd_osigtramp_end, "");
/* We assume that the middle is the largest chunk below. */
-gdb_static_assert (sizeof i386fbsd_sigtramp_middle
- > sizeof i386fbsd_sigtramp_start);
-gdb_static_assert (sizeof i386fbsd_sigtramp_middle
- > sizeof i386fbsd_sigtramp_end);
+static_assert (sizeof i386fbsd_sigtramp_middle
+ > sizeof i386fbsd_sigtramp_start, "");
+static_assert (sizeof i386fbsd_sigtramp_middle
+ > sizeof i386fbsd_sigtramp_end, "");
static int
i386fbsd_sigtramp_p (struct frame_info *this_frame)
@@ -1008,7 +1008,7 @@ linux_core_info_proc_mappings (struct gdbarch *gdbarch, const char *args)
unsigned int addr_size_bits, addr_size;
struct gdbarch *core_gdbarch = gdbarch_from_bfd (core_bfd);
/* We assume this for reading 64-bit core files. */
- gdb_static_assert (sizeof (ULONGEST) >= 8);
+ static_assert (sizeof (ULONGEST) >= 8, "");
section = bfd_get_section_by_name (core_bfd, ".note.linuxcore.file");
if (section == NULL)
@@ -42,8 +42,8 @@ static const char * const async_reason_string_lookup[] =
NULL
};
-gdb_static_assert (ARRAY_SIZE (async_reason_string_lookup)
- == EXEC_ASYNC_LAST + 1);
+static_assert (ARRAY_SIZE (async_reason_string_lookup)
+ == EXEC_ASYNC_LAST + 1, "");
const char *
async_reason_lookup (enum async_reply_reason reason)
@@ -587,10 +587,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, "");
@@ -138,7 +138,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. */
@@ -50,7 +50,7 @@ static struct notif_client *notifs[] =
¬if_client_stop,
};
-gdb_static_assert (ARRAY_SIZE (notifs) == REMOTE_NOTIF_LAST);
+static_assert (ARRAY_SIZE (notifs) == REMOTE_NOTIF_LAST, "");
static void do_notif_event_xfree (void *arg);
@@ -57,9 +57,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. */
@@ -5681,7 +5681,7 @@ const struct symbol_impl *symbol_impls = &symbol_impl[0];
/* 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
@@ -592,7 +592,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
@@ -749,7 +749,7 @@ typedef enum domain_enum_tag
/* 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);
@@ -892,7 +892,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.
@@ -964,7 +964,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. */