HDF5: Suppress promoted warning that causes build failure on clang and gcc (#23354)

* simplify compiler flag logic and suppress warning that gets promoted to an error on certain files in gcc/clang
This commit is contained in:
Chris White 2021-04-30 15:04:06 -07:00 committed by GitHub
parent 46bce56cef
commit d8390ee2fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -298,22 +298,6 @@ def configure_args(self):
extra_args.append('--disable-shared')
extra_args.append('--enable-static-exec')
if '+pic' in self.spec:
# use global spack compiler flags
_flags = self.compiler.cc_pic_flag
_flags += " " + ' '.join(self.spec.compiler_flags['cflags'])
extra_args.append('CFLAGS={0}'.format(_flags))
if '+cxx' in self.spec:
_flags = self.compiler.cxx_pic_flag
_flags += " " + ' '.join(self.spec.compiler_flags['cxxflags'])
extra_args.append('CXXFLAGS={0}'.format(_flags))
if '+fortran' in self.spec:
_flags = self.compiler.fc_pic_flag
_flags += " " + ' '.join(self.spec.compiler_flags['fflags'])
extra_args.append('FCFLAGS={0}'.format(_flags))
# Fujitsu Compiler does not add Fortran runtime in rpath.
if '+fortran %fj' in self.spec:
extra_args.append('LDFLAGS=-lfj90i -lfj90f -lfjsrcinfo -lelf')
@ -333,6 +317,27 @@ def configure_args(self):
if '+fortran' in self.spec:
extra_args.append('FC=%s' % self.spec['mpi'].mpifc)
# Append package specific compiler flags to the global ones
cflags = ' '.join(self.spec.compiler_flags['cflags'])
cxxflags = ' '.join(self.spec.compiler_flags['cxxflags'])
fflags = ' '.join(self.spec.compiler_flags['fflags'])
if '+pic' in self.spec:
cflags += " " + self.compiler.cc_pic_flag
cxxflags += " " + self.compiler.cxx_pic_flag
fflags += " " + self.compiler.fc_pic_flag
# Quiet warnings/errors about implicit declaration of functions in C99
if "clang" in self.compiler.cc or "gcc" in self.compiler.cc:
cflags += " -Wno-implicit-function-declaration"
if cflags:
extra_args.append('CFLAGS={0}'.format(cflags))
if cxxflags and '+cxx' in self.spec:
extra_args.append('CXXFLAGS={0}'.format(cxxflags))
if fflags and '+fortran' in self.spec:
extra_args.append('FCFLAGS={0}'.format(fflags))
return extra_args
@run_after('configure')