Skip to content

Commit

Permalink
Enable Floating point exceptions by default in Debug mode (?)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarrec committed Jun 19, 2024
1 parent 3c8844f commit 91879ba
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions cmake/CompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,13 @@ elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" O

set(need_arithm_debug_genex "$<OR:$<BOOL:${FORCE_DEBUG_ARITHM_GCC_OR_CLANG}>,$<CONFIG:Debug>>")

# TODO: after we fix all tests, remove this if statement (keeping the block to always execute) to enable this by default on Debug builds
if (FORCE_DEBUG_ARITHM_GCC_OR_CLANG)
# in main.cc for E+ and gtest: feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW)
target_compile_definitions(project_fp_options INTERFACE $<${need_arithm_debug_genex}:DEBUG_ARITHM_GCC_OR_CLANG>)
include(CheckCXXSymbolExists)
check_cxx_symbol_exists(feenableexcept "fenv.h" HAVE_FEENABLEEXCEPT)
message(VERBOSE "HAVE_FEENABLEEXCEPT=${HAVE_FEENABLEEXCEPT}")
if(HAVE_FEENABLEEXCEPT)
target_compile_definitions(project_fp_options INTERFACE HAVE_FEENABLEEXCEPT)
endif()
# in main.cc for E+ and gtest: feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW)
target_compile_definitions(project_fp_options INTERFACE $<${need_arithm_debug_genex}:DEBUG_ARITHM_GCC_OR_CLANG>)
include(CheckCXXSymbolExists)
check_cxx_symbol_exists(feenableexcept "fenv.h" HAVE_FEENABLEEXCEPT)
message(VERBOSE "HAVE_FEENABLEEXCEPT=${HAVE_FEENABLEEXCEPT}")
if(HAVE_FEENABLEEXCEPT)
target_compile_definitions(project_fp_options INTERFACE HAVE_FEENABLEEXCEPT)
endif()

# ADDITIONAL GCC-SPECIFIC FLAGS
Expand Down

5 comments on commit 91879ba

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

enable_fe_default_debug (jmarrec) - Win64-Windows-10-VisualStudio-16: OK (2808 of 2808 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

enable_fe_default_debug (jmarrec) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3638 of 3638 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

enable_fe_default_debug (jmarrec) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (1990 of 2019 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1500
  • NUMERICAL: 26

SQLiteFixture Test Summary

  • Passed: 98
  • NUMERICAL: 2

ZoneUnitarySysTest Test Summary

  • Passed: 26
  • NUMERICAL: 1

Build Badge Test Badge Coverage Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

enable_fe_default_debug (jmarrec) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (792 of 792 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

enable_fe_default_debug (jmarrec) - x86_64-MacOS-10.18-clang-15.0.0: OK (3597 of 3597 tests passed, 0 test warnings)

Build Badge Test Badge

Please sign in to comment.