Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing some code warnings in utils #724

Closed
wants to merge 15 commits into from
4 changes: 2 additions & 2 deletions utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (BUILD_D)
if(CMAKE_C_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$")
set_target_properties(copygb2 PROPERTIES COMPILE_FLAGS "-r8 -auto -convert big_endian -fpp")
elseif(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
set_target_properties(copygb2 PROPERTIES COMPILE_FLAGS "-fdefault-real-8 -fconvert=big-endian -cpp")
set_target_properties(copygb2 PROPERTIES COMPILE_FLAGS "-fdefault-real-8 -fconvert=big-endian -cpp -frecursive")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not good to rely on compiler flags. What warnings does this new flag address?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the warning:

Screenshot 2024-07-01 073041

I could also increase the limit like the warning suggests?

endif()

install(TARGETS copygb2 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
Expand Down Expand Up @@ -98,7 +98,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$")
set_target_properties(copygb PROPERTIES COMPILE_FLAGS "-r8 -auto -heap-arrays")
set_target_properties(grbindex PROPERTIES COMPILE_FLAGS "-convert big_endian -fpp")
elseif(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
set_target_properties(copygb PROPERTIES COMPILE_FLAGS "-fdefault-real-8")
set_target_properties(copygb PROPERTIES COMPILE_FLAGS "-fdefault-real-8 -frecursive")
set_target_properties(grbindex PROPERTIES COMPILE_FLAGS "-fconvert=big-endian -cpp")
endif()

Expand Down
9 changes: 3 additions & 6 deletions utils/cnv21.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ subroutine cnv21(ifl1,ifl2)
integer,intent(in) :: ifl1,ifl2

CHARACTER(len=1),allocatable,dimension(:) :: cgrib
CHARACTER(len=8) :: ctemp
type(gribfield) :: gfld
integer,dimension(200) :: jids,jpdt,jgdt
integer :: kpds(200),kgds(200),kens(200),kprob(2)
integer :: kclust(16),kmembr(80)
integer :: currlen=0
integer :: igds(5)=(/0,0,0,0,0/)
real :: xprob(2)
logical*1,target,dimension(1) :: dummy
logical :: unpack=.true.
!
!
Expand Down Expand Up @@ -85,7 +83,7 @@ subroutine cnv21(ifl1,ifl2)
! Construct PDS
!
call makepds(gfld%discipline,gfld%idsect,gfld%ipdtnum, &
gfld%ipdtmpl,gfld%ibmap,gfld%idrtnum, &
gfld%ipdtmpl,gfld%ibmap, &
gfld%idrtmpl,kpds,iret)
if (iret.ne.0) then
print *,'cnv21: could not create pds in GRIB1'
Expand Down Expand Up @@ -231,7 +229,6 @@ end subroutine cnv21
!> @param[in] ipdsnum GRIB2 Product Definition Template Number
!> @param[in] ipdstmpl GRIB2 Product Definition Template entries for PDT 4.ipdsnum
!> @param[in] ibmap GRIB2 bitmap indicator from octet 6, Section 6.
!> @param[in] idrsnum GRIB2 Data Representation Template Number
!> @param[in] idrstmpl GRIB2 Data Representation Template entries
!> @param[out] kpds GRIB1 PDS info as specified in W3FI63.
!> - 1 id of center
Expand Down Expand Up @@ -264,12 +261,12 @@ end subroutine cnv21
!>
!> @author Stephen Gilbert @date 2003-06-12
subroutine makepds(idisc,idsect,ipdsnum,ipdstmpl,ibmap, &
idrsnum,idrstmpl,kpds,iret)
idrstmpl,kpds,iret)

use params

integer,intent(in) :: idsect(*),ipdstmpl(*),idrstmpl(*)
integer,intent(in) :: ipdsnum,idisc,idrsnum,ibmap
integer,intent(in) :: ipdsnum,idisc,ibmap
integer,intent(out) :: kpds(*)
integer,intent(out) :: iret

Expand Down
1 change: 0 additions & 1 deletion utils/cnv22.F90
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ subroutine cnv22(ifl1,ifl2,ipack,usemiss,imiss,table_ver)
integer :: table_ver
logical :: unpack=.true.
logical :: open_grb=.false.
logical*1,target,dimension(1) :: dummy
!
! --- Initialize Variables ---
!
Expand Down
1 change: 0 additions & 1 deletion utils/copygb.F90
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ PROGRAM COPYGB
CHARACTER*256 CARG,CG1,CX1,CGB,CXB,CGM,CXM,CG2,CNL
INTEGER KARG(100), NTHREADS
INTEGER KGDSI(200),IPOPT(20),JPDS1(200),JPDSB(200),IUV(100)
REAL RARG(100)
CHARACTER*400 GDS
DATA NTHREADS/1/
DATA IGI/-1/,KGDSI/19*0,255,180*0/
Expand Down
37 changes: 8 additions & 29 deletions utils/copygb2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ PROGRAM COPYGB2
CHARACTER*256 CARG,CG1,CX1,CGB,CXB,CGM,CXM,CG2,CNL
INTEGER KARG(100)
INTEGER KGDTI(200),IPOPT(20),JPDT(200),JPDSB(200),IUV(100)
REAL RARG(100)
CHARACTER*400 GDS
DATA IGDTN/-1/,KGDTI/200*0/
DATA IP/0/,IPOPT/20*-1/
DATA JPDTN/-1/,JPDT/200*-9999/,JPDSB/200*-1/
Expand Down Expand Up @@ -521,8 +519,7 @@ PROGRAM COPYGB2
ENDIF
CALL CPGB(LG1,LX1,LGB,LXB,LGM,LXM,LG2, &
IGDTN,KGDTI,IP,IPOPT,JPDTN,JPDT,NUV,IUV, &
JPDSB,JB,JBK,LAB,AB,LAM,AM,LXX,LWG, &
IDS,IBS,NBS)
JPDSB,JB,JBK,LAB,AB,LAM,AM,LXX)
IF(LXX.GT.0) THEN
CALL W3TAGE('COPYGB2 ')
ENDIF
Expand Down Expand Up @@ -577,16 +574,11 @@ END SUBROUTINE EUSAGE
!> @param[in] lam integer flag for mask value
!> @param[in] am real mask value
!> @param[in] lxx integer flag for verbose output
!> @param[in] lwg integer flag for stdin selection
!> @param[in] ids integer (255) decimal scaling (-9999 for no change)
!> @param[in] ibs integer (255) binary scaling (-9999 for no change)
!> @param[in] nbs integer (255) number of bits (-9999 for no change)
!>
!> @author Iredell @date 96-07-19
SUBROUTINE CPGB(LG1,LX1,LGB,LXB,LGM,LXM,LG2, &
IGDTN,KGDTI,IP,IPOPT,JPDTN,JPDT,NUV,IUV, &
JPDSB,JB,JBK,LAB,AB,LAM,AM,LXX,LWG, &
IDS,IBS,NBS)
JPDSB,JB,JBK,LAB,AB,LAM,AM,LXX)
USE GRIB_MOD

PARAMETER(MBUF=256*1024)
Expand All @@ -596,11 +588,8 @@ SUBROUTINE CPGB(LG1,LX1,LGB,LXB,LGM,LXM,LG2, &
INTEGER JPDSB(100),IUV(100)
INTEGER KGDTI(200)
INTEGER IPOPT(20)
INTEGER IDS(255),IBS(255),NBS(255)
INTEGER JPDS(200),JGDS(200),JENS(5)
INTEGER JGDS(200),JENS(5)
INTEGER KPDSB(200),KGDSB(200),KENSB(5)
INTEGER KPDSM(200),KGDSM(200),KENSM(5)
CHARACTER*80 CIN
LOGICAL UNPACK
TYPE( GRIBFIELD ) :: GFLD1,GFLDM

Expand Down Expand Up @@ -710,13 +699,12 @@ SUBROUTINE CPGB(LG1,LX1,LGB,LXB,LGM,LXM,LG2, &
IF(LXX.GT.0) CALL INSTRUMENT(1,KALL1,TTOT1,TMIN1,TMAX1)
IF(IGDTN.GE.0.AND.IGDTN.LE.65534) THEN
MF=MAX(M1,MB,MM)
CALL CPGB1(LG1,LX1,M1, &
CALL CPGB1(LG1,LX1, &
MBUF,MF,MI, &
IGDTN,KGDTI,IP,IPOPT,JPDTN,JPDT,NUV,IUV, &
JPDSB,JB,JBK,LAB,AB,LAM,AM, &
IDS,IBS,NBS, &
LGB,LXB,MB,CBUFB,NLENB,NNUMB,MNUMB, &
LGM,LXM,MM, &
LGM,LXM, &
LG2,LXX,KR1-1,NO,IRET1)
ENDIF
IF(LAM.EQ.5) THEN ! clean-up
Expand Down Expand Up @@ -779,7 +767,6 @@ END SUBROUTINE CPGB
!>
!> @param[in] lg1 integer unit number for grib file 1
!> @param[in] lx1 integer unit number for grib index file 1
!> @param[in] m1 integer dimension of grib field 1
!> @param[in] mbuf integer dimension of index buffers
!> @param[in] mf integer dimension of field
!> @param[in] mi integer dimension of output grid
Expand All @@ -798,9 +785,6 @@ END SUBROUTINE CPGB
!> @param[in] ab real map threshold
!> @param[in] lam integer flag for mask value
!> @param[in] am real mask value
!> @param[in] ids integer (255) decimal scaling (-9999 for no change)
!> @param[in] ibs integer (255) binary scaling (-9999 for no change)
!> @param[in] nbs integer (255) number of bits (-9999 for no change)
!> @param[in] lgb integer unit number for grib file map
!> @param[in] lxb integer unit number for grib index file map
!> @param[in] mb integer dimension of grib field map
Expand All @@ -810,21 +794,19 @@ END SUBROUTINE CPGB
!> @param[in] mnumb integer number of index records map skipped
!> @param[in] lgm integer unit number for grib file merge
!> @param[in] lxm integer unit number for grib index file merge
!> @param[in] mm integer dimension of grib field merge
!> @param[in] lg2 integer unit number for grib file 2
!> @param[in] lxx integer flag for verbose output
!> @param[in] ks1 integer input record counter
!> @param[out] no integer output record counter
!> @param[out] iret integer return code
!>
!> @author Iredell @date 96-07-19
SUBROUTINE CPGB1(LG1,LX1,M1, &
SUBROUTINE CPGB1(LG1,LX1, &
MBUF,MF,MI, &
IGDTN,KGDTI,IP,IPOPT,JPDTN,JPDT,NUV,IUV, &
JPDSB,JB,JBK,LAB,AB,LAM,AM, &
IDS,IBS,NBS, &
LGB,LXB,MB,CBUFB,NLENB,NNUMB,MNUMB, &
LGM,LXM,MM, &
LGM,LXM, &
LG2,LXX,KS1,NO,IRET)
USE GRIB_MOD
USE GRIDTEMPLATES
Expand All @@ -835,11 +817,8 @@ SUBROUTINE CPGB1(LG1,LX1,M1, &
INTEGER JJPDT(200)
INTEGER,TARGET :: KGDTI(200)
INTEGER IPOPT(20)
INTEGER IDS(255),IBS(255),NBS(255)
INTEGER JPDS(200),JGDS(200),JENS(5)
INTEGER KPDS1(200),KGDS1(200),KENS1(5)
INTEGER JGDS(200),JENS(5)
INTEGER KPDSB(200),KGDSB(200),KENSB(5)
INTEGER KPDSM(200),KGDSM(200),KENSM(5)
INTEGER,POINTER :: TMPPTR(:)
LOGICAL*1 LR(MF)
LOGICAL*1,POINTER :: L1I(:),LBI(:)
Expand Down
Loading
Loading