Skip to content

Commit 05b30f9

Browse files
Fix ifort truncated_source warning to error issue (#238)
* Explicitly list warn types, instead of all. * Arrange intel warn options alphabetically
1 parent 2720b0b commit 05b30f9

File tree

2 files changed

+6
-27
lines changed

2 files changed

+6
-27
lines changed

deps/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ ${CMAKE_Fortran_DEBUG_FLAGS}"
2323
)
2424
elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
2525
set(OPS_DEFAULT_Fortran_FLAGS "\
26-
-warn all \
27-
-warn errors \
28-
-warn notruncated_source \
29-
-warn nointerfaces \
26+
-warn alignments,declarations,errors,general,ignore_loc,nointerfaces,notruncated_source,shape,stderrors,uncalled,unused,usage \
3027
-implicitnone \
3128
-traceback \
3229
-integer-size 64 \

deps/ops/CMakeLists.txt

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -90,22 +90,8 @@ set(OPS_SOURCE_FILES
9090
stubs/OpsMod_Control/OpsMod_Control.f90
9191
)
9292

93-
# Intel inserts lines in the source during pre-processing that contain the source file path, if the pathname
94-
# is long enough it can take the source line to more than 132 characters and trigger a compile warning.
95-
# If -warn errors is on this creates an invalid compile failure, so suppress this warning for these files to allow
96-
# compilation to proceed.
97-
if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
98-
set_source_files_properties(public/GenMod_Platform/GenMod_Platform.F90 PROPERTIES COMPILE_FLAGS "-warn noerrors")
99-
set_source_files_properties(public/GenMod_Core/GenMod_Core.F90 PROPERTIES COMPILE_FLAGS "-warn noerrors")
100-
set_source_files_properties(public/GenMod_Control/GenMod_Setup.F90 PROPERTIES COMPILE_FLAGS "-warn noerrors")
101-
set_source_files_properties(public/Ops_Constants/GenMod_MiscUMScienceConstants.f90 PROPERTIES COMPILE_FLAGS "-warn noerrors")
102-
set_source_files_properties(code/GenMod_ModelIO/GenMod_ModelIO.F90 PROPERTIES COMPILE_FLAGS "-warn noerrors")
103-
set_source_files_properties(code/OpsMod_GatherSpread/OpsMod_GatherSpread.F90 PROPERTIES COMPILE_FLAGS "-warn noerrors")
104-
set_source_files_properties(code/OpsProg_Utils/OpsProg_PrintCXFile.F90 PROPERTIES COMPILE_FLAGS "-warn noerrors")
105-
endif()
106-
10793
# Collect the list of source directories (which will be added to the include path).
108-
foreach (file ${OPS_SOURCE_FILES})
94+
foreach(file ${OPS_SOURCE_FILES})
10995
get_filename_component(dir "${file}" DIRECTORY)
11096
list(APPEND OPS_SOURCE_DIRS "${dir}")
11197
endforeach()
@@ -142,10 +128,8 @@ target_compile_definitions(ops PRIVATE
142128
_LARGEFILE_SOURCE
143129
)
144130

145-
if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
146-
target_compile_definitions(ops PRIVATE
147-
IFORT_ALLOCATABLE_CHARACTER_BUG
148-
)
131+
if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
132+
target_compile_definitions(ops PRIVATE IFORT_ALLOCATABLE_CHARACTER_BUG)
149133
endif()
150134

151135
target_link_libraries(ops
@@ -192,10 +176,8 @@ target_compile_definitions(ops_serial PRIVATE
192176
_LARGEFILE_SOURCE
193177
)
194178

195-
if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
196-
target_compile_definitions(ops_serial PRIVATE
197-
IFORT_ALLOCATABLE_CHARACTER_BUG
198-
)
179+
if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
180+
target_compile_definitions(ops_serial PRIVATE IFORT_ALLOCATABLE_CHARACTER_BUG)
199181
endif()
200182

201183
target_link_libraries(ops_serial

0 commit comments

Comments
 (0)