Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e46d9ad

Browse files
error_stop: remove incorrect/obsolete code
I originally authored this routine, which is updated for supported compilers. The logic selecting it in CMake was no longer relevant.
1 parent dd81cf5 commit e46d9ad

File tree

6 files changed

+37
-92
lines changed

6 files changed

+37
-92
lines changed

‎CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ include(CheckFortranSourceCompiles)
4646
include(CheckFortranSourceRuns)
4747
check_fortran_source_runs("i=0; error stop i; end" f18errorstop)
4848
check_fortran_source_compiles("real, allocatable :: array(:, :, :, :, :, :, :, :, :, :); end" f03rank SRC_EXT f90)
49-
check_fortran_source_runs("use, intrinsic :: iso_fortran_env, only : real128; real(real128) :: x; x = x+1; end" f03real128)
49+
# check_fortran_source_runs("use, intrinsic :: iso_fortran_env, only : real128; real(real128) :: x; x = x+1; end" f03real128)
5050

5151
if(NOT DEFINED CMAKE_MAXIMUM_RANK)
5252
set(CMAKE_MAXIMUM_RANK 4 CACHE STRING "Maximum array rank for generated procedures")

‎src/CMakeLists.txt‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ set(fppFiles
1414
stdlib_sorting.fypp
1515
stdlib_sorting_ord_sort.fypp
1616
stdlib_sorting_sort.fypp
17-
stdlib_sorting_sort_index.fypp
17+
stdlib_sorting_sort_index.fypp
1818
stdlib_stats.fypp
1919
stdlib_stats_corr.fypp
2020
stdlib_stats_cov.fypp
@@ -69,12 +69,6 @@ target_include_directories(${PROJECT_NAME} PUBLIC
6969
$<INSTALL_INTERFACE:${CMAKE_INSTALL_MODULEDIR}>
7070
)
7171

72-
if(f18errorstop)
73-
target_sources(${PROJECT_NAME} PRIVATE f18estop.f90)
74-
else()
75-
target_sources(${PROJECT_NAME} PRIVATE f08estop.f90)
76-
endif()
77-
7872
add_subdirectory(tests)
7973

8074
install(TARGETS ${PROJECT_NAME}

‎src/Makefile.manual‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ SRCFYPP =\
3131
stdlib_stats_distribution_PRNG.fypp \
3232
stdlib_string_type.fypp
3333

34-
SRC = f18estop.f90 \
35-
stdlib_error.f90 \
34+
SRC = stdlib_error.f90 \
3635
stdlib_specialfunctions.f90 \
3736
stdlib_specialfunctions_legendre.f90 \
3837
stdlib_io.f90 \
@@ -67,7 +66,6 @@ $(SRCGEN): %.f90: %.fypp common.fypp
6766
fypp $(FYPPFLAGS) $< $@
6867

6968
# Fortran module dependencies
70-
f18estop.o: stdlib_error.o
7169
stdlib_ascii.o: stdlib_kinds.o
7270
stdlib_bitsets.o: stdlib_kinds.o
7371
stdlib_bitsets_64.o: stdlib_bitsets.o

‎src/f08estop.f90‎

Lines changed: 0 additions & 41 deletions
This file was deleted.

‎src/f18estop.f90‎

Lines changed: 0 additions & 29 deletions
This file was deleted.

‎src/stdlib_error.f90‎

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,44 @@ module stdlib_error
66
implicit none
77
private
88

9-
interface ! f{08,18}estop.f90
10-
module subroutine error_stop(msg, code)
11-
!! version: experimental
12-
!!
13-
!! Provides a call to `error stop` and allows the user to specify a code and message
14-
!! ([Specification](..//page/specs/stdlib_error.html#description_1))
15-
character(*), intent(in) :: msg
16-
integer, intent(in), optional :: code
17-
end subroutine error_stop
18-
end interface
19-
209
public :: check, error_stop
2110

2211
contains
2312

13+
14+
subroutine error_stop(msg, code)
15+
!! version: experimental
16+
!!
17+
!! Provides a call to `error stop` and allows the user to specify a code and message
18+
!! ([Specification](..//page/specs/stdlib_error.html#description_1))
19+
!!
20+
!! Aborts the program with nonzero exit code.
21+
!! The "stop <character>" statement generally has return code 0.
22+
!! To allow non-zero return code termination with character message,
23+
!! error_stop() uses the statement "error stop", which by default
24+
!! has exit code 1 and prints the message to stderr.
25+
!! An optional integer return code "code" may be specified.
26+
!!
27+
!!##### Examples
28+
!!
29+
!!```fortran
30+
!! call error_stop("Invalid argument")
31+
!!```
32+
!!```fortran
33+
!! call error_stop("Invalid argument", 123)
34+
!!```
35+
36+
character(*), intent(in) :: msg
37+
integer, intent(in), optional :: code
38+
39+
if(.not.present(code)) error stop msg
40+
41+
write(stderr, '(a)') msg
42+
error stop code
43+
44+
end subroutine error_stop
45+
46+
2447
subroutine check(condition, msg, code, warn)
2548
!! version: experimental
2649
!!

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /