hdf: fix build with clang16+ (#38888)

With the release of clang 16, clang now treats implicit function
declarations and implicit integers as errors rather than warnings,
causing the build to fail. This patch adds flags to prevent build
failures.
This commit is contained in:
Aiden Grossman 2023-07-26 07:29:37 -07:00 committed by GitHub
parent 711d67090a
commit cc0ac7093b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,6 +144,14 @@ def flag_handler(self, name, flags):
elif name == "fflags":
flags.append(self.compiler.f77_pic_flag)
if name == "cflags":
# https://forum.hdfgroup.org/t/help-building-hdf4-with-clang-error-implicit-declaration-of-function-test-mgr-szip-is-invalid-in-c99/7680
if self.spec.satisfies("@:4.2.15 %apple-clang") or self.spec.satisfies("%clang@16:"):
flags.append("-Wno-error=implicit-function-declaration")
if self.spec.satisfies("%clang@16:"):
flags.append("-Wno-error=implicit-int")
return flags, None, None
def configure_args(self):
@ -178,10 +186,6 @@ def configure_args(self):
["FFLAGS=-fallow-argument-mismatch", "FCFLAGS=-fallow-argument-mismatch"]
)
# https://forum.hdfgroup.org/t/help-building-hdf4-with-clang-error-implicit-declaration-of-function-test-mgr-szip-is-invalid-in-c99/7680
if self.spec.satisfies("@:4.2.15 %apple-clang"):
config_args.append("CFLAGS=-Wno-error=implicit-function-declaration")
return config_args
# Otherwise, we randomly get: