From patchwork Wed Jul 8 13:24:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 50880 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DB572213FD for ; Wed, 8 Jul 2015 13:24:54 +0000 (UTC) Received: by lagx9 with SMTP id x9sf66565049lag.2 for ; Wed, 08 Jul 2015 06:24:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:reply-to:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=6/9oR+0cXOGNzSg7tvsvPT/1lcknPpX3BwmZ8gI2f/Y=; b=g2qykcbMxEY0IKdRgeR6WzOZdDoHKaKk1Jjk1nzGEGvr7VZpUlKVqccfXqbuVKBiuz bUb+kJggR9WI+hnNG5AMfFzRv+iHs72A0vlyr/x9tlS4xyKXrlY5nbzjIIxRPSWqvSF6 VoFaTRIxTOX19m0TdT12FefOzcwhult6+RZlt+SqUCsoaseaGP95ZywItEGOYSfJy7HX 3l0j7aTR4OzpRIvNzVEerl10t8MwRx/tgeR99bzFHgmMMDahEu5BW+c4c7HZfC7k9pvu Yp8k+IcK+aDdcUkn4wKo1LiVvoAV2XoNguuBEVMqDT5zisV4qx2b0gI6TT9DCc705tgy IWyw== X-Gm-Message-State: ALoCoQk4x1N+dQZB6gnagwaNzNWV6dqVB8Y8dacuTmSGmSHfOgqESK0ZL+fiO6xOudHGhTx8gPvJ X-Received: by 10.112.91.166 with SMTP id cf6mr4857618lbb.8.1436361893818; Wed, 08 Jul 2015 06:24:53 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.164 with SMTP id az4ls864805lab.16.gmail; Wed, 08 Jul 2015 06:24:53 -0700 (PDT) X-Received: by 10.152.87.70 with SMTP id v6mr970190laz.98.1436361893666; Wed, 08 Jul 2015 06:24:53 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id t1si1979859lbk.72.2015.07.08.06.24.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jul 2015 06:24:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by lagc2 with SMTP id c2so222390991lag.3 for ; Wed, 08 Jul 2015 06:24:53 -0700 (PDT) X-Received: by 10.152.18.162 with SMTP id x2mr9496739lad.73.1436361893550; Wed, 08 Jul 2015 06:24:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp3096547lbb; Wed, 8 Jul 2015 06:24:52 -0700 (PDT) X-Received: by 10.50.117.66 with SMTP id kc2mr62429029igb.31.1436361892125; Wed, 08 Jul 2015 06:24:52 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id y194si2664725iod.18.2015.07.08.06.24.51 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 08 Jul 2015 06:24:52 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1ZCpL5-0000Qr-Jl; Wed, 08 Jul 2015 13:24:39 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1ZCpL4-0000Qm-Vd for edk2-devel@lists.sourceforge.net; Wed, 08 Jul 2015 13:24:38 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.41 as permitted sender) client-ip=74.125.82.41; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wg0-f41.google.com; Received: from mail-wg0-f41.google.com ([74.125.82.41]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1ZCpL4-0002NI-5C for edk2-devel@lists.sourceforge.net; Wed, 08 Jul 2015 13:24:38 +0000 Received: by wgxm20 with SMTP id m20so12505074wgx.3 for ; Wed, 08 Jul 2015 06:24:32 -0700 (PDT) X-Received: by 10.180.88.8 with SMTP id bc8mr74189883wib.19.1436361872102; Wed, 08 Jul 2015 06:24:32 -0700 (PDT) Received: from localhost.localdomain ([185.13.106.78]) by smtp.gmail.com with ESMTPSA id v3sm3473191wja.31.2015.07.08.06.24.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jul 2015 06:24:31 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, lersek@redhat.com, olivier.martin@arm.com, leif.lindholm@linaro.org, jordan.l.justen@intel.com Date: Wed, 8 Jul 2015 15:24:18 +0200 Message-Id: <1436361858-4345-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1ZCpL4-0002NI-5C Subject: [edk2] [PATCH] BaseTools/GCC: allow unused but set variables X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This fixes a recurring problem where patches that have only been tested on MS toolchains break the build on GCC because they use variables that are only written but never read. However, there is a valid pattern where this may happen as well. For instance, Status = SomeFunc (&OutVar); ASSERT_EFI_ERROR (Status); if (Outvar == ... ) { ... } // Status never referenced again may never access Status again at all in RELEASE builds, since the ASSERT_EFI_ERROR () macro evaluates to nothing in that case. So let's allow this pattern, by passing the appropriate GCC command line option. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- BaseTools/Conf/tools_def.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 7edd7590956b..15d8db04232f 100644 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -3813,7 +3813,7 @@ NOOPT_DDK3790xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug RELEASE_*_*_OBJCOPY_ADDDEBUGFLAG = -DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -c -include AutoGen.h +DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -c -include AutoGen.h -Wno-error=unused-but-set-variable DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency