From 91205545f0ae22f98d069dcb65ca93f5bdef5053 Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Tue, 11 Jun 2019 08:15:55 -0400 Subject: Add extra logic for C std flags on PGI, XL, and Cray (#11635) --- lib/spack/spack/compilers/cce.py | 23 ++++++++++++++++++++--- lib/spack/spack/compilers/pgi.py | 23 +++++++++++++++++++++-- lib/spack/spack/compilers/xl.py | 18 ++++++++++++++++-- 3 files changed, 57 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/compilers/cce.py b/lib/spack/spack/compilers/cce.py index 349ed394d7..32ccd3f5e2 100644 --- a/lib/spack/spack/compilers/cce.py +++ b/lib/spack/spack/compilers/cce.py @@ -3,10 +3,11 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -import spack.compiler +from spack.compiler import Compiler, UnsupportedCompilerFlag +from spack.version import ver -class Cce(spack.compiler.Compiler): +class Cce(Compiler): """Cray compiler environment compiler.""" # Subclasses use possible names of C compiler cc_names = ['cc'] @@ -44,7 +45,23 @@ class Cce(spack.compiler.Compiler): @property def c99_flag(self): - return "-h c99" + if self.version >= ver('8.4'): + return '-h stc=c99,noconform,gnu' + if self.version >= ver('8.1'): + return '-h c99,noconform,gnu' + raise UnsupportedCompilerFlag(self, + 'the C99 standard', + 'c99_flag', + '< 8.1') + + @property + def c11_flag(self): + if self.version >= ver('8.5'): + return '-h std=c11,noconform,gnu' + raise UnsupportedCompilerFlag(self, + 'the C11 standard', + 'c11_flag', + '< 8.5') @property def pic_flag(self): diff --git a/lib/spack/spack/compilers/pgi.py b/lib/spack/spack/compilers/pgi.py index fdd7748b57..ff3776c0db 100644 --- a/lib/spack/spack/compilers/pgi.py +++ b/lib/spack/spack/compilers/pgi.py @@ -3,10 +3,11 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -import spack.compiler +from spack.compiler import Compiler, UnsupportedCompilerFlag +from spack.version import ver -class Pgi(spack.compiler.Compiler): +class Pgi(Compiler): # Subclasses use possible names of C compiler cc_names = ['pgcc'] @@ -46,3 +47,21 @@ class Pgi(spack.compiler.Compiler): @property def pic_flag(self): return "-fpic" + + @property + def c99_flag(self): + if self.version >= ver('12.10'): + return '-c99' + raise UnsupportedCompilerFlag(self, + 'the C99 standard', + 'c99_flag', + '< 12.10') + + @property + def c11_flag(self): + if self.version >= ver('15.3'): + return '-c11' + raise UnsupportedCompilerFlag(self, + 'the C11 standard', + 'c11_flag', + '< 15.3') diff --git a/lib/spack/spack/compilers/xl.py b/lib/spack/spack/compilers/xl.py index 6e33075408..f82ae31b59 100644 --- a/lib/spack/spack/compilers/xl.py +++ b/lib/spack/spack/compilers/xl.py @@ -45,11 +45,25 @@ class Xl(Compiler): @property def c99_flag(self): - return '-std=c99' + if self.version >= ver('13.1.1'): + return '-std=gnu99' + if self.version >= ver('10.1'): + return '-qlanglvl=extc99' + raise UnsupportedCompilerFlag(self, + 'the C99 standard', + 'c99_flag', + '< 10.1') @property def c11_flag(self): - return '-std=c11' + if self.version >= ver('13.1.2'): + return '-std=gnu11' + if self.version >= ver('12.1'): + return '-qlanglvl=extc1x' + raise UnsupportedCompilerFlag(self, + 'the C11 standard', + 'c11_flag', + '< 12.1') @property def pic_flag(self): -- cgit v1.2.3-60-g2f50