Skip to content

Commit 87271c5

Browse files
committed
some more STOP to FPM_STOP conversions
1 parent cca5f83 commit 87271c5

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

src/fpm_command_line.f90

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ module fpm_command_line
3131
use fpm_strings, only : lower, split, fnv_1a, to_fortran_name, is_fortran_name
3232
use fpm_filesystem, only : basename, canon_path, which
3333
use fpm_environment, only : run, get_command_arguments_quoted
34-
use fpm_compiler, only : get_default_compile_flags
34+
use fpm_compiler, only : get_default_compile_flags
35+
use fpm_error, only : fpm_stop
3536
use,intrinsic :: iso_fortran_env, only : stdin=>input_unit, &
3637
& stdout=>output_unit, &
3738
& stderr=>error_unit
@@ -139,7 +140,6 @@ subroutine get_command_line_settings(cmd_settings)
139140
end select
140141
version_text = [character(len=80) :: &
141142
& 'Version: 0.3.0, alpha', &
142-
& 'PR: 511', &
143143
& 'Program: fpm(1)', &
144144
& 'Description: A Fortran package manager and build system', &
145145
& 'Home Page: https://github.com/fortran-lang/fpm', &
@@ -245,25 +245,23 @@ subroutine get_command_line_settings(cmd_settings)
245245
& help_new, version_text)
246246
select case(size(unnamed))
247247
case(1)
248-
write(stderr,'(*(g0,/))')'<ERROR> directory name required'
249248
write(stderr,'(*(7x,g0,/))') &
250249
& '<USAGE> fpm new NAME [[--lib|--src] [--app] [--test] [--example]]|[--full|--bare] [--backfill]'
251-
stop 1
250+
call fpm_stop(1,'directory name required')
252251
case(2)
253252
name=trim(unnamed(2))
254253
case default
255-
write(stderr,'(g0)')'<ERROR> only one directory name allowed'
256254
write(stderr,'(7x,g0)') &
257255
& '<USAGE> fpm new NAME [[--lib|--src] [--app] [--test] [--example]]| [--full|--bare] [--backfill]'
258-
stop 2
256+
call fpm_stop(2,'only one directory name allowed')
259257
end select
260258
!*! canon_path is not converting ".", etc.
261259
name=canon_path(name)
262260
if( .not.is_fortran_name(to_fortran_name(basename(name))) )then
263261
write(stderr,'(g0)') [ character(len=72) :: &
264262
& '<ERROR> the fpm project name must be made of up to 63 ASCII letters,', &
265263
& ' numbers, underscores, or hyphens, and start with a letter.']
266-
stop 4
264+
call fpm_stop(4,' ')
267265
endif
268266

269267
allocate(fpm_new_settings :: cmd_settings)
@@ -272,13 +270,13 @@ subroutine get_command_line_settings(cmd_settings)
272270
write(stderr,'(*(a))')&
273271
&'<ERROR> --full and any of [--src|--lib,--app,--test,--example,--bare]', &
274272
&' are mutually exclusive.'
275-
stop 5
273+
call fpm_stop(5,' ')
276274
elseif (any( specified([character(len=10) :: 'src','lib','app','test','example','full'])) &
277275
& .and.lget('bare') )then
278276
write(stderr,'(*(a))')&
279277
&'<ERROR> --bare and any of [--src|--lib,--app,--test,--example,--full]', &
280278
&' are mutually exclusive.'
281-
stop 3
279+
call fpm_stop(3,' ')
282280
elseif (any( specified([character(len=10) :: 'src','lib','app','test','example']) ) )then
283281
cmd_settings=fpm_new_settings(&
284282
& backfill=lget('backfill'), &

src/fpm_environment.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module fpm_environment
66
use,intrinsic :: iso_fortran_env, only : stdin=>input_unit, &
77
& stdout=>output_unit, &
88
& stderr=>error_unit
9+
use fpm_error, only : fpm_stop
910
implicit none
1011
private
1112
public :: get_os_type
@@ -157,8 +158,7 @@ subroutine run(cmd,echo,exitstat)
157158
exitstat = stat
158159
else
159160
if (stat /= 0) then
160-
print *, 'Command failed'
161-
stop 1
161+
call fpm_stop(1,'*run*:Command failed')
162162
end if
163163
end if
164164

src/fpm_targets.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
!>
2626
module fpm_targets
2727
use iso_fortran_env, only: int64
28-
use fpm_error, only: error_t, fatal_error
28+
use fpm_error, only: error_t, fatal_error, fpm_stop
2929
use fpm_model
3030
use fpm_environment, only: get_os_type, OS_WINDOWS
3131
use fpm_filesystem, only: dirname, join_path, canon_path
@@ -298,7 +298,7 @@ subroutine add_target(targets,type,output_file,source,link_libraries)
298298
write(*,*) 'Error while building target list: duplicate output object "',&
299299
output_file,'"'
300300
if (present(source)) write(*,*) ' Source file: "',source%file_name,'"'
301-
stop 1
301+
call fpm_stop(1,' ')
302302

303303
end if
304304

0 commit comments

Comments
 (0)