gFTL icon indicating copy to clipboard operation
gFTL copied to clipboard

Add ifdef/undef/endif to unused.inc

Open mathomp4 opened this issue 5 years ago • 1 comments

In trying to build MAPL with GCC9 recently, I saw quite a few of these:

[ 54%] Building Fortran object MAPL_Base/CMakeFiles/MAPL_Base.dir/MAPL_ESMFTimeVectorMod.F90.o
/discover/swdev/gmao_SIteam/Baselibs/ESMA-Baselibs-6.0.4-SLES11/x86_64-unknown-linux-gnu/gfortran_9.1.0-openmpi_4.0.1/Linux/GFTL-1.2/include/templates/unused.inc:10:0:

   10 | #define _UNUSED_DUMMY(dummy) if (.false.) print*,shape(dummy)
      | 
Warning: "_UNUSED_DUMMY" redefined
/discover/swdev/mathomp4/Models/MAPL-MAPL20-Cleanup-GCC9/MAPL/MAPL_Base/unused_dummy.H:13:0:

   13 | #define _UNUSED_DUMMY(x) if (.false.) print*,shape(x)
      | 
note: this is the location of the previous definition

I believe this is due to unused.inc being just a #define without the usual quartet:

#ifdef FOO
#undef FOO
#endif
#define FOO

Thus in some files in MAPL that used templates/vector.inc, say, they pick up this new (nigh-identical) macro.

Note: something perhaps should/could be added to all_macros_undef.inc as well? I see it exists but gFTL is more complex than I'm used to.

mathomp4 avatar Jan 23 '20 19:01 mathomp4

I concur, and believe the expedient fix is to add a block as you describe. Assigning myself, but feel free to scoop me.

tclune avatar Jan 23 '20 19:01 tclune