aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-10-18 20:44:11 -0600
committerTom Tromey <tom@tromey.com>2023-11-29 14:29:44 -0700
commit69f6730df3d18216126283864246eaf538bdf91d (patch)
treee17002e214e8d6d2ea423575e29b56f90005b778 /gdbsupport
parentd02f31bb130fd54fa2891cbc28fbc01f603eca6c (diff)
downloadgdb-69f6730df3d18216126283864246eaf538bdf91d.zip
gdb-69f6730df3d18216126283864246eaf538bdf91d.tar.gz
gdb-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.
Diffstat (limited to 'gdbsupport')
-rw-r--r--gdbsupport/gdb_assert.h5
-rw-r--r--gdbsupport/packed.h16
-rw-r--r--gdbsupport/pathstuff.h2
3 files changed, 9 insertions, 14 deletions
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... };