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

Rebecca Cran posted 3 patches 2 years, 11 months ago
[edk2-devel] [PATCH 3/3] BaseTools: Build against C++14 when building with clang
Posted by Rebecca Cran 2 years, 11 months ago
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@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/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 3/3] BaseTools: Build against C++14 when building with clang
Posted by Gerd Hoffmann 2 years, 11 months ago
On Thu, Feb 16, 2023 at 08:51:01PM -0700, Rebecca Cran wrote:
> 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.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101227): https://edk2.groups.io/g/devel/message/101227
Mute This Topic: https://groups.io/mt/97022150/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-