For NAG 6.2 and the latest master (f300f4a):
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 72b3d25..6a11a43 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,12 +9,6 @@ set(SRC add_library(fortran_stdlib ${SRC}) -if(f18errorstop) - target_sources(fortran_stdlib PRIVATE f18estop.f90) -else() - target_sources(fortran_stdlib PRIVATE f08estop.f90) -endif() - add_subdirectory(tests) install(TARGETS fortran_stdlib diff --git a/src/stdlib_experimental_error.f90 b/src/stdlib_experimental_error.f90 index 3d932d6..b35083b 100644 --- a/src/stdlib_experimental_error.f90 +++ b/src/stdlib_experimental_error.f90 @@ -3,16 +3,46 @@ use, intrinsic :: iso_fortran_env, only: stderr=>error_unit implicit none private -interface ! f{08,18}estop.f90 -module subroutine error_stop(msg, code) +public :: assert, error_stop + +contains + +subroutine error_stop(msg, code) character(*), intent(in) :: msg integer, intent(in), optional :: code -end subroutine error_stop -end interface -public :: assert, error_stop +! Aborts the program with nonzero exit code +! this is a fallback for Fortran 2008 error stop (e.g. Intel 19.1/2020 compiler) +! +! The "stop <character>" statement generally has return code 0. +! To allow non-zero return code termination with character message, +! error_stop() uses the statement "error stop", which by default +! has exit code 1 and prints the message to stderr. +! An optional integer return code "code" may be specified. +! +! Example +! ------- +! +! call error_stop("Invalid argument") -contains +write(stderr,*) msg + +if(present(code)) then + select case (code) + case (1) + error stop 1 + case (2) + error stop 2 + case (77) + error stop 77 + case default + write(stderr,*) 'ERROR: code ',code,' was specified.' + error stop + end select +else + error stop +endif +end subroutine subroutine assert(condition, code) ! If condition == .false., it aborts the program.
-I
manually:cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_Fortran_FLAGS_DEBUG="-I$HOME/repos/stdlib" .
Everything then builds and tests pass (including quadruple precision).
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4