Skip to content

Commit

Permalink
devel/creduce: add crutch for using libc++ 14 with clang++ 8
Browse files Browse the repository at this point in the history
C-Reduce still depends on devel/llvm80, and this is no longer compatible
with libc++ 14 or higher, since libc++ now requires support for the
__builtin_is_constant_evaluated() builtin function (see
llvm/llvm-project@1123100
).

As a crutch, add a small header which defines a constexpr
__builtin_is_constant_evaluated() function, and include that at the top
of every compiled file, using -include, whenever the base system clang
version is 14 or higher.

Approved by:	swills (maintainer)
MFH:		2022Q1
  • Loading branch information
DimitryAndric committed Feb 13, 2022
1 parent cf8d1a0 commit 782745a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion devel/creduce/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CONFIGURE_ENV= LLVM_CONFIG=${LOCALBASE}/bin/llvm-config${LLVM_VER} \
CXX=${LOCALBASE}/bin/clang++${LLVM_VER} \
CPP=${LOCALBASE}/bin/clang-cpp${LLVM_VER}

USES= autoreconf gmake libtool perl5
USES= autoreconf compiler gmake libtool perl5

CFLAGS_powerpc64= -mabi=elfv2

Expand All @@ -36,4 +36,12 @@ CFLAGS_powerpc64= -mabi=elfv2
LLD_UNSAFE= yes
.endif

.include <bsd.port.pre.mk>

# Detect base system libc++ >= 14 by checking for COMPILER_VERSION.
# Not really the ideal way, but it should work.
.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 140
CXXFLAGS+= -include ${FILESDIR}/builtin_is_constant_evaluated.h
.endif

.include <bsd.port.mk>
1 change: 1 addition & 0 deletions devel/creduce/files/builtin_is_constant_evaluated.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
constexpr bool __builtin_is_constant_evaluated() { return false; }

0 comments on commit 782745a

Please sign in to comment.