From 1daab55b87e2e4d55c005751ed143ababa20bf02 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Tue, 19 May 2015 19:01:58 +0000 Subject: [PATCH] support F03 intrinsics for argument capture use Fortran 2003 intrinsics COMMAND_ARGUMENT_COUNT and GET_COMMAND_ARGUMENT instead of the non-portable iargc and getarg routines. this code is unused unless the user sets USE_FORTRAN2003 in their compilation environment. --- src/input/GNUmakefile | 3 +++ src/input/get_inp_file.F | 6 +++++- src/util/GNUmakefile | 6 +++++- src/util/util_getarg.F | 4 ++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/input/GNUmakefile b/src/input/GNUmakefile index a5c13556d0..2ffbc29af4 100644 --- a/src/input/GNUmakefile +++ b/src/input/GNUmakefile @@ -45,6 +45,9 @@ ifeq ($(HOSTNAME),cu0login5) LIB_DEFINES += -DDFLT_TOT_MEM=419430400 endif +ifdef USE_FORTRAN2003 + LIB_DEFINES += -DUSE_FORTRAN2003 +endif # END_WIN32_IGNORE diff --git a/src/input/get_inp_file.F b/src/input/get_inp_file.F index 2444c4087a..9f966de10b 100644 --- a/src/input/get_inp_file.F +++ b/src/input/get_inp_file.F @@ -27,7 +27,7 @@ c external ipxfargc nargs =ipxfargc() #else -#if defined(EXT_INT) +#if defined(EXT_INT) && !defined(USE_FORTRAN2003) integer*4 iargc #else integer iargc @@ -36,7 +36,11 @@ c external iargc #endif c +#if defined(USE_FORTRAN2003) + nargs = command_argument_count() +#else nargs = iargc() +#endif #endif do arg = 1, nargs call util_getarg(arg,test) diff --git a/src/util/GNUmakefile b/src/util/GNUmakefile index 28acb07ca4..320adf3783 100644 --- a/src/util/GNUmakefile +++ b/src/util/GNUmakefile @@ -174,7 +174,7 @@ endif fortchar.o seq_output.o ga_mat2col.o \ util_ch_brd.o two_ind_trn.o \ util_pname.o sread.o swrite.o \ - banner.o util_print.o util_module_avail.o \ + banner.o util_print.o \ util_version.o util_nwchem_version.o util_ga_version.o \ util_nwchem_paper.o util_nwchem_srcdir.o utilc_nwchem_srcdir.o \ mk_fit_xf.o \ @@ -286,6 +286,10 @@ ifdef TCE_CUDA OBJ += util_cuda_support.o endif +ifdef USE_FORTRAN2003 + LIB_DEFINES += -DUSE_FORTRAN2003 +endif + include ../config/makelib.h diff --git a/src/util/util_getarg.F b/src/util/util_getarg.F index ce70790d70..d050e734c1 100644 --- a/src/util/util_getarg.F +++ b/src/util/util_getarg.F @@ -8,6 +8,9 @@ #include "errquit.fh" integer iarg_in character*(*) arg +#if defined(USE_FORTRAN2003) + call get_command_argument(iarg_in,arg) +#else #if defined(EXT_INT) && !( __GNUC__ >= 4) integer*4 iarg #else @@ -40,5 +43,6 @@ c call getarg(iarg,arg) #endif * +#endif return end