File 0001-Limit-the-clang-AST-crash-workaround-to-clang-7.0.patch of Package clazy

From 3ab212f4eb8c4e7dc00243070116d5258fa35169 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= <bero@lindev.ch>
Date: Wed, 18 May 2022 12:00:50 +0200
Subject: [PATCH] Limit the clang AST crash workaround to clang 7.0

The workaround disables some functionality when building with clang in
order to work around a clang bug that was introduced in 7.0 and fixed in
8.0.
Limit the workaround to clang versions actually affected by the bug.

Verified to work perfectly when built with clang 14.0.3.
---
 CMakeLists.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f8459c5..22f276c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -56,8 +56,8 @@ if (CLAZY_ENABLE_SANITIZERS)
     endif()
 endif()
 
-if (CLAZY_AST_MATCHERS_CRASH_WORKAROUND AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
-    message("Enabling AST Matchers workaround. Consider building with gcc instead. See bug #392223.")
+if (CLAZY_AST_MATCHERS_CRASH_WORKAROUND AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.0 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
+    message("Enabling AST Matchers workaround. Consider updating clang or building with gcc instead. See bug #392223.")
     add_definitions(-DCLAZY_DISABLE_AST_MATCHERS)
 endif()
 
@@ -81,7 +81,7 @@ endif()
 
 # Look for std::regex support
 message("Looking for std::regex support...")
-try_run(REGEX_RUN_RESULT COMPILE_RESULT ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/.cmake_has_regex_test.cpp)
+try_run(REGEX_RUN_RESULT COMPILE_RESULT ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/.cmake_has_regex_test.cpp CXX_STANDARD 17 CXX_STANDARD_REQUIRED true)
 
 if(NOT REGEX_RUN_RESULT EQUAL 0)
   message("Using boost::regex instead of std::regex")
-- 
2.37.3

openSUSE Build Service is sponsored by