Skip to content

Commit 34a5450

Browse files
authored
Merge pull request #3731 from migueldiascosta/fujitsu_std_cflags
parse C standard flags in CFLAGS for fujitsu compiler
2 parents d99c228 + 16ad408 commit 34a5450

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

easybuild/toolchains/compiler/fujitsu.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
:author: Miguel Dias Costa (National University of Singapore)
3131
"""
3232
import os
33+
import re
3334

3435
import easybuild.tools.environment as env
3536
import easybuild.tools.systemtools as systemtools
@@ -88,6 +89,13 @@ class FujitsuCompiler(Compiler):
8889
def prepare(self, *args, **kwargs):
8990
super(FujitsuCompiler, self).prepare(*args, **kwargs)
9091

92+
# fcc doesn't accept e.g. -std=c++11 or -std=gnu++11, only -std=c11 or -std=gnu11
93+
pattern = r'-std=(gnu|c)\+\+(\d+)'
94+
if re.search(pattern, self.vars['CFLAGS']):
95+
self.log.debug("Found '-std=(gnu|c)++' in CFLAGS, fcc doesn't accept '++' here, removing it")
96+
self.vars['CFLAGS'] = re.sub(pattern, r'-std=\1\2', self.vars['CFLAGS'])
97+
self._setenv_variables()
98+
9199
# make sure the fujitsu module libraries are found (and added to rpath by wrapper)
92100
library_path = os.getenv('LIBRARY_PATH', '')
93101
libdir = os.path.join(os.getenv(TC_CONSTANT_MODULE_VAR), 'lib64')

0 commit comments

Comments
 (0)