Hi Derek,
-Werror. Make all warnings into errors.
Should here be that only treat undef warning as error?
Thanks,
Bob
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Daniel Schaefer
Sent: Tuesday, March 2, 2021 4:22 PM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>; Derek Lin <derek.lin2@hpe.com>
Subject: [edk2-devel] [PATCH v1 1/2] BaseTools: Make undefined VFR macro an error (GCC)
VFR successfully compiles if we forget to include a header that defines a macro. In that case the HII option was hidden when it shouldn't be just because the macro was used but not defined.
The behaviour is totally intended by the C/PP standard. When a macro is undefined it evaluates to 0.
GCC, MSVC and Clang have warnings to catch this type of mistake. With this commit we enable this warning and make it a compiler error.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Derek Lin <derek.lin2@hpe.com>
---
BaseTools/Conf/tools_def.template | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 933b3160fd2b..728c1d3119e4 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3,7 +3,7 @@
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> # Portions copyright (c) 2011 - 2019, ARM Ltd. All rights reserved.<BR> # Copyright (c) 2015, Hewlett-Packard Development Company, L.P.<BR> -# (C) Copyright 2020, Hewlett Packard
Enterprise Development LP<BR>
+# (C) Copyright 2020-2021, Hewlett Packard Enterprise Development
+LP<BR>
# Copyright (c) Microsoft Corporation
#
# SPDX-License-Identifier: BSD-2-Clause-Patent @@ -1938,7 +1938,7 @@ DEFINE GCC_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS) -Wl,--entry,Re
DEFINE GCC_IA32_X64_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
DEFINE GCC_ASM_FLAGS = -c -x assembler -imacros AutoGen.h
DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h
-DEFINE GCC_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include $(MODULE_NAME)StrDefs.h
+DEFINE GCC_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include $(MODULE_NAME)StrDefs.h -Wundef -Werror
DEFINE GCC_ASLPP_FLAGS = -x c -E -include AutoGen.h
DEFINE GCC_ASLCC_FLAGS = -x c
DEFINE GCC_WINDRES_FLAGS = -J rc -O coff
--
2.30.0