From patchwork Thu Mar 24 10:37:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 64332 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp550220lbc; Thu, 24 Mar 2016 03:39:12 -0700 (PDT) X-Received: by 10.67.1.237 with SMTP id bj13mr11723638pad.130.1458815945312; Thu, 24 Mar 2016 03:39:05 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id fl1si11453650pad.15.2016.03.24.03.39.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Mar 2016 03:39:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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 DED8C1A1ECD; Thu, 24 Mar 2016 03:38:47 -0700 (PDT) X-Original-To: edk2-devel@ml01.01.org Delivered-To: edk2-devel@ml01.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9CD761A1E20 for ; Thu, 24 Mar 2016 03:38:46 -0700 (PDT) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 0261C8F4E5; Thu, 24 Mar 2016 10:38:21 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-47.phx2.redhat.com [10.3.113.47]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2OAbRfw032425; Thu, 24 Mar 2016 06:38:20 -0400 From: Laszlo Ersek To: edk2-devel-01 Date: Thu, 24 Mar 2016 11:37:24 +0100 Message-Id: <1458815844-24793-36-git-send-email-lersek@redhat.com> In-Reply-To: <1458815844-24793-1-git-send-email-lersek@redhat.com> References: <1458815844-24793-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Subject: [edk2] [PATCH 35/35] 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: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" From: Ard Biesheuvel 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 Reviewed-by: Liming Gao Reviewed-by: Laszlo Ersek Cc: Yonghong Zhu Signed-off-by: Laszlo Ersek --- BaseTools/Conf/tools_def.template | 36 ++++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) -- 1.8.3.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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 ##################