summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/hdf5
diff options
context:
space:
mode:
authorChris White <white238@llnl.gov>2021-04-30 15:04:06 -0700
committerGitHub <noreply@github.com>2021-04-30 15:04:06 -0700
commitd8390ee2fb42f2b7c45df1333810751907472523 (patch)
tree1463de1d88552b0474dd38c168b57a64a66d284f /var/spack/repos/builtin/packages/hdf5
parent46bce56cef6aa5cbea591adc47b2bb5dd2344939 (diff)
downloadspack-d8390ee2fb42f2b7c45df1333810751907472523.tar.gz
spack-d8390ee2fb42f2b7c45df1333810751907472523.tar.bz2
spack-d8390ee2fb42f2b7c45df1333810751907472523.tar.xz
spack-d8390ee2fb42f2b7c45df1333810751907472523.zip
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
Diffstat (limited to 'var/spack/repos/builtin/packages/hdf5')
-rw-r--r--var/spack/repos/builtin/packages/hdf5/package.py37
1 files changed, 21 insertions, 16 deletions
diff --git a/var/spack/repos/builtin/packages/hdf5/package.py b/var/spack/repos/builtin/packages/hdf5/package.py
index d4c8b916ac..b51e5d9167 100644
--- a/var/spack/repos/builtin/packages/hdf5/package.py
+++ b/var/spack/repos/builtin/packages/hdf5/package.py
@@ -298,22 +298,6 @@ class Hdf5(AutotoolsPackage):
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 @@ class Hdf5(AutotoolsPackage):
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')