From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 59F9243302; Sat, 11 Nov 2023 18:52:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9FD8400D7; Sat, 11 Nov 2023 18:52:29 +0100 (CET) Received: from dkmailrelay1.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id 55E994003C for ; Sat, 11 Nov 2023 18:52:28 +0100 (CET) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesys.local [192.168.4.10]) by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id 15216200F4; Sat, 11 Nov 2023 18:52:28 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [RFC] eal: use _Static_assert() for RTE_BUILD_BUG_ON X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Sat, 11 Nov 2023 18:52:26 +0100 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9F015@smartserver.smartshare.dk> In-Reply-To: <20231111172153.57461-1-stephen@networkplumber.org> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [RFC] eal: use _Static_assert() for RTE_BUILD_BUG_ON Thread-Index: AdoUw5wa2x35TKpdSNeExC3PF4d2uwAAw8Bg References: <20231111172153.57461-1-stephen@networkplumber.org> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Stephen Hemminger" , X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Saturday, 11 November 2023 18.22 >=20 > The method of doing sizeof a bad array element was an interesting > hack but it has a couple of problems. First, it won't work if > VLA checking is enabled. It doesn't enforce that the expression > is constant. >=20 > Replace that with the _Static_assert builtin available in > Gcc, Clang, and MSVC. >=20 > Signed-off-by: Stephen Hemminger > --- Two souls, one thought... I have been considering exactly the same, and thus strongly support = this. > -#define RTE_BUILD_BUG_ON(condition) ((void)sizeof(char[1 - > 2*!!(condition)])) > +#define RTE_BUILD_BUG_ON(e) _Static_assert(!(e), #e) Please use static_assert instead of _Static_assert, as discussed with = Bruce: http://inbox.dpdk.org/dev/ZR%2FlDC88s+HYXw27@bricha3-MOBL.ger.corp.intel.= com/ Acked-by: Morten Br=F8rup