Re: [PATCH] Use STATIC_ASSERT for OVL_OP_MAX.

2021-04-22 Thread Jason Merrill via Gcc-patches
On 4/22/21 4:55 AM, Martin Liška wrote: There's an updated version of the patch, Jonathan noticed correctly the comment related to assert was not correct. Subject: [PATCH] Use STATIC_ASSERT for OVL_OP_MAX. Subject line needs "c++:" Please also include the rationale from you

Re: [PATCH] Use STATIC_ASSERT for OVL_OP_MAX.

2021-04-22 Thread Bernhard Reutner-Fischer via Gcc-patches
On Thu, 22 Apr 2021 14:28:24 -0600 Martin Sebor via Gcc-patches wrote: > > enum E { e = 5 }; > > struct A { E e: 3; }; > > > > constexpr int number_of_bits () > > { > > A a = { }; > > a.e = (E)-1; > > return 32 - __builtin_clz(a.e); > > } > > > > I had the same thought about usin

Re: [PATCH] Use STATIC_ASSERT for OVL_OP_MAX.

2021-04-22 Thread Martin Sebor via Gcc-patches
On 4/22/21 9:41 AM, Jonathan Wakely wrote: On Thu, 22 Apr 2021 at 15:59, Martin Sebor wrote: On 4/22/21 2:52 AM, Jonathan Wakely wrote: On Thu, 22 Apr 2021, 08:47 Martin Liška, wrote: On 4/21/21 6:11 PM, Martin Sebor wrote: > On 4/21/21 2:15 AM, Martin Liška wrote: >> Hello.

Re: [PATCH] Use STATIC_ASSERT for OVL_OP_MAX.

2021-04-22 Thread Jonathan Wakely via Gcc-patches
On Thu, 22 Apr 2021 at 15:59, Martin Sebor wrote: > > On 4/22/21 2:52 AM, Jonathan Wakely wrote: > > On Thu, 22 Apr 2021, 08:47 Martin Liška, wrote: > > > > On 4/21/21 6:11 PM, Martin Sebor wrote: > > > On 4/21/21 2:15 AM, Martin Liška wrote: > > >> Hello. > > >> > > >> It'

Re: [PATCH] Use STATIC_ASSERT for OVL_OP_MAX.

2021-04-22 Thread Martin Sebor via Gcc-patches
On 4/22/21 2:52 AM, Jonathan Wakely wrote: On Thu, 22 Apr 2021, 08:47 Martin Liška, wrote: On 4/21/21 6:11 PM, Martin Sebor wrote: > On 4/21/21 2:15 AM, Martin Liška wrote: >> Hello. >> >> It's addressing the following Clang warning: >> cp/lex.c:170:45: warning: resu

Re: [PATCH] Use STATIC_ASSERT for OVL_OP_MAX.

2021-04-22 Thread Martin Liška
There's an updated version of the patch, Jonathan noticed correctly the comment related to assert was not correct. Martin >From e035fd0549ea17ab4f8d71488f577fd1e4077fd9 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 12 Mar 2021 14:32:07 +0100 Subject: [PATCH] Use STATIC_AS

Re: [PATCH] Use STATIC_ASSERT for OVL_OP_MAX.

2021-04-22 Thread Jonathan Wakely via Gcc-patches
On Thu, 22 Apr 2021, 08:47 Martin Liška, wrote: > On 4/21/21 6:11 PM, Martin Sebor wrote: > > On 4/21/21 2:15 AM, Martin Liška wrote: > >> Hello. > >> > >> It's addressing the following Clang warning: > >> cp/lex.c:170:45: warning: result of comparison of constant 64 with > expression of type 'enu

Re: [PATCH] Use STATIC_ASSERT for OVL_OP_MAX.

2021-04-22 Thread Martin Liška
On 4/21/21 6:11 PM, Martin Sebor wrote: > On 4/21/21 2:15 AM, Martin Liška wrote: >> Hello. >> >> It's addressing the following Clang warning: >> cp/lex.c:170:45: warning: result of comparison of constant 64 with >> expression of type 'enum ovl_op_code' is always true >> [-Wtautological-constant-

Re: [PATCH] Use STATIC_ASSERT for OVL_OP_MAX.

2021-04-21 Thread Martin Sebor via Gcc-patches
On 4/21/21 2:15 AM, Martin Liška wrote: Hello. It's addressing the following Clang warning: cp/lex.c:170:45: warning: result of comparison of constant 64 with expression of type 'enum ovl_op_code' is always true [-Wtautological-constant-out-of-range-compare] Patch can bootstrap on x86_64-linu

[PATCH] Use STATIC_ASSERT for OVL_OP_MAX.

2021-04-21 Thread Martin Liška
Hello. It's addressing the following Clang warning: cp/lex.c:170:45: warning: result of comparison of constant 64 with expression of type 'enum ovl_op_code' is always true [-Wtautological-constant-out-of-range-compare] Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Read