From 69f6730df3d18216126283864246eaf538bdf91d Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 18 Oct 2023 20:44:11 -0600 Subject: Remove gdb_static_assert C++17 makes the second parameter to static_assert optional, so we can remove gdb_static_assert now. --- gdbsupport/gdb_assert.h | 5 ----- gdbsupport/packed.h | 16 ++++++++-------- gdbsupport/pathstuff.h | 2 +- 3 files changed, 9 insertions(+), 14 deletions(-) (limited to 'gdbsupport') 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() 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::value); + static_assert (std::is_trivially_copyable::value); #endif - gdb_static_assert (std::is_copy_constructible::value); - gdb_static_assert (std::is_move_constructible::value); - gdb_static_assert (std::is_copy_assignable::value); - gdb_static_assert (std::is_move_assignable::value); + static_assert (std::is_copy_constructible::value); + static_assert (std::is_move_constructible::value); + static_assert (std::is_copy_assignable::value); + static_assert (std::is_move_assignable::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 path_array { paths... }; -- cgit v1.1