From 1dc39391a75502ebec4c679eed99b92b62739149 Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Fri, 27 Jul 2018 16:50:01 -0600 Subject: [PATCH 1/2] Add -Wextra -Wno-compare-reals gfortran flags -Wall does not actually turn on ALL warnings, so we include -Wextra as well. However, -Wextra flags checking for equality between two reals with the warning Equality comparison for REAL(8) at (1) And we want to allow those checks, so we also include -Wno-compare-reals. These extra checks picked up on a few unused parameters (mostly "subname" being declared in a subroutine and then never used) --- src/Makefile | 2 +- src/marbl_diagnostics_mod.F90 | 4 ---- src/marbl_init_mod.F90 | 2 -- src/marbl_interface.F90 | 2 -- tests/driver_src/Makefile | 2 +- 5 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/Makefile b/src/Makefile index 04a7607f..850f13e7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -108,7 +108,7 @@ all : gnu .PHONY: gnu gnu: - $(MAKE) -f $(MAKE_DIR)/Makefile $(LIB_DIR)/libmarbl-gnu$(MPISUF).a USE_DEPS=TRUE FC=gfortran FCFLAGS="-Wall -Werror -O2 -ffree-form -J $(OBJ_DIR)/gnu$(MPISUF) -cpp" OBJ_DIR=$(OBJ_DIR)/gnu$(MPISUF) INC_DIR=$(INC_DIR)/gnu$(MPISUF) + $(MAKE) -f $(MAKE_DIR)/Makefile $(LIB_DIR)/libmarbl-gnu$(MPISUF).a USE_DEPS=TRUE FC=gfortran FCFLAGS="-Wall -Wextra -Wno-compare-reals -Werror -O2 -ffree-form -J $(OBJ_DIR)/gnu$(MPISUF) -cpp" OBJ_DIR=$(OBJ_DIR)/gnu$(MPISUF) INC_DIR=$(INC_DIR)/gnu$(MPISUF) .PHONY: intel intel: diff --git a/src/marbl_diagnostics_mod.F90 b/src/marbl_diagnostics_mod.F90 index 12a88535..07ce0afa 100644 --- a/src/marbl_diagnostics_mod.F90 +++ b/src/marbl_diagnostics_mod.F90 @@ -4296,8 +4296,6 @@ subroutine marbl_diagnostics_set_surface_forcing( & !----------------------------------------------------------------------- ! local variables !----------------------------------------------------------------------- - character(len=*), parameter :: subname = 'marbl_diagnostics_mod:marbl_diagnostics_set_surface_forcing' - !----------------------------------------------------------------------- !----------------------------------------------------------------------- ! calculate gas flux quantities if necessary @@ -5762,8 +5760,6 @@ subroutine store_diagnostics_ciso_surface_forcing( & !----------------------------------------------------------------------- ! local variables !----------------------------------------------------------------------- - character(len=*), parameter :: subname = 'marbl_diagnostics_mod:store_diagnostics_ciso_surface_forcing' - !----------------------------------------------------------------------- associate( & diags => marbl_surface_forcing_diags%diags, & diff --git a/src/marbl_init_mod.F90 b/src/marbl_init_mod.F90 index 0a284ed0..dca94bda 100644 --- a/src/marbl_init_mod.F90 +++ b/src/marbl_init_mod.F90 @@ -227,8 +227,6 @@ subroutine marbl_init_tracer_metadata(marbl_tracer_metadata, marbl_tracer_indice ! local variables !----------------------------------------------------------------------- - character(len=*), parameter :: subname = 'marbl_init_mod:marbl_init_tracer_metadata' - integer (int_kind) :: n ! index for looping over tracers integer (int_kind) :: zoo_ind ! zooplankton functional group index integer (int_kind) :: auto_ind ! autotroph functional group index diff --git a/src/marbl_interface.F90 b/src/marbl_interface.F90 index 0567bcc5..0c7fa332 100644 --- a/src/marbl_interface.F90 +++ b/src/marbl_interface.F90 @@ -736,8 +736,6 @@ subroutine inquire_settings_metadata_by_id(this, id, sname, lname, units, dataty character(len=*), optional, intent(out) :: sname, lname, units character(len=*), optional, intent(out) :: datatype - character(len=*), parameter :: subname = 'marbl_interface:inquire_settings_metadata_by_id' - call this%settings%inquire_metadata(id, & sname = sname, & lname = lname, & diff --git a/tests/driver_src/Makefile b/tests/driver_src/Makefile index b8f805e5..dcca9854 100644 --- a/tests/driver_src/Makefile +++ b/tests/driver_src/Makefile @@ -125,7 +125,7 @@ all: gnu .PHONY: gnu gnu: - $(MAKE) -f $(MAKE_DIR)/Makefile $(EXE) COMP_NAME=gnu$(MPISUF) FC=gfortran FCFLAGS="-Wall -Werror -O2 -ffree-form -cpp" INC="-J $(OBJ_ROOT)/gnu$(MPISUF)" INC2="-J $(OBJ_ROOT)/gnu$(MPISUF)/driver" + $(MAKE) -f $(MAKE_DIR)/Makefile $(EXE) COMP_NAME=gnu$(MPISUF) FC=gfortran FCFLAGS="-Wall -Wextra -Wno-compare-reals -Werror -O2 -ffree-form -cpp" INC="-J $(OBJ_ROOT)/gnu$(MPISUF)" INC2="-J $(OBJ_ROOT)/gnu$(MPISUF)/driver" .PHONY: intel intel: From 160383149589963048665e14756c50b450b6f3db Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Mon, 30 Jul 2018 08:34:47 -0600 Subject: [PATCH 2/2] Clean up some comments --- src/marbl_diagnostics_mod.F90 | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/marbl_diagnostics_mod.F90 b/src/marbl_diagnostics_mod.F90 index 07ce0afa..9ca6ba6f 100644 --- a/src/marbl_diagnostics_mod.F90 +++ b/src/marbl_diagnostics_mod.F90 @@ -4293,14 +4293,6 @@ subroutine marbl_diagnostics_set_surface_forcing( & type(marbl_surface_forcing_internal_type) , intent(in) :: surface_forcing_internal type(marbl_diagnostics_type) , intent(inout) :: surface_forcing_diags - !----------------------------------------------------------------------- - ! local variables - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - ! calculate gas flux quantities if necessary - !----------------------------------------------------------------------- - associate( & ind_diag => marbl_surface_forcing_diag_ind, & ind_forc => surface_forcing_ind, & @@ -4353,6 +4345,10 @@ subroutine marbl_diagnostics_set_surface_forcing( & docr_ind => marbl_tracer_indices%docr_ind & ) + !----------------------------------------------------------------------- + ! calculate gas flux quantities if necessary + !----------------------------------------------------------------------- + if (lflux_gas_o2 .or. lflux_gas_co2) then diags(ind_diag%ECOSYS_IFRAC)%field_2d(:) = ifrac(:) @@ -4575,6 +4571,7 @@ subroutine store_diagnostics_autotrophs(marbl_domain, & real(r8) :: autotrophC_weight(marbl_domain%km) real(r8) :: autotrophC_zint_100m real(r8) :: limterm(marbl_domain%km) + !----------------------------------------------------------------------- associate( & diags => marbl_interior_diags%diags, & @@ -5757,19 +5754,11 @@ subroutine store_diagnostics_ciso_surface_forcing( & real (r8), dimension(num_elements) , intent(in) :: eps_dic_g_surf ! equilibrium fractionation between total DIC and gaseous CO2 type(marbl_diagnostics_type) , intent(inout) :: marbl_surface_forcing_diags - !----------------------------------------------------------------------- - ! local variables - !----------------------------------------------------------------------- - associate( & diags => marbl_surface_forcing_diags%diags, & ind => marbl_surface_forcing_diag_ind & ) - !----------------------------------------------------------------------- - ! Tavg variables - !----------------------------------------------------------------------- - diags(ind%CISO_DI13C_GAS_FLUX)%field_2d(:) = FLUX13(:) diags(ind%CISO_DI14C_GAS_FLUX)%field_2d(:) = FLUX14(:)