From bfd6deed1e860ce9516c7ca1613150a2c2c75f75 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Thu, 29 Jun 2023 14:35:03 -0600 Subject: [PATCH] AK+Meta: Disable consteval completely when building for oss-fuzz This was missed in 02b74e5a70e1eef2fe3123fe8aa157301424783a We need to disable consteval in AK::String as well as AK::StringView, and we need to disable it when building both the tools build and the fuzzer build. --- AK/String.h | 3 ++- Meta/Lagom/BuildFuzzers.sh | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/AK/String.h b/AK/String.h index acf996661ca..885f30e8baa 100644 --- a/AK/String.h +++ b/AK/String.h @@ -30,7 +30,8 @@ class StringData; } // FIXME: Remove this when OpenBSD Clang fully supports consteval. -#if defined(AK_OS_OPENBSD) +// And once oss-fuzz updates to clang >15. +#if defined(AK_OS_OPENBSD) || defined(OSS_FUZZ) # define AK_SHORT_STRING_CONSTEVAL constexpr #else # define AK_SHORT_STRING_CONSTEVAL consteval diff --git a/Meta/Lagom/BuildFuzzers.sh b/Meta/Lagom/BuildFuzzers.sh index 96496d50aaa..4140758909e 100755 --- a/Meta/Lagom/BuildFuzzers.sh +++ b/Meta/Lagom/BuildFuzzers.sh @@ -46,10 +46,15 @@ unset CFLAGS unset CXXFLAGS export AFL_NOOPT=1 +if [ "$#" -gt "0" ] && [ "--oss-fuzz" = "$1" ] ; then + CXXFLAGS="$CXXFLAGS -DOSS_FUZZ=ON" +fi + # FIXME: Replace these CMake invocations with a CMake superbuild? echo "Building Lagom Tools..." cmake -GNinja -B Build/tools \ -DBUILD_LAGOM=OFF \ + -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ -DCMAKE_INSTALL_PREFIX=Build/tool-install \ -Dpackage=LagomTools ninja -C Build/tools install