Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enabled and fixed -Wdouble-promotion Clang warnings #7164

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cmake/compileroptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions externals/tinyxml2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion lib/programmemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ static std::unordered_map<std::string, BuiltinLibraryFunction> 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<long double>(asFloat(args[1])));
Copy link
Owner

@danmar danmar Jan 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this "fix" the issue.. there is still the promotion that clang warned about. This code will work technically exactly the same as before as far as I see.

v.valueType = ValueFlow::Value::ValueType::FLOAT;
return v;
};
Expand Down
Loading