Re: [PATCH 3/3] Basetools: turn off gcc12 warning


Andrew Fish
 



On Mar 29, 2022, at 2:38 PM, Andrew Fish via groups.io <afish@...> wrote:



On Mar 29, 2022, at 11:14 AM, grant@... 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.


Sorry I forgot to mention I was using an Xcode clang on macOS. 

Thanks,

Andrew Fish

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)



Join devel@edk2.groups.io to automatically receive all group messages.