Skip to content

Commit 4556e7a

Browse files
committed
Apply suggestion: move echo/verbosity into constructors
For compiler_t and archive_t objects
1 parent fc058ec commit 4556e7a

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

src/fpm.f90

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,10 @@ subroutine build_model(model, settings, package, error)
5959
call filewrite(join_path("build", ".gitignore"),["*"])
6060
end if
6161

62-
call new_compiler(model%compiler, settings%compiler, settings%c_compiler)
63-
call new_archiver(model%archiver, settings%archiver)
64-
65-
model%compiler%verbose = settings%verbose
66-
model%compiler%echo = settings%verbose
67-
model%archiver%verbose = settings%verbose
68-
model%archiver%echo = settings%verbose
62+
call new_compiler(model%compiler, settings%compiler, settings%c_compiler, &
63+
& echo=settings%verbose, verbose=settings%verbose)
64+
call new_archiver(model%archiver, settings%archiver, &
65+
& echo=settings%verbose, verbose=settings%verbose)
6966

7067
if (settings%flag == '') then
7168
flags = model%compiler%get_default_flags(settings%profile == "release")

src/fpm_compiler.f90

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -623,16 +623,22 @@ end function enumerate_libraries
623623

624624

625625
!> Create new compiler instance
626-
subroutine new_compiler(self, fc, cc)
626+
subroutine new_compiler(self, fc, cc, echo, verbose)
627627
!> New instance of the compiler
628628
type(compiler_t), intent(out) :: self
629629
!> Fortran compiler name or path
630630
character(len=*), intent(in) :: fc
631631
!> C compiler name or path
632632
character(len=*), intent(in) :: cc
633+
!> Echo compiler command
634+
logical, intent(in) :: echo
635+
!> Verbose mode: dump compiler output
636+
logical, intent(in) :: verbose
633637

634638
self%id = get_compiler_id(fc)
635-
639+
640+
self%echo = echo
641+
self%verbose = verbose
636642
self%fc = fc
637643
if (len_trim(cc) > 0) then
638644
self%cc = cc
@@ -643,11 +649,15 @@ end subroutine new_compiler
643649

644650

645651
!> Create new archiver instance
646-
subroutine new_archiver(self, ar)
652+
subroutine new_archiver(self, ar, echo, verbose)
647653
!> New instance of the archiver
648654
type(archiver_t), intent(out) :: self
649655
!> User provided archiver command
650656
character(len=*), intent(in) :: ar
657+
!> Echo compiler command
658+
logical, intent(in) :: echo
659+
!> Verbose mode: dump compiler output
660+
logical, intent(in) :: verbose
651661

652662
integer :: estat, os_type
653663

@@ -681,7 +691,8 @@ subroutine new_archiver(self, ar)
681691
end if
682692
end if
683693
self%use_response_file = os_type == OS_WINDOWS
684-
self%echo = .true.
694+
self%echo = echo
695+
self%verbose = verbose
685696
end subroutine new_archiver
686697

687698

0 commit comments

Comments
 (0)