Skip to content

Commit 39010da

Browse files
committed
add missing implicit none, set compiler flags to force implicit none
also set minimum CMake version to 3.14 per prior discussion and add example check requiring 3.14: real128
1 parent c789d1f commit 39010da

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

CMakeLists.txt

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
cmake_minimum_required(VERSION 3.5.0)
1+
cmake_minimum_required(VERSION 3.14.0)
22
project(stdlib Fortran)
33
enable_testing()
44

55
# this avoids stdlib and projects using stdlib from having to introspect stdlib's directory structure
6+
# FIXME: this eventually needs to be handled more precisely, as this spills all .mod/.smod into one directory
7+
# and thereby can clash if module/submodule names are the same in different parts of library
68
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR})
79

8-
# compiler feature checks
10+
# --- compiler options
11+
if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
12+
add_compile_options(-fimplicit-none)
13+
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
14+
add_compile_options(-warn declarations)
15+
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL PGI)
16+
add_compile_options(-Mdclchk)
17+
endif()
18+
19+
# --- compiler feature checks
920
include(CheckFortranSourceCompiles)
21+
include(CheckFortranSourceRuns)
1022
check_fortran_source_compiles("error stop i; end" f18errorstop SRC_EXT f90)
23+
check_fortran_source_runs("use, intrinsic :: iso_fortran_env, only : real128; real(real128) :: x; x = x+1; end" f03real128)
1124

1225
add_subdirectory(src)

src/f08estop.f90

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
submodule (stdlib_experimental_error) estop
22

3+
implicit none
4+
35
contains
46

57
module procedure error_stop

src/f18estop.f90

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
submodule (stdlib_experimental_error) estop
22

3+
implicit none
4+
35
contains
46

57
module procedure error_stop

src/tests/ascii/test_ascii.f90

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ program test_ascii
88
is_control, is_punctuation, is_graphical, is_printable, is_ascii, &
99
to_lower, to_upper, LF, TAB, NUL, DEL
1010

11+
implicit none
12+
1113
print *, "Lowercase letters: ", lowercase
1214
print *, "Uppercase letters: ", uppercase
1315
print *, "Digits: ", digits

0 commit comments

Comments
 (0)