From patchwork Thu Mar 24 06:28:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 64292 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp451485lbc; Wed, 23 Mar 2016 23:28:38 -0700 (PDT) X-Received: by 10.98.7.136 with SMTP id 8mr10290225pfh.24.1458800916110; Wed, 23 Mar 2016 23:28:36 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id ry2si9920700pab.159.2016.03.23.23.28.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Mar 2016 23:28:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B5CED1A1F0B; Wed, 23 Mar 2016 23:28:58 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E521B1A1EFB for ; Wed, 23 Mar 2016 23:28:57 -0700 (PDT) Received: by mail-wm0-x22c.google.com with SMTP id p65so260539305wmp.1 for ; Wed, 23 Mar 2016 23:28:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DKeNYLKj/cwLNDtvQr6OGuDnloRlsP6ZMDzsnoHMCVc=; b=GLCEBkG+NYDytQCkhvI92WDkDG4m/vlrH4yMFumldr21boLJCQzlgvDzHH6jE7Odck pISkK8dfMOGUJm1+ASBoxoZau3TAq0H5Ut+lNoHacGRtaPpX/HlqVwgvg3/L8b2nWkq8 OGybN4SuVygLcsjNyWeyS5ChTFMIxGiatSSzI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DKeNYLKj/cwLNDtvQr6OGuDnloRlsP6ZMDzsnoHMCVc=; b=NynnqgUK8N+pWjGYXLP/dk1G/C4G7TiXibMUAr5UwmTz1y/G3DlErXDXRRbi2sfGh7 bIx+WkCzU4BzlFcqxouNVW/FQwDYH8B0dgdl31wugS6cEbPznI8R+75zO/e4KaXi2IMf End3VmD8FAaST99nvvb/yIkg+BtNsUnw84xJg6aCUfHWRdzRbz28BILFj2qSfDj1xo6i x5RokG61eqy32YX0lC8YHhytULoqtCCmRjyhQWhNjcK4TSrGnZvpaM2F+DmWhLG6mbI/ 2OIxsLbfbBwnO0r2A/WGRL7f/3aNCnPtc8ZYGqyiabh1jJWwmI8ggjlYl0Grq/N3BzcX xC3w== X-Gm-Message-State: AD7BkJID4467tt/VdJnpUp1HY5ovFT0PMi7D/rb9B1/QNKDZGtP01pWFulz8JaJ1c7KoICrp X-Received: by 10.28.127.144 with SMTP id a138mr7883415wmd.25.1458800911505; Wed, 23 Mar 2016 23:28:31 -0700 (PDT) Received: from localhost.localdomain (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by smtp.gmail.com with ESMTPSA id w8sm5814691wjf.19.2016.03.23.23.28.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Mar 2016 23:28:30 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com, liming.gao@intel.com, star.zeng@intel.com, feng.tian@intel.com, shumin.qiu@intel.com, jaben.carsey@intel.com, jeff.fan@intel.com Date: Thu, 24 Mar 2016 07:28:20 +0100 Message-Id: <1458800900-11913-5-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1458800900-11913-1-git-send-email-ard.biesheuvel@linaro.org> References: <1458800900-11913-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 4/4] BaseTools/GCC: set -Wno-unused-but-set-variables only on RELEASE builds X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" This aligns the GCC definitions for 4.6 and up to align with the ARM and AARCH64 definitions, which is to ignore unused but set variables only on RELEASE builds. This allows us to find instances of unused variables that are left behind after refactoring. It also allows us to find bad new code, which, due to the EDK2 coding style which disallows initialized automatic variables, may contain such variables without having been noticed by other toolchains. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- BaseTools/Conf/tools_def.template | 36 ++++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Laszlo Ersek diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index b1577af8c897..fc06ffa6e6be 100644 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -4371,8 +4371,8 @@ DEFINE GCC45_X64_DLINK_FLAGS = DEF(GCC44_X64_DLINK_FLAGS) DEFINE GCC45_X64_DLINK2_FLAGS = DEF(GCC44_X64_DLINK2_FLAGS) DEFINE GCC45_ASM_FLAGS = DEF(GCC44_ASM_FLAGS) -DEFINE GCC46_IA32_CC_FLAGS = DEF(GCC45_IA32_CC_FLAGS) -Wno-address -Wno-unused-but-set-variable -DEFINE GCC46_X64_CC_FLAGS = DEF(GCC45_X64_CC_FLAGS) -Wno-address -Wno-unused-but-set-variable +DEFINE GCC46_IA32_CC_FLAGS = DEF(GCC45_IA32_CC_FLAGS) -Wno-address +DEFINE GCC46_X64_CC_FLAGS = DEF(GCC45_X64_CC_FLAGS) -Wno-address DEFINE GCC46_IA32_X64_DLINK_COMMON = DEF(GCC45_IA32_X64_DLINK_COMMON) DEFINE GCC46_IA32_X64_ASLDLINK_FLAGS = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS) DEFINE GCC46_IA32_X64_DLINK_FLAGS = DEF(GCC45_IA32_X64_DLINK_FLAGS) @@ -4715,13 +4715,15 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS) *_GCC46_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 *_GCC46_IA32_ASLDLINK_FLAGS = DEF(GCC46_IA32_X64_ASLDLINK_FLAGS) -m elf_i386 *_GCC46_IA32_ASM_FLAGS = DEF(GCC46_ASM_FLAGS) -m32 -march=i386 -*_GCC46_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS) -Os *_GCC46_IA32_DLINK_FLAGS = DEF(GCC46_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386 *_GCC46_IA32_DLINK2_FLAGS = DEF(GCC46_IA32_DLINK2_FLAGS) *_GCC46_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) *_GCC46_IA32_OBJCOPY_FLAGS = *_GCC46_IA32_NASM_FLAGS = -f elf32 + DEBUG_GCC46_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS) -Os +RELEASE_GCC46_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable + ################## # GCC46 X64 definitions ################## @@ -4740,13 +4742,15 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS) *_GCC46_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64 *_GCC46_X64_ASLDLINK_FLAGS = DEF(GCC46_IA32_X64_ASLDLINK_FLAGS) -m elf_x86_64 *_GCC46_X64_ASM_FLAGS = DEF(GCC46_ASM_FLAGS) -m64 -melf_x86_64 -*_GCC46_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS) *_GCC46_X64_DLINK_FLAGS = DEF(GCC46_X64_DLINK_FLAGS) *_GCC46_X64_DLINK2_FLAGS = DEF(GCC46_X64_DLINK2_FLAGS) *_GCC46_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) *_GCC46_X64_OBJCOPY_FLAGS = *_GCC46_X64_NASM_FLAGS = -f elf64 + DEBUG_GCC46_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS) +RELEASE_GCC46_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS) -Wno-unused-but-set-variable + ################## # GCC46 ARM definitions ################## @@ -4816,13 +4820,15 @@ RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -D__ARM_FEATURE_UNALI *_GCC47_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 *_GCC47_IA32_ASLDLINK_FLAGS = DEF(GCC47_IA32_X64_ASLDLINK_FLAGS) -m elf_i386 *_GCC47_IA32_ASM_FLAGS = DEF(GCC47_ASM_FLAGS) -m32 -march=i386 -*_GCC47_IA32_CC_FLAGS = DEF(GCC47_IA32_CC_FLAGS) -Os *_GCC47_IA32_DLINK_FLAGS = DEF(GCC47_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386 *_GCC47_IA32_DLINK2_FLAGS = DEF(GCC47_IA32_DLINK2_FLAGS) *_GCC47_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) *_GCC47_IA32_OBJCOPY_FLAGS = *_GCC47_IA32_NASM_FLAGS = -f elf32 + DEBUG_GCC47_IA32_CC_FLAGS = DEF(GCC47_IA32_CC_FLAGS) -Os +RELEASE_GCC47_IA32_CC_FLAGS = DEF(GCC47_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable + ################## # GCC47 X64 definitions ################## @@ -4841,13 +4847,15 @@ RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -D__ARM_FEATURE_UNALI *_GCC47_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64 *_GCC47_X64_ASLDLINK_FLAGS = DEF(GCC47_IA32_X64_ASLDLINK_FLAGS) -m elf_x86_64 *_GCC47_X64_ASM_FLAGS = DEF(GCC47_ASM_FLAGS) -m64 -*_GCC47_X64_CC_FLAGS = DEF(GCC47_X64_CC_FLAGS) *_GCC47_X64_DLINK_FLAGS = DEF(GCC47_X64_DLINK_FLAGS) *_GCC47_X64_DLINK2_FLAGS = DEF(GCC47_X64_DLINK2_FLAGS) *_GCC47_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) *_GCC47_X64_OBJCOPY_FLAGS = *_GCC47_X64_NASM_FLAGS = -f elf64 + DEBUG_GCC47_X64_CC_FLAGS = DEF(GCC47_X64_CC_FLAGS) +RELEASE_GCC47_X64_CC_FLAGS = DEF(GCC47_X64_CC_FLAGS) -Wno-unused-but-set-variable + ################## # GCC47 ARM definitions ################## @@ -4944,13 +4952,15 @@ RELEASE_GCC47_AARCH64_CC_FLAGS = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-s *_GCC48_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 *_GCC48_IA32_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_ASLDLINK_FLAGS) -m elf_i386 *_GCC48_IA32_ASM_FLAGS = DEF(GCC48_ASM_FLAGS) -m32 -march=i386 -*_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os *_GCC48_IA32_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386 *_GCC48_IA32_DLINK2_FLAGS = DEF(GCC48_IA32_DLINK2_FLAGS) *_GCC48_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) *_GCC48_IA32_OBJCOPY_FLAGS = *_GCC48_IA32_NASM_FLAGS = -f elf32 + DEBUG_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os +RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable + ################## # GCC48 X64 definitions ################## @@ -4969,13 +4979,15 @@ RELEASE_GCC47_AARCH64_CC_FLAGS = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-s *_GCC48_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64 *_GCC48_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_ASLDLINK_FLAGS) -m elf_x86_64 *_GCC48_X64_ASM_FLAGS = DEF(GCC48_ASM_FLAGS) -m64 -*_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) *_GCC48_X64_DLINK_FLAGS = DEF(GCC48_X64_DLINK_FLAGS) *_GCC48_X64_DLINK2_FLAGS = DEF(GCC48_X64_DLINK2_FLAGS) *_GCC48_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) *_GCC48_X64_OBJCOPY_FLAGS = *_GCC48_X64_NASM_FLAGS = -f elf64 + DEBUG_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) +RELEASE_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Wno-unused-but-set-variable + ################## # GCC48 ARM definitions ################## @@ -5072,13 +5084,15 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s *_GCC49_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 *_GCC49_IA32_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) -m elf_i386 *_GCC49_IA32_ASM_FLAGS = DEF(GCC49_ASM_FLAGS) -m32 -march=i386 -*_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os *_GCC49_IA32_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386 *_GCC49_IA32_DLINK2_FLAGS = DEF(GCC49_IA32_DLINK2_FLAGS) *_GCC49_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) *_GCC49_IA32_OBJCOPY_FLAGS = *_GCC49_IA32_NASM_FLAGS = -f elf32 + DEBUG_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os +RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable + ################## # GCC49 X64 definitions ################## @@ -5097,13 +5111,15 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s *_GCC49_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64 *_GCC49_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) -m elf_x86_64 *_GCC49_X64_ASM_FLAGS = DEF(GCC49_ASM_FLAGS) -m64 -*_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) *_GCC49_X64_DLINK_FLAGS = DEF(GCC49_X64_DLINK_FLAGS) *_GCC49_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS) *_GCC49_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) *_GCC49_X64_OBJCOPY_FLAGS = *_GCC49_X64_NASM_FLAGS = -f elf64 + DEBUG_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) +RELEASE_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Wno-unused-but-set-variable + ################## # GCC49 ARM definitions ##################