git: a34d2231fa38 - main - Partially revert 6527682ab705 for llvm-based projects

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Thu, 24 Apr 2025 14:36:49 UTC
The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=a34d2231fa38a5e440ecdc94dbca3b3deb5a7f50

commit a34d2231fa38a5e440ecdc94dbca3b3deb5a7f50
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2025-04-24 12:03:38 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2025-04-24 14:36:40 +0000

    Partially revert 6527682ab705 for llvm-based projects
    
    Upstream llvm compiles most of their subprojects with -std=c++17
    explicitly, not -std=gnu++17. In gnu++17 mode, both clang and gcc define
    the macro 'i386' on i386, which clashes with a namespace identifier in
    contrib/llvm-project/llvm/include/llvm/ExecutionEngine/JITLink/i386.h.
    
    Since the default after 6527682ab705 is now CXXSTD=gnu++17, explicitly
    set CXXSTD=c++17 for lib/clang, lib/libclang_rt and lib/libomp.
---
 lib/clang/llvm.build.mk      | 1 +
 lib/libclang_rt/Makefile.inc | 1 +
 lib/libomp/Makefile          | 1 +
 3 files changed, 3 insertions(+)

diff --git a/lib/clang/llvm.build.mk b/lib/clang/llvm.build.mk
index c731deba8976..e88b2ff1033e 100644
--- a/lib/clang/llvm.build.mk
+++ b/lib/clang/llvm.build.mk
@@ -119,6 +119,7 @@ LDFLAGS+=	-Wl,-m,elf64lriscv_fbsd
 .endif
 .endif
 
+CXXSTD=		c++17
 CXXFLAGS+=	-fno-exceptions
 CXXFLAGS+=	-fno-rtti
 .if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING)
diff --git a/lib/libclang_rt/Makefile.inc b/lib/libclang_rt/Makefile.inc
index e7db5a469661..c472e8b741be 100644
--- a/lib/libclang_rt/Makefile.inc
+++ b/lib/libclang_rt/Makefile.inc
@@ -33,3 +33,4 @@ CXXFLAGS+=	-fvisibility-inlines-hidden
 CXXFLAGS+=	-fvisibility=hidden
 CFLAGS+=	-I${CRTSRC}/include
 CFLAGS+=	-I${CRTSRC}/lib
+CXXSTD=		c++17
diff --git a/lib/libomp/Makefile b/lib/libomp/Makefile
index f1513e70f3f6..6c14c7d21077 100644
--- a/lib/libomp/Makefile
+++ b/lib/libomp/Makefile
@@ -57,6 +57,7 @@ CFLAGS+=	-fdata-sections
 CXXFLAGS+=	-fvisibility-inlines-hidden
 CXXFLAGS+=	-fno-exceptions
 CXXFLAGS+=	-fno-rtti
+CXXSTD=		c++17
 
 .if ${COMPILER_TYPE} == "clang"
 .if ${MACHINE_CPUARCH} == "i386"