headersclean: Refactor order of compiler arguments

Merge different lists, and make order of compiler options more consistent.

Change-Id: I3a760d581cc2062f97d519c7316b77cbc9992203
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Kai Köhne 2023-12-03 16:56:55 +01:00
parent e11cbf206f
commit 19b69494f0

View File

@ -101,20 +101,20 @@ function(qt_internal_add_headersclean_target module_target module_headers)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"
OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang|IntelLLVM")
# Turn on some extra warnings not found in -Wall -Wextra.
set(hcleanFLAGS -Wall -Wextra -Werror -Woverloaded-virtual -Wshadow -Wundef -Wfloat-equal
-Wnon-virtual-dtor -Wpointer-arith -Wformat-security -Wno-long-long -Wno-variadic-macros
-fno-operator-names
-pedantic-errors)
# Compile header in strict C++20 mode. Enable further warnings.
set(hcleanFLAGS -std=c++2a
-Wall -Wextra -Werror -pedantic-errors
-Woverloaded-virtual -Wshadow -Wundef -Wfloat-equal
-Wnon-virtual-dtor -Wpointer-arith -Wformat-security
-Wchar-subscripts -Wold-style-cast
-Wno-long-long -Wno-variadic-macros
-fno-operator-names)
if(QT_FEATURE_reduce_relocations AND UNIX)
list(APPEND hcleanFLAGS -fPIC)
endif()
# options accepted by GCC and Clang
list(APPEND hcleanFLAGS -Wchar-subscripts -Wold-style-cast)
if (NOT ((TEST_architecture_arch STREQUAL arm)
OR (TEST_architecture_arch STREQUAL mips)))
list(APPEND hcleanFLAGS -Wcast-align)
@ -134,9 +134,6 @@ function(qt_internal_add_headersclean_target module_target module_headers)
list(APPEND hcleanFLAGS -Wshorten-64-to-32)
endif()
# Use strict mode C++20, with no GNU extensions (see -pedantic-errors above).
list(APPEND hcleanFLAGS -std=c++2a)
separate_arguments(cxx_flags NATIVE_COMMAND ${CMAKE_CXX_FLAGS})
if(APPLE AND CMAKE_OSX_SYSROOT)