From 22043617aa31b67edbbbe3892846bdbef9f8cd4f Mon Sep 17 00:00:00 2001 From: Stephen Sachs Date: Fri, 11 Oct 2024 02:25:32 +0200 Subject: [PATCH] libunistring: 1.2 needs std=c18 for icc, add icc C++ flags update (#37607) --- lib/spack/spack/compilers/intel.py | 8 ++++++++ lib/spack/spack/test/compilers/basics.py | 4 ++++ var/spack/repos/builtin/packages/libunistring/package.py | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/lib/spack/spack/compilers/intel.py b/lib/spack/spack/compilers/intel.py index 3cae5e5873d..4990da3cb06 100644 --- a/lib/spack/spack/compilers/intel.py +++ b/lib/spack/spack/compilers/intel.py @@ -92,6 +92,14 @@ def c11_flag(self): else: return "-std=c1x" + @property + def c18_flag(self): + # c18 supported since oneapi 2022, which is classic version 2021.5.0 + if self.real_version < Version("21.5.0"): + raise UnsupportedCompilerFlag(self, "the C18 standard", "c18_flag", "< 21.5.0") + else: + return "-std=c18" + @property def cc_pic_flag(self): return "-fPIC" diff --git a/lib/spack/spack/test/compilers/basics.py b/lib/spack/spack/test/compilers/basics.py index 65c05ccbdf3..ee31e50f538 100644 --- a/lib/spack/spack/test/compilers/basics.py +++ b/lib/spack/spack/test/compilers/basics.py @@ -461,9 +461,13 @@ def test_intel_flags(): unsupported_flag_test("cxx14_flag", "intel@=14.0") supported_flag_test("cxx14_flag", "-std=c++1y", "intel@=15.0") supported_flag_test("cxx14_flag", "-std=c++14", "intel@=15.0.2") + unsupported_flag_test("cxx17_flag", "intel@=18") + supported_flag_test("cxx17_flag", "-std=c++17", "intel@=19.0") unsupported_flag_test("c99_flag", "intel@=11.0") supported_flag_test("c99_flag", "-std=c99", "intel@=12.0") unsupported_flag_test("c11_flag", "intel@=15.0") + supported_flag_test("c18_flag", "-std=c18", "intel@=21.5.0") + unsupported_flag_test("c18_flag", "intel@=21.4.0") supported_flag_test("c11_flag", "-std=c1x", "intel@=16.0") supported_flag_test("cc_pic_flag", "-fPIC", "intel@=1.0") supported_flag_test("cxx_pic_flag", "-fPIC", "intel@=1.0") diff --git a/var/spack/repos/builtin/packages/libunistring/package.py b/var/spack/repos/builtin/packages/libunistring/package.py index 1a634202d51..86155050fc6 100644 --- a/var/spack/repos/builtin/packages/libunistring/package.py +++ b/var/spack/repos/builtin/packages/libunistring/package.py @@ -46,6 +46,11 @@ def patch(self): # https://bugs.gentoo.org/688464#c9 (this links to all further info) filter_file("# pragma weak pthread_create", "", "tests/glthread/thread.h") + def flag_handler(self, name, flags): + if name == "cflags" and self.spec.satisfies("@1.1:") and self.spec.satisfies("%intel"): + flags.append(self.compiler.c18_flag) + return (flags, None, None) + @when("@master") def autoreconf(self, spec, prefix): which("./gitsub.sh")("pull")