diff options
author | Martin Liška <mliska@suse.cz> | 2022-05-05 14:18:58 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-05-09 14:09:01 +0200 |
commit | 73a8dce44b39e073cb74fdcb383c35795bacd42d (patch) | |
tree | 31d69c49986a1aaa55c02deba87aa37ec591a9c5 /gcc | |
parent | 1fffe45fb5497006d7bc7875bd932c9bd9670cb6 (diff) | |
download | gcc-73a8dce44b39e073cb74fdcb383c35795bacd42d.zip gcc-73a8dce44b39e073cb74fdcb383c35795bacd42d.tar.gz gcc-73a8dce44b39e073cb74fdcb383c35795bacd42d.tar.bz2 |
Simplify STATIC_ASSERT macro.
For C++, use always __static_assert and for C, use the negative array
index.
gcc/ChangeLog:
* basic-block.h (STATIC_ASSERT): Use normal STATIC_ASSERT.
* system.h (STATIC_ASSERT): Define as static_assert for C++
and fallback to array index in C.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/basic-block.h | 5 | ||||
-rw-r--r-- | gcc/system.h | 3 |
2 files changed, 2 insertions, 6 deletions
diff --git a/gcc/basic-block.h b/gcc/basic-block.h index e3fff1f..21a9b24 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -158,10 +158,7 @@ struct GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb"))) basic_block_d /* This ensures that struct gimple_bb_info is smaller than struct rtl_bb_info, so that inlining the former into basic_block_def is the better choice. */ -typedef int __assert_gimple_bb_smaller_rtl_bb - [(int) sizeof (struct rtl_bb_info) - - (int) sizeof (struct gimple_bb_info)]; - +STATIC_ASSERT (sizeof (rtl_bb_info) >= sizeof (gimple_bb_info)); #define BB_FREQ_MAX 10000 diff --git a/gcc/system.h b/gcc/system.h index 1121af4..1c783c5 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -835,8 +835,7 @@ extern void fancy_abort (const char *, int, const char *) #define STATIC_CONSTANT_P(X) (false && (X)) #endif -/* static_assert (COND, MESSAGE) is available in C++11 onwards. */ -#if __cplusplus >= 201103L +#ifdef __cplusplus #define STATIC_ASSERT(X) \ static_assert ((X), #X) #else |