From 4556e7a4435c6ef2da8782c033229e06e91b6a4e Mon Sep 17 00:00:00 2001 From: Laurence Kedward Date: Sun, 28 Nov 2021 11:11:11 +0000 Subject: Apply suggestion: move echo/verbosity into constructors For compiler_t and archive_t objects --- src/fpm.f90 | 11 ++++------- src/fpm_compiler.f90 | 19 +++++++++++++++---- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/fpm.f90 b/src/fpm.f90 index 8b05a38..135cadc 100644 --- a/src/fpm.f90 +++ b/src/fpm.f90 @@ -59,13 +59,10 @@ subroutine build_model(model, settings, package, error) call filewrite(join_path("build", ".gitignore"),["*"]) end if - call new_compiler(model%compiler, settings%compiler, settings%c_compiler) - call new_archiver(model%archiver, settings%archiver) - - model%compiler%verbose = settings%verbose - model%compiler%echo = settings%verbose - model%archiver%verbose = settings%verbose - model%archiver%echo = settings%verbose + call new_compiler(model%compiler, settings%compiler, settings%c_compiler, & + & echo=settings%verbose, verbose=settings%verbose) + call new_archiver(model%archiver, settings%archiver, & + & echo=settings%verbose, verbose=settings%verbose) if (settings%flag == '') then flags = model%compiler%get_default_flags(settings%profile == "release") diff --git a/src/fpm_compiler.f90 b/src/fpm_compiler.f90 index dba21b2..2f939ad 100644 --- a/src/fpm_compiler.f90 +++ b/src/fpm_compiler.f90 @@ -623,16 +623,22 @@ end function enumerate_libraries !> Create new compiler instance -subroutine new_compiler(self, fc, cc) +subroutine new_compiler(self, fc, cc, echo, verbose) !> New instance of the compiler type(compiler_t), intent(out) :: self !> Fortran compiler name or path character(len=*), intent(in) :: fc !> C compiler name or path character(len=*), intent(in) :: cc + !> Echo compiler command + logical, intent(in) :: echo + !> Verbose mode: dump compiler output + logical, intent(in) :: verbose self%id = get_compiler_id(fc) - + + self%echo = echo + self%verbose = verbose self%fc = fc if (len_trim(cc) > 0) then self%cc = cc @@ -643,11 +649,15 @@ end subroutine new_compiler !> Create new archiver instance -subroutine new_archiver(self, ar) +subroutine new_archiver(self, ar, echo, verbose) !> New instance of the archiver type(archiver_t), intent(out) :: self !> User provided archiver command character(len=*), intent(in) :: ar + !> Echo compiler command + logical, intent(in) :: echo + !> Verbose mode: dump compiler output + logical, intent(in) :: verbose integer :: estat, os_type @@ -681,7 +691,8 @@ subroutine new_archiver(self, ar) end if end if self%use_response_file = os_type == OS_WINDOWS - self%echo = .true. + self%echo = echo + self%verbose = verbose end subroutine new_archiver -- cgit v1.2.3