summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Atkins <chuck.atkins@kitware.com>2019-06-11 08:15:55 -0400
committerAxel Huebl <axel.huebl@plasma.ninja>2019-06-11 14:15:55 +0200
commit91205545f0ae22f98d069dcb65ca93f5bdef5053 (patch)
tree43be31b1fff279a49545b2811bcd47da08442f60
parenta998fa25b0337c67d7426bc13185c4bd04414ab4 (diff)
downloadspack-91205545f0ae22f98d069dcb65ca93f5bdef5053.tar.gz
spack-91205545f0ae22f98d069dcb65ca93f5bdef5053.tar.bz2
spack-91205545f0ae22f98d069dcb65ca93f5bdef5053.tar.xz
spack-91205545f0ae22f98d069dcb65ca93f5bdef5053.zip
Add extra logic for C std flags on PGI, XL, and Cray (#11635)
-rw-r--r--lib/spack/spack/compilers/cce.py23
-rw-r--r--lib/spack/spack/compilers/pgi.py23
-rw-r--r--lib/spack/spack/compilers/xl.py18
3 files changed, 57 insertions, 7 deletions
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):