[edk2-devel] [PATCH 3/3] BaseTools: Build against C++14 when building with clang

Rebecca Cran quic_rcran at quicinc.com
Fri Feb 17 03:51:01 UTC 2023


clang 17 defaults to C++17, where the 'register' keyword is deprecated
and the warning changed to an error. To avoid build errors, compile
against C++14 by specifying '-std=c++14' in CXXFLAGS.

Signed-off-by: Rebecca Cran <rebecca at quicinc.com>
---
 BaseTools/Source/C/Makefiles/header.makefile | 2 +-
 BaseTools/Source/C/VfrCompile/GNUmakefile    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile
index bcc2791998b0..1bf003523baf 100644
--- a/BaseTools/Source/C/Makefiles/header.makefile
+++ b/BaseTools/Source/C/Makefiles/header.makefile
@@ -106,7 +106,7 @@ endif
 endif
 ifneq ($(CLANG),)
 LDFLAGS =
-CXXFLAGS = -Wno-deprecated-register -Wno-unused-result
+CXXFLAGS = -Wno-deprecated-register -Wno-unused-result -std=c++14
 else
 LDFLAGS =
 CXXFLAGS = -Wno-unused-result
diff --git a/BaseTools/Source/C/VfrCompile/GNUmakefile b/BaseTools/Source/C/VfrCompile/GNUmakefile
index fdd19f55f77e..7d851c38887c 100644
--- a/BaseTools/Source/C/VfrCompile/GNUmakefile
+++ b/BaseTools/Source/C/VfrCompile/GNUmakefile
@@ -23,7 +23,7 @@ else
 VFR_CPPFLAGS = -DPCCTS_USE_NAMESPACE_STD $(CPPFLAGS)
 endif
 # keep BUILD_OPTFLAGS last
-VFR_CXXFLAGS = $(BUILD_OPTFLAGS)
+VFR_CXXFLAGS = $(BUILD_OPTFLAGS) -std=c++14
 
 # keep EXTRA_LDFLAGS last
 VFR_LFLAGS = $(EXTRA_LDFLAGS)
-- 
2.30.2



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




More information about the edk2-devel-archive mailing list