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 /gdb/unittests | |
parent | d02f31bb130fd54fa2891cbc28fbc01f603eca6c (diff) | |
download | fsf-binutils-gdb-69f6730df3d18216126283864246eaf538bdf91d.zip fsf-binutils-gdb-69f6730df3d18216126283864246eaf538bdf91d.tar.gz fsf-binutils-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 'gdb/unittests')
-rw-r--r-- | gdb/unittests/enum-flags-selftests.c | 46 | ||||
-rw-r--r-- | gdb/unittests/packed-selftests.c | 18 |
2 files changed, 32 insertions, 32 deletions
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) \ |