From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id D826E385E007; Thu, 5 May 2022 12:39:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D826E385E007 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/fold-GCC_VERSION-for-old)] Start using static_assert. X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/users/marxin/heads/fold-GCC_VERSION-for-old X-Git-Oldrev: 79b7dd219b6b0e2b8c9890ae03aab2d299ab9829 X-Git-Newrev: a610603daddd45de3a6a218006ffa6d1f8855e1c Message-Id: <20220505123907.D826E385E007@sourceware.org> Date: Thu, 5 May 2022 12:39:07 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 May 2022 12:39:08 -0000 https://gcc.gnu.org/g:a610603daddd45de3a6a218006ffa6d1f8855e1c commit a610603daddd45de3a6a218006ffa6d1f8855e1c Author: Martin Liska Date: Wed May 4 21:17:54 2022 +0200 Start using static_assert. As we require a c++11 compliant compiler, static_assert is always available. gcc/ChangeLog: * system.h (STATIC_ASSERT): Remove. * basic-block.h (STATIC_ASSERT): Use normal static_assert. gcc/ChangeLog: * basic-block.h (static_assert): Use static_assert directly. * bitmap.h (Traits>::base_bitmap_view): Likewise. * common/config/i386/i386-common.cc (STATIC_ASSERT): Likewise. (static_assert): Likewise. * config/aarch64/aarch64-sve-builtins-shapes.cc (struct binary_imm_narrowb_base): Likewise. (struct binary_imm_narrowt_base): Likewise. (struct unary_narrowb_base): Likewise. (struct unary_narrowt_base): Likewise. * config/i386/i386-builtins.cc (BDESC_VERIFYS): Likewise. * config/i386/i386-options.cc (STATIC_ASSERT): Likewise. (static_assert): Likewise. * config/i386/i386.h (STATIC_ASSERT): Likewise. (static_assert): Likewise. * dumpfile.cc (make_item_for_dump_dec): Likewise. * expmed.cc (make_tree): Likewise. * input.h (STATIC_ASSERT): Likewise. (static_assert): Likewise. * ira-build.cc (ira_conflict_vector_profitable_p): Likewise. * lto-streamer.h (STATIC_ASSERT): Likewise. (static_assert): Likewise. * lto-wrapper.cc: Likewise. * poly-int.h (C>::poly_int): Likewise. (maybe_eq): Likewise. (print_dec): Likewise. * profile-count.cc (profile_count::to_frequency): Likewise. * rtl.h (subreg_shape::unique_id): Likewise. * system.h (STATIC_ASSERT): Likewise. * tree.h (TYPE_VECTOR_SUBPARTS): Likewise. (SET_TYPE_VECTOR_SUBPARTS): Likewise. * wide-int.h (wide_int_storage::wide_int_storage): Likewise. (wide_int_storage>::get_binary_result): Likewise. (N>::set_len): Likewise. (wi::mask): Likewise. (wi::shifted_mask): Likewise. gcc/c-family/ChangeLog: * c-omp.cc (c_omp_split_clauses): Use static_assert directly. gcc/cp/ChangeLog: * cp-tree.h (STATIC_ASSERT): Use static_assert directly. gcc/fortran/ChangeLog: * openmp.cc (resolve_omp_clauses): Use static_assert directly. Diff: --- gcc/basic-block.h | 5 +---- gcc/bitmap.h | 2 +- gcc/c-family/c-omp.cc | 2 +- gcc/common/config/i386/i386-common.cc | 2 +- gcc/config/aarch64/aarch64-sve-builtins-shapes.cc | 8 ++++---- gcc/config/i386/i386-builtins.cc | 2 +- gcc/config/i386/i386-options.cc | 2 +- gcc/config/i386/i386.h | 2 +- gcc/cp/cp-tree.h | 2 +- gcc/dumpfile.cc | 2 +- gcc/expmed.cc | 2 +- gcc/fortran/openmp.cc | 2 +- gcc/input.h | 2 +- gcc/ira-build.cc | 2 +- gcc/lto-streamer.h | 2 +- gcc/lto-wrapper.cc | 2 +- gcc/poly-int.h | 10 +++++----- gcc/profile-count.cc | 2 +- gcc/rtl.h | 6 +++--- gcc/system.h | 9 --------- gcc/tree.h | 4 ++-- gcc/wide-int.h | 18 +++++++++--------- 22 files changed, 39 insertions(+), 51 deletions(-) diff --git a/gcc/basic-block.h b/gcc/basic-block.h index e3fff1f6975..fe81b6d90cc 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/bitmap.h b/gcc/bitmap.h index e7bf67a5474..3c61c6dcfb7 100644 --- a/gcc/bitmap.h +++ b/gcc/bitmap.h @@ -1005,7 +1005,7 @@ base_bitmap_view::base_bitmap_view (const T &array, /* The code currently assumes that each element of ARRAY corresponds to exactly one bitmap_element. */ const size_t array_element_bits = CHAR_BIT * sizeof (array_element_type); - STATIC_ASSERT (BITMAP_ELEMENT_ALL_BITS % array_element_bits == 0); + static_assert (BITMAP_ELEMENT_ALL_BITS % array_element_bits == 0); size_t array_step = BITMAP_ELEMENT_ALL_BITS / array_element_bits; size_t array_size = Traits::size (array); diff --git a/gcc/c-family/c-omp.cc b/gcc/c-family/c-omp.cc index 777cdc65572..e7a5d0a18af 100644 --- a/gcc/c-family/c-omp.cc +++ b/gcc/c-family/c-omp.cc @@ -2589,7 +2589,7 @@ c_omp_split_clauses (location_t loc, enum tree_code code, continue; break; case C_OMP_CLAUSE_SPLIT_FOR: - STATIC_ASSERT (C_OMP_CLAUSE_SPLIT_SECTIONS + static_assert (C_OMP_CLAUSE_SPLIT_SECTIONS == C_OMP_CLAUSE_SPLIT_FOR && (C_OMP_CLAUSE_SPLIT_TASKLOOP == C_OMP_CLAUSE_SPLIT_FOR) diff --git a/gcc/common/config/i386/i386-common.cc b/gcc/common/config/i386/i386-common.cc index 07fdd045f30..e4d30e95817 100644 --- a/gcc/common/config/i386/i386-common.cc +++ b/gcc/common/config/i386/i386-common.cc @@ -1834,7 +1834,7 @@ const char *const processor_names[] = }; /* Guarantee that the array is aligned with enum processor_type. */ -STATIC_ASSERT (ARRAY_SIZE (processor_names) == PROCESSOR_max); +static_assert (ARRAY_SIZE (processor_names) == PROCESSOR_max); const pta processor_alias_table[] = { diff --git a/gcc/config/aarch64/aarch64-sve-builtins-shapes.cc b/gcc/config/aarch64/aarch64-sve-builtins-shapes.cc index f57f926980d..7f951ef196e 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins-shapes.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins-shapes.cc @@ -506,7 +506,7 @@ struct binary_imm_narrowb_base : public overloaded_base<0> build (function_builder &b, const function_group_info &group) const OVERRIDE { b.add_overloaded_functions (group, MODE_n); - STATIC_ASSERT (CLASS == function_resolver::SAME_TYPE_CLASS + static_assert (CLASS == function_resolver::SAME_TYPE_CLASS || CLASS == TYPE_unsigned); if (CLASS == TYPE_unsigned) build_all (b, "vhu0,v0,su64", group, MODE_n); @@ -531,7 +531,7 @@ struct binary_imm_narrowt_base : public overloaded_base<0> build (function_builder &b, const function_group_info &group) const OVERRIDE { b.add_overloaded_functions (group, MODE_n); - STATIC_ASSERT (CLASS == function_resolver::SAME_TYPE_CLASS + static_assert (CLASS == function_resolver::SAME_TYPE_CLASS || CLASS == TYPE_unsigned); if (CLASS == TYPE_unsigned) build_all (b, "vhu0,vhu0,v0,su64", group, MODE_n); @@ -969,7 +969,7 @@ struct unary_narrowb_base : public overloaded_base<0> build (function_builder &b, const function_group_info &group) const OVERRIDE { b.add_overloaded_functions (group, MODE_none); - STATIC_ASSERT (CLASS == function_resolver::SAME_TYPE_CLASS + static_assert (CLASS == function_resolver::SAME_TYPE_CLASS || CLASS == TYPE_unsigned); if (CLASS == TYPE_unsigned) build_all (b, "vhu0,v0", group, MODE_none); @@ -994,7 +994,7 @@ struct unary_narrowt_base : public overloaded_base<0> build (function_builder &b, const function_group_info &group) const OVERRIDE { b.add_overloaded_functions (group, MODE_none); - STATIC_ASSERT (CLASS == function_resolver::SAME_TYPE_CLASS + static_assert (CLASS == function_resolver::SAME_TYPE_CLASS || CLASS == TYPE_unsigned); if (CLASS == TYPE_unsigned) build_all (b, "vhu0,vhu0,v0", group, MODE_none); diff --git a/gcc/config/i386/i386-builtins.cc b/gcc/config/i386/i386-builtins.cc index 8c6d0fe9631..5e87b6d34e8 100644 --- a/gcc/config/i386/i386-builtins.cc +++ b/gcc/config/i386/i386-builtins.cc @@ -100,7 +100,7 @@ along with GCC; see the file COPYING3. If not see #define BDESC_VERIFY(x, y, z) \ gcc_checking_assert ((x) == (enum ix86_builtins) ((y) + (z))) #define BDESC_VERIFYS(x, y, z) \ - STATIC_ASSERT ((x) == (enum ix86_builtins) ((y) + (z))) + static_assert ((x) == (enum ix86_builtins) ((y) + (z))) BDESC_VERIFYS (IX86_BUILTIN__BDESC_PCMPESTR_FIRST, IX86_BUILTIN__BDESC_COMI_LAST, 1); diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc index 32cc58a764b..1a2ae620169 100644 --- a/gcc/config/i386/i386-options.cc +++ b/gcc/config/i386/i386-options.cc @@ -772,7 +772,7 @@ static const struct processor_costs *processor_cost_table[] = }; /* Guarantee that the array is aligned with enum processor_type. */ -STATIC_ASSERT (ARRAY_SIZE (processor_cost_table) == PROCESSOR_max); +static_assert (ARRAY_SIZE (processor_cost_table) == PROCESSOR_max); static bool ix86_option_override_internal (bool main_args_p, diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 363082ba47b..709805132d7 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2274,7 +2274,7 @@ enum pta_flag }; /* wide_int_bitmask can handle only 128 flags. */ -STATIC_ASSERT (END_PTA <= 128); +static_assert (END_PTA <= 128); #define WIDE_INT_BITMASK_FROM_NTH(N) (N < 64 ? wide_int_bitmask (0, 1ULL << N) \ : wide_int_bitmask (1ULL << (N - 64), 0)) diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index e9c3cf2bad0..be1fd3ad5c9 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -6084,7 +6084,7 @@ enum ovl_op_code { }; /* Make sure it fits in lang_decl_fn::ovl_op_code. */ -STATIC_ASSERT (OVL_OP_MAX < (1 << 6)); +static_assert (OVL_OP_MAX < (1 << 6)); struct GTY(()) ovl_op_info_t { /* The IDENTIFIER_NODE for the operator. */ diff --git a/gcc/dumpfile.cc b/gcc/dumpfile.cc index ac79aa09245..69eae7b141d 100644 --- a/gcc/dumpfile.cc +++ b/gcc/dumpfile.cc @@ -1038,7 +1038,7 @@ template static optinfo_item * make_item_for_dump_dec (const poly_int &value) { - STATIC_ASSERT (poly_coeff_traits::signedness >= 0); + static_assert (poly_coeff_traits::signedness >= 0); signop sgn = poly_coeff_traits::signedness ? SIGNED : UNSIGNED; pretty_printer pp; diff --git a/gcc/expmed.cc b/gcc/expmed.cc index ed39c88bd04..98aa2ca49ce 100644 --- a/gcc/expmed.cc +++ b/gcc/expmed.cc @@ -5348,7 +5348,7 @@ make_tree (tree type, rtx x) return t; case CONST_DOUBLE: - STATIC_ASSERT (HOST_BITS_PER_WIDE_INT * 2 <= MAX_BITSIZE_MODE_ANY_INT); + static_assert (HOST_BITS_PER_WIDE_INT * 2 <= MAX_BITSIZE_MODE_ANY_INT); if (TARGET_SUPPORTS_WIDE_INT == 0 && GET_MODE (x) == VOIDmode) t = wide_int_to_tree (type, wide_int::from_array (&CONST_DOUBLE_LOW (x), 2, diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc index 714148138c2..2bd2814b00f 100644 --- a/gcc/fortran/openmp.cc +++ b/gcc/fortran/openmp.cc @@ -6283,7 +6283,7 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses, "DEVICE_RESIDENT", "LINK", "USE_DEVICE", "CACHE", "IS_DEVICE_PTR", "USE_DEVICE_PTR", "USE_DEVICE_ADDR", "NONTEMPORAL", "ALLOCATE", "HAS_DEVICE_ADDR" }; - STATIC_ASSERT (ARRAY_SIZE (clause_names) == OMP_LIST_NUM); + static_assert (ARRAY_SIZE (clause_names) == OMP_LIST_NUM); if (omp_clauses == NULL) return; diff --git a/gcc/input.h b/gcc/input.h index f1ae3aec95c..b69339ae488 100644 --- a/gcc/input.h +++ b/gcc/input.h @@ -34,7 +34,7 @@ extern GTY(()) class line_maps *saved_line_table; /* line-map.cc reserves RESERVED_LOCATION_COUNT to the user. Ensure both UNKNOWN_LOCATION and BUILTINS_LOCATION fit into that. */ -STATIC_ASSERT (BUILTINS_LOCATION < RESERVED_LOCATION_COUNT); +static_assert (BUILTINS_LOCATION < RESERVED_LOCATION_COUNT); /* Hasher for 'location_t' values satisfying '!RESERVED_LOCATION_P', thus able to use 'UNKNOWN_LOCATION'/'BUILTINS_LOCATION' as spare values for diff --git a/gcc/ira-build.cc b/gcc/ira-build.cc index 3bf117cbf8e..bdec10beab8 100644 --- a/gcc/ira-build.cc +++ b/gcc/ira-build.cc @@ -640,7 +640,7 @@ ira_conflict_vector_profitable_p (ira_object_t obj, int num) return false; nbytes = (max - min) / 8 + 1; - STATIC_ASSERT (sizeof (ira_object_t) <= 8); + static_assert (sizeof (ira_object_t) <= 8); /* Don't use sizeof (ira_object_t), use constant 8. Size of ira_object_t (a pointer) is different on 32-bit and 64-bit targets. Usage sizeof (ira_object_t) can result in different code generation by GCC built as 32- diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h index 597e9e405ec..61bf46b78f6 100644 --- a/gcc/lto-streamer.h +++ b/gcc/lto-streamer.h @@ -388,7 +388,7 @@ struct lto_section } }; -STATIC_ASSERT (sizeof (lto_section) == 8); +static_assert (sizeof (lto_section) == 8); /* The is the first part of the record in an LTO file for many of the IPA passes. */ diff --git a/gcc/lto-wrapper.cc b/gcc/lto-wrapper.cc index 285e6e96af5..62bb910c236 100644 --- a/gcc/lto-wrapper.cc +++ b/gcc/lto-wrapper.cc @@ -1248,7 +1248,7 @@ static cpuset_popcount (unsigned long cpusetsize, cpu_set_t *cpusetp) #endif size_t i; unsigned long ret = 0; - STATIC_ASSERT (sizeof (cpusetp->__bits[0]) == sizeof (unsigned long int)); + static_assert (sizeof (cpusetp->__bits[0]) == sizeof (unsigned long int)); for (i = 0; i < cpusetsize / sizeof (cpusetp->__bits[0]); i++) { unsigned long int mask = cpusetp->__bits[i]; diff --git a/gcc/poly-int.h b/gcc/poly-int.h index 2bf9d98599f..b8cfa310401 100644 --- a/gcc/poly-int.h +++ b/gcc/poly-int.h @@ -677,7 +677,7 @@ template inline poly_int::poly_int (const C0 &c0, const C1 &c1) { - STATIC_ASSERT (N >= 2); + static_assert (N >= 2); POLY_SET_COEFF (C, *this, 0, c0); POLY_SET_COEFF (C, *this, 1, c1); for (unsigned int i = 2; i < N; i++) @@ -1225,7 +1225,7 @@ template inline bool maybe_eq (const poly_int_pod &a, const poly_int_pod &b) { - STATIC_ASSERT (N <= 2); + static_assert (N <= 2); if (N == 2) return maybe_eq_2 (a.coeffs[0], a.coeffs[1], b.coeffs[0], b.coeffs[1]); return a.coeffs[0] == b.coeffs[0]; @@ -1235,7 +1235,7 @@ template inline typename if_nonpoly::type maybe_eq (const poly_int_pod &a, const Cb &b) { - STATIC_ASSERT (N <= 2); + static_assert (N <= 2); if (N == 2) return maybe_eq_2 (a.coeffs[0], a.coeffs[1], b); return a.coeffs[0] == b; @@ -1245,7 +1245,7 @@ template inline typename if_nonpoly::type maybe_eq (const Ca &a, const poly_int_pod &b) { - STATIC_ASSERT (N <= 2); + static_assert (N <= 2); if (N == 2) return maybe_eq_2 (b.coeffs[0], b.coeffs[1], a); return a == b.coeffs[0]; @@ -2495,7 +2495,7 @@ template void print_dec (const poly_int_pod &value, FILE *file) { - STATIC_ASSERT (poly_coeff_traits::signedness >= 0); + static_assert (poly_coeff_traits::signedness >= 0); print_dec (value, file, poly_coeff_traits::signedness ? SIGNED : UNSIGNED); } diff --git a/gcc/profile-count.cc b/gcc/profile-count.cc index af8d0374b29..01f9d49bd92 100644 --- a/gcc/profile-count.cc +++ b/gcc/profile-count.cc @@ -292,7 +292,7 @@ profile_count::to_frequency (struct function *fun) const return BB_FREQ_MAX; if (*this == zero ()) return 0; - STATIC_ASSERT (REG_BR_PROB_BASE == BB_FREQ_MAX); + static_assert (REG_BR_PROB_BASE == BB_FREQ_MAX); gcc_assert (fun->cfg->count_max.initialized_p ()); profile_probability prob = probability_in (fun->cfg->count_max); if (!prob.initialized_p ()) diff --git a/gcc/rtl.h b/gcc/rtl.h index 5e77be2f024..34047e203cd 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -2157,9 +2157,9 @@ subreg_shape::operator != (const subreg_shape &other) const inline unsigned HOST_WIDE_INT subreg_shape::unique_id () const { - { STATIC_ASSERT (MAX_MACHINE_MODE <= 256); } - { STATIC_ASSERT (NUM_POLY_INT_COEFFS <= 3); } - { STATIC_ASSERT (sizeof (offset.coeffs[0]) <= 2); } + { static_assert (MAX_MACHINE_MODE <= 256); } + { static_assert (NUM_POLY_INT_COEFFS <= 3); } + { static_assert (sizeof (offset.coeffs[0]) <= 2); } int res = (int) inner_mode + ((int) outer_mode << 8); for (int i = 0; i < NUM_POLY_INT_COEFFS; ++i) res += (HOST_WIDE_INT) offset.coeffs[i] << ((1 + i) * 16); diff --git a/gcc/system.h b/gcc/system.h index 1688b763ef5..ca531c34446 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -801,15 +801,6 @@ extern void fancy_abort (const char *, int, const char *) #define STATIC_CONSTANT_P(X) (__builtin_constant_p (X) && (X)) -/* static_assert (COND, MESSAGE) is available in C++11 onwards. */ -#if __cplusplus >= 201103L -#define STATIC_ASSERT(X) \ - static_assert ((X), #X) -#else -#define STATIC_ASSERT(X) \ - typedef int assertion1[(X) ? 1 : -1] ATTRIBUTE_UNUSED -#endif - /* Provide a fake boolean type. We make no attempt to use the C99 _Bool, as it may not be available in the bootstrap compiler, and even if it is, it is liable to be buggy. diff --git a/gcc/tree.h b/gcc/tree.h index c53d34f6a47..5a1ab380cc0 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -3999,7 +3999,7 @@ id_equal (const char *str, const_tree id) inline poly_uint64 TYPE_VECTOR_SUBPARTS (const_tree node) { - STATIC_ASSERT (NUM_POLY_INT_COEFFS <= 2); + static_assert (NUM_POLY_INT_COEFFS <= 2); unsigned int precision = VECTOR_TYPE_CHECK (node)->type_common.precision; if (NUM_POLY_INT_COEFFS == 2) { @@ -4021,7 +4021,7 @@ TYPE_VECTOR_SUBPARTS (const_tree node) inline void SET_TYPE_VECTOR_SUBPARTS (tree node, poly_uint64 subparts) { - STATIC_ASSERT (NUM_POLY_INT_COEFFS <= 2); + static_assert (NUM_POLY_INT_COEFFS <= 2); unsigned HOST_WIDE_INT coeff0 = subparts.coeffs[0]; int index = exact_log2 (coeff0); gcc_assert (index >= 0); diff --git a/gcc/wide-int.h b/gcc/wide-int.h index bd0d9a2d4d5..af0506fe67a 100644 --- a/gcc/wide-int.h +++ b/gcc/wide-int.h @@ -466,7 +466,7 @@ namespace wi template struct binary_traits { - STATIC_ASSERT (int_traits ::precision == int_traits ::precision); + static_assert (int_traits ::precision == int_traits ::precision); /* Spelled out explicitly (rather than through FIXED_WIDE_INT) so as not to confuse gengtype. */ typedef generic_wide_int < fixed_wide_int_storage @@ -1110,8 +1110,8 @@ inline wide_int_storage::wide_int_storage () {} template inline wide_int_storage::wide_int_storage (const T &x) { - { STATIC_ASSERT (!wi::int_traits::host_dependent_precision); } - { STATIC_ASSERT (wi::int_traits::precision_type != wi::CONST_PRECISION); } + { static_assert (!wi::int_traits::host_dependent_precision); } + { static_assert (wi::int_traits::precision_type != wi::CONST_PRECISION); } WIDE_INT_REF_FOR (T) xi (x); precision = xi.precision; wi::copy (*this, xi); @@ -1121,8 +1121,8 @@ template inline wide_int_storage& wide_int_storage::operator = (const T &x) { - { STATIC_ASSERT (!wi::int_traits::host_dependent_precision); } - { STATIC_ASSERT (wi::int_traits::precision_type != wi::CONST_PRECISION); } + { static_assert (!wi::int_traits::host_dependent_precision); } + { static_assert (wi::int_traits::precision_type != wi::CONST_PRECISION); } WIDE_INT_REF_FOR (T) xi (x); precision = xi.precision; wi::copy (*this, xi); @@ -1201,7 +1201,7 @@ inline wide_int wi::int_traits ::get_binary_result (const T1 &x, const T2 &y) { /* This shouldn't be used for two flexible-precision inputs. */ - STATIC_ASSERT (wi::int_traits ::precision_type != FLEXIBLE_PRECISION + static_assert (wi::int_traits ::precision_type != FLEXIBLE_PRECISION || wi::int_traits ::precision_type != FLEXIBLE_PRECISION); if (wi::int_traits ::precision_type == FLEXIBLE_PRECISION) return wide_int::create (wi::get_precision (y)); @@ -1296,7 +1296,7 @@ fixed_wide_int_storage ::set_len (unsigned int l, bool) { len = l; /* There are no excess bits in val[len - 1]. */ - STATIC_ASSERT (N % HOST_BITS_PER_WIDE_INT == 0); + static_assert (N % HOST_BITS_PER_WIDE_INT == 0); } /* Treat X as having signedness SGN and convert it to an N-bit number. */ @@ -3446,7 +3446,7 @@ template inline T wi::mask (unsigned int width, bool negate_p) { - STATIC_ASSERT (wi::int_traits::precision); + static_assert (wi::int_traits::precision); T result; result.set_len (mask (result.write_val (), width, negate_p, wi::int_traits ::precision)); @@ -3460,7 +3460,7 @@ template inline T wi::shifted_mask (unsigned int start, unsigned int width, bool negate_p) { - STATIC_ASSERT (wi::int_traits::precision); + static_assert (wi::int_traits::precision); T result; result.set_len (shifted_mask (result.write_val (), start, width, negate_p,