From c1daf6e5b1ad7fb592f174173f699782d8ae6cfd Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 24 Dec 2024 14:20:02 +0100 Subject: [PATCH] enabled and fixed `-Wdouble-promotion` Clang warnings --- cmake/compileroptions.cmake | 1 - externals/tinyxml2/CMakeLists.txt | 1 + lib/programmemory.cpp | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/compileroptions.cmake b/cmake/compileroptions.cmake index e42145d8809..a640f39a60f 100644 --- a/cmake/compileroptions.cmake +++ b/cmake/compileroptions.cmake @@ -114,7 +114,6 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options_safe(-Wno-covered-switch-default) add_compile_options_safe(-Wno-shorten-64-to-32) add_compile_options_safe(-Wno-implicit-int-conversion) - add_compile_options_safe(-Wno-double-promotion) add_compile_options_safe(-Wno-shadow-field) add_compile_options_safe(-Wno-shadow-uncaptured-local) add_compile_options_safe(-Wno-implicit-float-conversion) diff --git a/externals/tinyxml2/CMakeLists.txt b/externals/tinyxml2/CMakeLists.txt index 50500d1cabf..911bf62d4bb 100644 --- a/externals/tinyxml2/CMakeLists.txt +++ b/externals/tinyxml2/CMakeLists.txt @@ -18,6 +18,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") target_compile_options_safe(tinyxml2_objs -Wno-old-style-cast) target_compile_options_safe(tinyxml2_objs -Wno-inconsistent-missing-destructor-override) target_compile_options_safe(tinyxml2_objs -Wno-format) + target_compile_options_safe(tinyxml2_objs -Wno-double-promotion) endif() if(CYGWIN) target_compile_definitions(-D_LARGEFILE_SOURCE) # required for fseeko() and ftello() diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp index f64b919f4f9..09fc21963a3 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -824,7 +824,7 @@ static std::unordered_map createBuiltinLibr return ValueFlow::Value::unknown(); ValueFlow::Value v; combineValueProperties(args[0], args[1], v); - v.floatValue = std::nexttoward(asFloat(args[0]), asFloat(args[1])); + v.floatValue = std::nexttoward(asFloat(args[0]), static_cast(asFloat(args[1]))); v.valueType = ValueFlow::Value::ValueType::FLOAT; return v; };