[v2,13/21] libcc1: use static_assert

Message ID 20210428010119.806184-14-tom@tromey.com
State New
Headers show
Series
  • C++11-based improvements for libcc1
Related show

Commit Message

Tom Tromey April 28, 2021, 1:01 a.m.
This changes one spot in libcc1 to use static_assert rather than the
old-style array declaration.

libcc1/ChangeLog
2021-04-27  Tom Tromey  <tom@tromey.com>

	* libcp1plugin.cc: Use static assert.
---
 libcc1/ChangeLog       | 4 ++++
 libcc1/libcp1plugin.cc | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

-- 
2.26.2

Comments

apinski--- via Gcc-patches April 28, 2021, 4:06 p.m. | #1
On 4/27/2021 7:01 PM, Tom Tromey wrote:
> This changes one spot in libcc1 to use static_assert rather than the

> old-style array declaration.

>

> libcc1/ChangeLog

> 2021-04-27  Tom Tromey  <tom@tromey.com>

>

> 	* libcp1plugin.cc: Use static assert.


OK

jeff

Patch

diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc
index 3cbad5c6f021..ba6c5ef2efce 100644
--- a/libcc1/libcp1plugin.cc
+++ b/libcc1/libcp1plugin.cc
@@ -82,8 +82,8 @@  int plugin_is_GPL_compatible;
 
 
 
-static int ATTRIBUTE_UNUSED
-check_symbol_mask[GCC_CP_SYMBOL_MASK >= GCC_CP_SYMBOL_END ? 1 : -1];
+static_assert (GCC_CP_SYMBOL_MASK >= GCC_CP_SYMBOL_END,
+	       "GCC_CP_SYMBOL_MASK >= GCC_CP_SYMBOL_END");
 
 // This is put into the lang hooks when the plugin starts.