From: "Daniel Schaefer" <daniel.schaefer@hpe.com>
To: <devel@edk2.groups.io>
Cc: Bob Feng <bob.c.feng@intel.com>,
Liming Gao <gaoliming@byosoft.com.cn>,
Yuwei Chen <yuwei.chen@intel.com>, Derek Lin <derek.lin2@hpe.com>
Subject: [PATCH v1 1/2] BaseTools: Make undefined VFR macro an error (GCC)
Date: Tue, 2 Mar 2021 16:21:49 +0800 [thread overview]
Message-ID: <20210302082150.15478-2-daniel.schaefer@hpe.com> (raw)
In-Reply-To: <20210302082150.15478-1-daniel.schaefer@hpe.com>
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
next prev parent reply other threads:[~2021-03-02 8:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-02 8:21 [PATCH v1 0/2] BaseTools: Make undefined VFR macro an error Daniel Schaefer
2021-03-02 8:21 ` Daniel Schaefer [this message]
2021-03-08 1:05 ` [edk2-devel] [PATCH v1 1/2] BaseTools: Make undefined VFR macro an error (GCC) Bob Feng
2021-03-08 3:44 ` Daniel Schaefer
[not found] ` <166A41333DA0F959.3944@groups.io>
2021-04-23 8:22 ` Daniel Schaefer
2021-03-02 8:21 ` [PATCH v1 2/2] BaseTools: Make undefined VFR macro an error (MSVC) Daniel Schaefer
2021-03-04 2:12 ` 回复: " gaoliming
2021-03-04 2:46 ` Daniel Schaefer
2021-04-23 8:21 ` Daniel Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210302082150.15478-2-daniel.schaefer@hpe.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox