public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Daniel Schaefer" <daniel.schaefer@hpe.com>
To: "Feng, Bob C" <bob.c.feng@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Schaefer, Daniel" <daniel.schaefer@hpe.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>,
	"Chen, Christine" <yuwei.chen@intel.com>,
	"Lin, Derek (HPS SW)" <derek.lin2@hpe.com>
Subject: Re: [edk2-devel] [PATCH v1 1/2] BaseTools: Make undefined VFR macro an error (GCC)
Date: Fri, 23 Apr 2021 08:22:11 +0000	[thread overview]
Message-ID: <DF4PR8401MB0444B3ED7E9B68951D8CBB07E0459@DF4PR8401MB0444.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <166A41333DA0F959.3944@groups.io>

[-- Attachment #1: Type: text/plain, Size: 3969 bytes --]

Ok sure, let's make only undef an error, not all other warnings. Then the behaviour will also be the same as on MSVC.
________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Daniel Schaefer <daniel.schaefer@hpe.com>
Sent: Monday, March 8, 2021 11:44
To: Feng, Bob C <bob.c.feng@intel.com>; devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Liming Gao <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>; Lin, Derek (HPS SW) <derek.lin2@hpe.com>
Subject: Re: [edk2-devel] [PATCH v1 1/2] BaseTools: Make undefined VFR macro an error (GCC)

It didn't cause any other errors for the huge HPE codebase. Only undefined macros. I don't believe the preprocessor has so many warnings anyways.
So -Werror should be fine.

________________________________
From: Feng, Bob C <bob.c.feng@intel.com>
Sent: Monday, March 8, 2021 09:05
To: devel@edk2.groups.io <devel@edk2.groups.io>; Schaefer, Daniel <daniel.schaefer@hpe.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>; Lin, Derek (HPS SW) <derek.lin2@hpe.com>
Subject: RE: [edk2-devel] [PATCH v1 1/2] BaseTools: Make undefined VFR macro an error (GCC)

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








[-- Attachment #2: Type: text/html, Size: 5908 bytes --]

  parent reply	other threads:[~2021-04-23  8:23 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 ` [PATCH v1 1/2] BaseTools: Make undefined VFR macro an error (GCC) Daniel Schaefer
2021-03-08  1:05   ` [edk2-devel] " Bob Feng
2021-03-08  3:44     ` Daniel Schaefer
     [not found]     ` <166A41333DA0F959.3944@groups.io>
2021-04-23  8:22       ` Daniel Schaefer [this message]
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=DF4PR8401MB0444B3ED7E9B68951D8CBB07E0459@DF4PR8401MB0444.NAMPRD84.PROD.OUTLOOK.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