Skip to content

Commit

Permalink
add more compiler runtime checks and enable by default (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
letmaik authored Sep 12, 2018
1 parent 5afd684 commit f41ca41
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ if (NOT CMAKE_CONFIGURATION_TYPES) # ignore for multi-config generators like MSV
endif()

set(ARCH_CUSTOM "" CACHE STRING "Name of custom architecture configuration to use")
option(DISABLE_RUNTIME_CHECKS "Disable compiler runtime checks in Release mode" OFF)
option(DEBUG_ARCH "Print arch files debug information" OFF)
option(DEBUG_GLOBAL_DEFINITIONS "Print global preprocessor definitions applied to all source files" OFF)

Expand Down Expand Up @@ -124,6 +125,11 @@ set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${Fortran_checked}")
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${Fortran_optimized}")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${Fortran_preprocess} ${Fortran_io} ${Fortran_other}")

if (NOT DISABLE_RUNTIME_CHECKS)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${C_checked}")
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${Fortran_checked}")
endif()

if (SAVE_TEMPS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_temps}")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${Fortran_temps}")
Expand Down
2 changes: 1 addition & 1 deletion cmake/arch/default/GNU_Fortran.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright 2018 M. Riechert and D. Meyer. Licensed under the MIT License.

set(checked "-fbounds-check")
set(checked "-fcheck=bounds,do,mem,pointer")
set(preprocess "-cpp")
set(io "-fconvert=big-endian -frecord-marker=4")
set(other "-ffree-line-length-none")
2 changes: 1 addition & 1 deletion cmake/arch/default/Intel_Fortran_UNIX.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright 2018 M. Riechert and D. Meyer. Licensed under the MIT License.

set(checked "-check bounds")
set(checked "-check noarg_temp_created,bounds,format,output_conversion,pointers,uninit")
set(preprocess "-fpp")
set(io "-convert big_endian -assume byterecl")
set(optimized "-align all -fno-alias")
Expand Down

0 comments on commit f41ca41

Please sign in to comment.