Increase concept diagnostic depth to 8

Reading concept errors is sometimes quite hard because they say that the
constraint was failing but not why. With a deeper diagnostic stack, it
is easier to understand why it was failing.

Change-Id: I863a23457bea390f50f9c458b5e82a24e17a26ea
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Marco Bubke
2025-02-21 10:51:17 +01:00
parent e02b73a664
commit 8e196c9e39
2 changed files with 12 additions and 0 deletions

View File

@@ -314,6 +314,8 @@ function(add_qtc_library name)
qtc_enable_sanitize("${name}" ${SANITIZE_FLAGS})
endif()
qtc_deeper_concept_diagnostic_depth("${name}")
if (NAMELINK_OPTION AND NOT QTC_STATIC_BUILD)
install(TARGETS ${name}
LIBRARY
@@ -534,6 +536,8 @@ function(add_qtc_plugin target_name)
qtc_enable_sanitize("${name}" ${SANITIZE_FLAGS})
endif()
qtc_deeper_concept_diagnostic_depth("${name}")
extend_qtc_target(${target_name}
INCLUDES ${_arg_INCLUDES}
SYSTEM_INCLUDES ${_arg_SYSTEM_INCLUDES}
@@ -762,6 +766,8 @@ function(add_qtc_executable name)
qtc_enable_sanitize("${name}" ${SANITIZE_FLAGS})
endif()
qtc_deeper_concept_diagnostic_depth("${name}")
extend_qtc_target("${name}"
INCLUDES "${CMAKE_BINARY_DIR}/src" ${_arg_INCLUDES}
DEFINES ${default_defines_copy} ${TEST_DEFINES} ${_arg_DEFINES}

View File

@@ -195,6 +195,12 @@ function(qtc_enable_sanitize _target _sanitize_flags)
endif()
endfunction()
function(qtc_deeper_concept_diagnostic_depth _target)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options("${_target}" PUBLIC -fconcepts-diagnostics-depth=8)
endif()
endfunction()
function(qtc_add_link_flags_no_undefined target)
# needs CheckLinkerFlags
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.18 AND NOT MSVC AND NOT APPLE)