Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Improved GNU warning flags in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed May 25, 2023
1 parent 8c9e052 commit 54869be
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cmake/Modules/SetFortranFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,20 @@ SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
"/warn:all" # Intel Windows
"-Wall" # GNU
)
# This enables some extra warning flags that are not enabled by -Wall
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
Fortran "-Wextra" # GNU
)

# Disable the warning that arrays may be uninitialized, which comes up due to a known bug in gfortran
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
Fortran "-Wno-maybe-uninitialized" # GNU
)
# Disable the warning about unused dummy arguments. These primarily occur due to interface rules for type-bound procedures used in extendable types.
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
Fortran "-Wno-unused-dummy-argument" # GNU
)


# Traceback
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
Expand Down Expand Up @@ -241,6 +255,11 @@ SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
"-ffpe-trap=zero,overflow,underflow" # GNU
)

# List of floating-point exceptions, whose flag status is printed to ERROR_UNIT when invoking STOP and ERROR STOP
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
Fortran "-ffpe-summary=all" # GNU
)

# Enables floating-point invalid, divide-by-zero, and overflow exceptions
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
Fortran "-fpe0" # Intel
Expand Down

0 comments on commit 54869be

Please sign in to comment.