[edk2-devel] [PATCH 3/3] Basetools: turn off gcc12 warning

Andrew Fish via groups.io afish=apple.com at groups.io
Tue Mar 29 21:38:15 UTC 2022



> On Mar 29, 2022, at 11:14 AM, grant at grantlmul.xyz wrote:
> 
> While I can't test this myself, the following does appear to result in a successful build using the same clang version:
> 
> 
> diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile b/BaseTools/Source/C/DevicePath/GNUmakefile
> index b05d2bddfa..81aa35aa31 100644
> --- a/BaseTools/Source/C/DevicePath/GNUmakefile
> +++ b/BaseTools/Source/C/DevicePath/GNUmakefile
> @@ -14,7 +14,9 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o  DevicePathUtili
>  include $(MAKEROOT)/Makefiles/app.makefile
>  
>  # gcc 12 trips over device path handling
> -BUILD_CFLAGS += -Wno-error=stringop-overflow
> +ifeq($(CC), gcc)
> +  BUILD_CFLAGS += -Wno-error=stringop-overflow
> +endif
>  

Gerd,

I’m not sure if this was caused by my email client but your fix did not work for me.
GNUmakefile:17: *** missing separator.  Stop.

I had to add a space after `ifeq` to get it to work.
diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile b/BaseTools/Source/C/DevicePath/GNUmakefile
index b05d2bddfa68..ebab1d3e2617 100644
--- a/BaseTools/Source/C/DevicePath/GNUmakefile
+++ b/BaseTools/Source/C/DevicePath/GNUmakefile
@@ -14,7 +14,9 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o  DevicePathUtili
 include $(MAKEROOT)/Makefiles/app.makefile
 
 # gcc 12 trips over device path handling
-BUILD_CFLAGS += -Wno-error=stringop-overflow
+ifeq ($(CC), gcc)
+  BUILD_CFLAGS += -Wno-error=stringop-overflow
+endif
 
 LIBS = -lCommon
 ifeq ($(CYGWIN), CYGWIN)


I had been working around like this previously (I’m not sure about the portability of -Wno-unknown-warning-option):

diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile b/BaseTools/Source/C/DevicePath/GNUmakefile
index b05d2bddfa68..d08588a81f80 100644
--- a/BaseTools/Source/C/DevicePath/GNUmakefile
+++ b/BaseTools/Source/C/DevicePath/GNUmakefile
@@ -14,7 +14,7 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o  DevicePathUtili
 include $(MAKEROOT)/Makefiles/app.makefile
 
 # gcc 12 trips over device path handling
-BUILD_CFLAGS += -Wno-error=stringop-overflow
+BUILD_CFLAGS += -Wno-error=stringop-overflow -Wno-unknown-warning-option
 
 LIBS = -lCommon
 ifeq ($(CYGWIN), CYGWIN)

Thanks,

Andrew Fish
>  LIBS = -lCommon
>  ifeq ($(CYGWIN), CYGWIN)
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88206): https://edk2.groups.io/g/devel/message/88206
Mute This Topic: https://groups.io/mt/89997416/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20220329/0b6598af/attachment-0001.htm>


More information about the edk2-devel-archive mailing list