aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn S. Urban <urbanjost@comcast.net>2021-07-11 18:16:52 -0400
committerJohn S. Urban <urbanjost@comcast.net>2021-07-11 18:16:52 -0400
commit87271c5a55ad6412114c4b153c1a8d0bd37156f5 (patch)
treee61837e75eeb361af0c3624a7f28169a9d06bf60
parentcca5f83be11f40dd2be86671f8ec14a429540cc9 (diff)
downloadfpm-87271c5a55ad6412114c4b153c1a8d0bd37156f5.tar.gz
fpm-87271c5a55ad6412114c4b153c1a8d0bd37156f5.zip
some more STOP to FPM_STOP conversions
-rw-r--r--src/fpm_command_line.f9016
-rw-r--r--src/fpm_environment.f904
-rw-r--r--src/fpm_targets.f904
3 files changed, 11 insertions, 13 deletions
diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90
index 3146c56..2ed7ac6 100644
--- a/src/fpm_command_line.f90
+++ b/src/fpm_command_line.f90
@@ -31,7 +31,8 @@ use M_CLI2, only : get_subcommand, CLI_RESPONSE_FILE
use fpm_strings, only : lower, split, fnv_1a, to_fortran_name, is_fortran_name
use fpm_filesystem, only : basename, canon_path, which
use fpm_environment, only : run, get_command_arguments_quoted
-use fpm_compiler, only : get_default_compile_flags
+use fpm_compiler, only : get_default_compile_flags
+use fpm_error, only : fpm_stop
use,intrinsic :: iso_fortran_env, only : stdin=>input_unit, &
& stdout=>output_unit, &
& stderr=>error_unit
@@ -139,7 +140,6 @@ contains
end select
version_text = [character(len=80) :: &
& 'Version: 0.3.0, alpha', &
- & 'PR: 511', &
& 'Program: fpm(1)', &
& 'Description: A Fortran package manager and build system', &
& 'Home Page: https://github.com/fortran-lang/fpm', &
@@ -245,17 +245,15 @@ contains
& help_new, version_text)
select case(size(unnamed))
case(1)
- write(stderr,'(*(g0,/))')'<ERROR> directory name required'
write(stderr,'(*(7x,g0,/))') &
& '<USAGE> fpm new NAME [[--lib|--src] [--app] [--test] [--example]]|[--full|--bare] [--backfill]'
- stop 1
+ call fpm_stop(1,'directory name required')
case(2)
name=trim(unnamed(2))
case default
- write(stderr,'(g0)')'<ERROR> only one directory name allowed'
write(stderr,'(7x,g0)') &
& '<USAGE> fpm new NAME [[--lib|--src] [--app] [--test] [--example]]| [--full|--bare] [--backfill]'
- stop 2
+ call fpm_stop(2,'only one directory name allowed')
end select
!*! canon_path is not converting ".", etc.
name=canon_path(name)
@@ -263,7 +261,7 @@ contains
write(stderr,'(g0)') [ character(len=72) :: &
& '<ERROR> the fpm project name must be made of up to 63 ASCII letters,', &
& ' numbers, underscores, or hyphens, and start with a letter.']
- stop 4
+ call fpm_stop(4,' ')
endif
allocate(fpm_new_settings :: cmd_settings)
@@ -272,13 +270,13 @@ contains
write(stderr,'(*(a))')&
&'<ERROR> --full and any of [--src|--lib,--app,--test,--example,--bare]', &
&' are mutually exclusive.'
- stop 5
+ call fpm_stop(5,' ')
elseif (any( specified([character(len=10) :: 'src','lib','app','test','example','full'])) &
& .and.lget('bare') )then
write(stderr,'(*(a))')&
&'<ERROR> --bare and any of [--src|--lib,--app,--test,--example,--full]', &
&' are mutually exclusive.'
- stop 3
+ call fpm_stop(3,' ')
elseif (any( specified([character(len=10) :: 'src','lib','app','test','example']) ) )then
cmd_settings=fpm_new_settings(&
& backfill=lget('backfill'), &
diff --git a/src/fpm_environment.f90 b/src/fpm_environment.f90
index 414c766..e9da3c7 100644
--- a/src/fpm_environment.f90
+++ b/src/fpm_environment.f90
@@ -6,6 +6,7 @@ module fpm_environment
use,intrinsic :: iso_fortran_env, only : stdin=>input_unit, &
& stdout=>output_unit, &
& stderr=>error_unit
+ use fpm_error, only : fpm_stop
implicit none
private
public :: get_os_type
@@ -157,8 +158,7 @@ contains
exitstat = stat
else
if (stat /= 0) then
- print *, 'Command failed'
- stop 1
+ call fpm_stop(1,'*run*:Command failed')
end if
end if
diff --git a/src/fpm_targets.f90 b/src/fpm_targets.f90
index cf368ab..66bbdd5 100644
--- a/src/fpm_targets.f90
+++ b/src/fpm_targets.f90
@@ -25,7 +25,7 @@
!>
module fpm_targets
use iso_fortran_env, only: int64
-use fpm_error, only: error_t, fatal_error
+use fpm_error, only: error_t, fatal_error, fpm_stop
use fpm_model
use fpm_environment, only: get_os_type, OS_WINDOWS
use fpm_filesystem, only: dirname, join_path, canon_path
@@ -298,7 +298,7 @@ subroutine add_target(targets,type,output_file,source,link_libraries)
write(*,*) 'Error while building target list: duplicate output object "',&
output_file,'"'
if (present(source)) write(*,*) ' Source file: "',source%file_name,'"'
- stop 1
+ call fpm_stop(1,' ')
end if