-
Notifications
You must be signed in to change notification settings - Fork 400
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
#10345 - Sush warnings in third_party directory on modern compilers/OSes #10346
Conversation
* The arch shouldn't be passed, I'm on M1 not x86_64. This was removed upstream already: NREL/ssc@4e0ab97 * Shouldn't link to stdc++ directly. I'm actively trying to build against's LLVM's libc++ and getting a multiple flag warning (I use `export LDFLAGS="-L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++"`)
``` /Users/julien/Software/Others/EnergyPlus/third_party/kiva/vendor/boost-1.77.0/boost/type_traits/has_nothrow_constructor.hpp:27:84: warning: builtin __has_nothrow_constructor is deprecated; use __is_nothrow_constructible instead [-Wdeprecated-builtins] 27 | template <class T> struct has_nothrow_constructor : public integral_constant<bool, BOOST_HAS_NOTHROW_CONSTRUCTOR(T)>{}; ` `` I pulled the latest from develop for the move and type_traits boost projects, keeping only the macro changes I needed.
…to ssc because it tries to export/install)
``` In file included from /Users/julien/Software/Others/EnergyPlus/src/EnergyPlus/FileSystem.hh:56: /Users/julien/Software/Others/EnergyPlus/third_party/nlohmann/json.hpp:5350:32: warning: 'char_traits<unsigned char>' is deprecated: char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 18, so please migrate off of it. [-Wdeprecated-declarations] ```
@@ -59,6 +59,8 @@ add_library(project_fp_options INTERFACE) | |||
|
|||
add_library(project_warnings INTERFACE) | |||
|
|||
add_library(turn_off_warnings INTERFACE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A new interface library, which does -w
on gcc/clang and /W0
on msvc to remove all warnings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, we shouldn't be trying to handle warnings emitted from third_party, so this is fine with me.
add_subdirectory(FMI) | ||
set_target_properties(epfmiimport PROPERTIES FOLDER ThirdParty/FMI) | ||
target_link_libraries(epfmiimport turn_off_warnings) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turn off warnings for some of the third party libs that were issuing some:
- FMI
- zlib
- DElight
unsigned int index = 0; | ||
[[maybe_unused]] unsigned int count_a = 0; | ||
[[maybe_unused]] unsigned int count_b = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
easy warning avoidance.
@@ -270,7 +270,7 @@ struct sparse_solve_triangular_sparse_selector<Lhs,Rhs,Mode,UpLo,ColMajor> | |||
} | |||
|
|||
|
|||
Index count = 0; | |||
[[maybe_unused]] Index count = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
easy warning avoidance.
# if __has_builtin(__is_nothrow_constructible) | ||
# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__is_nothrow_constructible(T) && is_default_constructible<T>::value) | ||
# elif __has_feature(has_nothrow_constructor) | ||
# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) && is_default_constructible<T>::value) | ||
# endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/Users/julien/Software/Others/EnergyPlus/third_party/kiva/vendor/boost-1.77.0/boost/type_traits/has_nothrow_constructor.hpp:27:84: warning: builtin __has_nothrow_constructor is deprecated; use __is_nothrow_constructible instead [-Wdeprecated-builtins]
27 | template <class T> struct has_nothrow_constructor : public integral_constant<bool, BOOST_HAS_NOTHROW_CONSTRUCTOR(T)>{};
I pulled the latest from develop for the move and type_traits boost projects, keeping only the macro changes I needed.
target_include_directories( | ||
nlohmann_json | ||
INTERFACE | ||
SYSTEM INTERFACE | ||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/nlohmann> | ||
) | ||
set_source_files_properties( | ||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/nlohmann>/json.hpp | ||
TARGET_DIRECTORY nlohmann_json | ||
PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow I can't figure out how to suppress this warning?
In file included from /Users/julien/Software/Others/EnergyPlus/src/EnergyPlus/FileSystem.hh:56:
/Users/julien/Software/Others/EnergyPlus/third_party/nlohmann/json.hpp:5350:32: warning: 'char_traits<unsigned char>' is deprecated: char_traits<T> for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 18, so please migrate off of it. [-Wdeprecated-declarations]
5350 | auto result = std::char_traits<char_type>::to_int_type(*current);
| ^
/Users/julien/Software/Others/EnergyPlus/third_party/nlohmann/json.hpp:10489:29: note: in instantiation of member function 'nlohmann::detail::iterator_input_adapter<const unsigned char *>::get_character' requested here
10489 | return current = ia.get_character();
| ^
/Users/julien/Software/Others/EnergyPlus/third_party/nlohmann/json.hpp:8308:17: note: in instantiation of member function 'nlohmann::detail::binary_reader<nlohmann::basic_json<>, nlohmann::detail::iterator_input_adapter<const unsigned char *>>::get' requested here
8308 | get();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great @jmarrec, I'm happy to carefully mute warnings from our third party folder. I am also getting a few cmake warnings from third party that I may also mute when I pull latest develop into this branch locally.
@@ -59,6 +59,8 @@ add_library(project_fp_options INTERFACE) | |||
|
|||
add_library(project_warnings INTERFACE) | |||
|
|||
add_library(turn_off_warnings INTERFACE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, we shouldn't be trying to handle warnings emitted from third_party, so this is fine with me.
# define BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN(T) (__is_assignable(T, T&&) && __is_nothrow_assignable(T, T&&)) | ||
# elif BOOST_MOVE_HAS_TRAIT(has_nothrow_move_assign) | ||
# define BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN(T) __has_nothrow_move_assign(T) | ||
# endif | ||
|
||
# endif //BOOST_NO_CXX11_RVALUE_REFERENCES |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmarrec could you confirm the intent here? It looks like you just pulled one of the IF conditions to an outer IF block. Anything functionally different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, it's mostly just using the right builtins.
The outer condition is just the way it's on develop at https://github.com/boostorg/move/blob/develop/include/boost/move/detail/type_traits.hpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, that should be fine.
@@ -91,7 +91,7 @@ function(set_default_compile_options target) | |||
else(MSVC) | |||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | |||
if (APPLE) | |||
set(MAIN_CFLAGS "${MAIN_CFLAGS} -arch x86_64 -fno-common -DWX_PRECOMP -D__MACOSX__") | |||
set(MAIN_CFLAGS "${MAIN_CFLAGS} -fno-common -DWX_PRECOMP -D__MACOSX__") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah.
find_library(MATH_LIBRARY m) | ||
if(MATH_LIBRARY) | ||
target_link_libraries(ssc ${MATH_LIBRARY}) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah.
I was getting lots of CMake version warnings:
We use these packages in much more modern versions of CMake, like 3.17+, so there's no reason we can't allow them to run with a more modern CMake version specifier. In the longer term, we should simply update the third party libraries, and hopefully they have made the udpates there. Anyway, this hushes things up in a pretty innocent way. If we end up updating any of these libraries and it overrides the change, no big deal. |
This was totally happy on CI with the previous commit, and it's still happy locally. I don't think I'll wait on CI, let's just get this merged in. Thanks @jmarrec ! |
Pull request overview
Pull Request Author
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.
Reviewer
This will not be exhaustively relevant to every PR.