From patchwork Thu May 5 12:18:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 53510 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 773613877020 for ; Thu, 5 May 2022 12:20:13 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id D1D9938515F6 for ; Thu, 5 May 2022 12:18:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D1D9938515F6 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 17AC31F8D3 for ; Thu, 5 May 2022 12:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1651753139; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=V9Uc5o2Ysmv+5rApBYG/vKnX8Lr4SAOtEqS9YP0lbTU=; b=RYMDqrr/Ke7tsfM80muB7Qo8NC36IEkeOVf5iyT08TW7V0EVeVWG3z0/G916apRbBsHHK4 2CPMMJrjpjDtxKzhIbGB1ad8/N6VRIIozcEZkFQizh/0OaMVckT+mFuVMghao82wM0+00Q arnjs6sDqHDQQu40v/5mtERv9nD3EEU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1651753139; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=V9Uc5o2Ysmv+5rApBYG/vKnX8Lr4SAOtEqS9YP0lbTU=; b=0m4S/hBs30W7mh20oYt8T0f1MSRqlbRMJRTiLAxmgqHmq/mQSnGL843m14k41C+vVwk0ZJ 9xUc3FPzwh/M13BA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 09C2513A65 for ; Thu, 5 May 2022 12:18:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id rDY8AbPAc2KQfAAAMHmgww (envelope-from ) for ; Thu, 05 May 2022 12:18:59 +0000 Message-ID: <60e9783e-d324-2d12-5744-68a3b2e5c96a@suse.cz> Date: Thu, 5 May 2022 14:18:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] Remove conditional STATIC_ASSERT. To: gcc-patches@gcc.gnu.org Content-Language: en-US X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" As we require a c++11 compliant compiler, the #if __cplusplus >= 201103L conditional build is always true. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin gcc/ChangeLog: * basic-block.h (STATIC_ASSERT): Use normal STATIC_ASSERT. * system.h (STATIC_ASSERT): Define always as static_assert. --- gcc/basic-block.h | 5 +---- gcc/system.h | 9 +-------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/gcc/basic-block.h b/gcc/basic-block.h index e3fff1f6975..21a9b24dbf9 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 1688b763ef5..48145951337 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -801,14 +801,7 @@ 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 +#define STATIC_ASSERT(X) static_assert ((X), #X) /* Provide a fake boolean type. We make no attempt to use the C99 _Bool, as it may not be available in the bootstrap compiler,