[petsc-dev] preprocessor for Fortran?
Smith, Barry F.
bsmith at mcs.anl.gov
Sun Aug 11 16:43:58 CDT 2019
Matt and Satish,
Years ago we had to sometimes use the C preprocessor for preprocessor Fortran code. Isn't that no longer needed?
In FC.py there is
class Preprocessor(config.compile.C.Preprocessor):
'''The Fortran preprocessor, which now is just the C preprocessor'''
def __init__(self, argDB):
config.compile.C.Preprocessor.__init__(self, argDB)
self.language = 'FC'
self.targetExtension = '.F90'
self.includeDirectories = sets.Set()
return
class Compiler(config.compile.processor.Processor):
'''The Fortran compiler'''
which implies that C preprocessor is still handing around the Fortran. Now when all the Fortran compiler flags are generated with getFlags() it seems to include those from CPPFLAGS?
Is this correct now? I don't think it should be? Should there be a separate FCCPPFLAGS? Bad things happen in the current situation when I set CPPFLAGS needed for clang but not for gfortran when MPICH is configured the CPPFLAGS are passed to the FCFLAGS which breaks things.
I cannot find the exact line of code when the FFLAGS and CPPFLAGS are merged together for Fortran but I assume it is
def getFlags(self):
'''Returns a string with the flags specified for running this processor.'''
if not hasattr(self, '_flags'):
flagsName = self.flagsName[:]
if self.name == self.compiler.name:
flagsName.extend(self.compiler.flagsName)
if hasattr(self, 'configCompilers'):
flags = ' '.join([getattr(self.configCompilers, name) for name in flagsName])
else:
flags = ' '.join([self.argDB[name] for name in flagsName])
return flags
return self._flags
flags = property(getFlags, config.compile.processor.Processor.setFlags, doc = 'The flags for the executable')
How can this be fixed?
Thanks
Barry
More information about the petsc-dev
mailing list