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

#10345 - Sush warnings in third_party directory on modern compilers/OSes #10346

Merged
merged 10 commits into from
Dec 22, 2023

Conversation

jmarrec
Copy link
Contributor

@jmarrec jmarrec commented Dec 22, 2023

Pull request overview

Pull Request Author

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

  • Title of PR should be user-synopsis style (clearly understandable in a standalone changelog context)
  • Label the PR with at least one of: Defect, Refactoring, NewFeature, Performance, and/or DoNoPublish
  • Pull requests that impact EnergyPlus code must also include unit tests to cover enhancement or defect repair
  • Author should provide a "walkthrough" of relevant code changes using a GitHub code review comment process
  • If any diffs are expected, author must demonstrate they are justified using plots and descriptions
  • If changes fix a defect, the fix should be demonstrated in plots and descriptions
  • If any defect files are updated to a more recent version, upload new versions here or on DevSupport
  • If IDD requires transition, transition source, rules, ExpandObjects, and IDFs must be updated, and add IDDChange label
  • If structural output changes, add to output rules file and add OutputChange label
  • If adding/removing any LaTeX docs or figures, update that document's CMakeLists file dependencies

Reviewer

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • If branch is behind develop, merge develop and build locally to check for side effects of the merge
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified
  • Check that performance is not impacted (CI Linux results include performance check)
  • Run Unit Test(s) locally
  • Check any new function arguments for performance impacts
  • Verify IDF naming conventions and styles, memos and notes and defaults
  • If new idf included, locally check the err file and other outputs

* 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]
```
@jmarrec jmarrec added Defect Includes code to repair a defect in EnergyPlus Developer Issue Related to cmake, packaging, installers, or developer tooling (CI, etc) labels Dec 22, 2023
@jmarrec jmarrec self-assigned this Dec 22, 2023
@@ -59,6 +59,8 @@ add_library(project_fp_options INTERFACE)

add_library(project_warnings INTERFACE)

add_library(turn_off_warnings INTERFACE)
Copy link
Contributor Author

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

Copy link
Member

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)
Copy link
Contributor Author

@jmarrec jmarrec Dec 22, 2023

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

Comment on lines +71 to +73
unsigned int index = 0;
[[maybe_unused]] unsigned int count_a = 0;
[[maybe_unused]] unsigned int count_b = 0;
Copy link
Contributor Author

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;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

easy warning avoidance.

Comment on lines +206 to 210
# 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
Copy link
Contributor Author

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.

Comment on lines 11 to +20
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
)
Copy link
Contributor Author

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();

Copy link
Member

@Myoldmopar Myoldmopar left a 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)
Copy link
Member

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
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

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__")
Copy link
Member

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()
Copy link
Member

Choose a reason for hiding this comment

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

Yeah.

@Myoldmopar
Copy link
Member

I was getting lots of CMake version warnings:

CMake Deprecation Warning at third_party/gtest/CMakeLists.txt:4 (cmake_minimum_required):
   Compatibility with CMake < 3.5 will be removed from a future version of
   CMake.

   Update the VERSION argument <min> value or use a ...<max> suffix to tell
   CMake that the project does not need compatibility with older versions.

 CMake Deprecation Warning at third_party/gtest/googlemock/CMakeLists.txt:45 (cmake_minimum_required):
   Compatibility with CMake < 3.5 will be removed from a future version of
   CMake.

   Update the VERSION argument <min> value or use a ...<max> suffix to tell
   CMake that the project does not need compatibility with older versions.

 CMake Deprecation Warning at third_party/gtest/googletest/CMakeLists.txt:56 (cmake_minimum_required):
   Compatibility with CMake < 3.5 will be removed from a future version of
   CMake.

   Update the VERSION argument <min> value or use a ...<max> suffix to tell
   CMake that the project does not need compatibility with older versions.

 CMake Deprecation Warning at third_party/DElight/CMakeLists.txt:1 (CMAKE_MINIMUM_REQUIRED):
   Compatibility with CMake < 3.5 will be removed from a future version of
   CMake.

   Update the VERSION argument <min> value or use a ...<max> suffix to tell
   CMake that the project does not need compatibility with older versions.

CMake Deprecation Warning at third_party/Windows-CalcEngine/CMakeLists.txt:1 (cmake_minimum_required):
   Compatibility with CMake < 3.5 will be removed from a future version of
   CMake.

   Update the VERSION argument <min> value or use a ...<max> suffix to tell
   CMake that the project does not need compatibility with older versions.

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.

@Myoldmopar
Copy link
Member

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 !

@Myoldmopar Myoldmopar merged commit 8f96c94 into develop Dec 22, 2023
10 checks passed
@Myoldmopar Myoldmopar deleted the 10345-SushWarnings branch December 22, 2023 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Defect Includes code to repair a defect in EnergyPlus Developer Issue Related to cmake, packaging, installers, or developer tooling (CI, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shush warnings from third_party code?
6 participants