add C standard flags to compiler classes (#11618)

* add c99_flag, c11_flag to compiler class

* implement c99_flag, c11_flag for gcc

* implement c99_flag, c11_flag for arm

* implement c99_flag for cce

* implement c99_flag, c11_flag for clang

* implement c99_flag, c11_flag for intel

* implement c99_flag, c11_flag for xl
This commit is contained in:
Justin S 2019-06-05 04:43:11 -05:00 committed by Axel Huebl
parent b3379a8890
commit 4ac64e6cd8
7 changed files with 90 additions and 0 deletions

View file

@ -195,6 +195,24 @@ def cxx17_flag(self):
"the C++17 standard", "the C++17 standard",
"cxx17_flag") "cxx17_flag")
# This property should be overridden in the compiler subclass if
# C99 is supported by that compiler
@property
def c99_flag(self):
# If it is not overridden, assume it is not supported and warn the user
raise UnsupportedCompilerFlag(self,
"the C99 standard",
"c99_flag")
# This property should be overridden in the compiler subclass if
# C11 is supported by that compiler
@property
def c11_flag(self):
# If it is not overridden, assume it is not supported and warn the user
raise UnsupportedCompilerFlag(self,
"the C11 standard",
"c11_flag")
# #
# Compiler classes have methods for querying the version of # Compiler classes have methods for querying the version of
# specific compiler executables. This is used when discovering compilers. # specific compiler executables. This is used when discovering compilers.

View file

@ -53,6 +53,14 @@ def cxx14_flag(self):
def cxx17_flag(self): def cxx17_flag(self):
return "-std=c++1z" return "-std=c++1z"
@property
def c99_flag(self):
return "-std=c99"
@property
def c11_flag(self):
return "-std=c11"
@property @property
def pic_flag(self): def pic_flag(self):
return "-fPIC" return "-fPIC"

View file

@ -42,6 +42,10 @@ def openmp_flag(self):
def cxx11_flag(self): def cxx11_flag(self):
return "-h std=c++11" return "-h std=c++11"
@property
def c99_flag(self):
return "-h c99"
@property @property
def pic_flag(self): def pic_flag(self):
return "-h PIC" return "-h PIC"

View file

@ -157,6 +157,20 @@ def cxx17_flag(self):
else: else:
return "-std=c++17" return "-std=c++17"
@property
def c99_flag(self):
return '-std=c99'
@property
def c11_flag(self):
if self.version < ver('6.1.0'):
raise UnsupportedCompilerFlag(self,
"the C11 standard",
"c11_flag",
"< 3.3")
else:
return "-std=c11"
@property @property
def pic_flag(self): def pic_flag(self):
return "-fPIC" return "-fPIC"

View file

@ -87,6 +87,24 @@ def cxx17_flag(self):
else: else:
return "-std=c++17" return "-std=c++17"
@property
def c99_flag(self):
if self.version < ver('4.5'):
raise UnsupportedCompilerFlag(self,
"the C99 standard",
"c99_flag",
"< 4.5")
return "-std=c99"
@property
def c11_flag(self):
if self.version < ver('4.7'):
raise UnsupportedCompilerFlag(self,
"the C11 standard",
"c11_flag",
"< 4.7")
return "-std=c11"
@property @property
def pic_flag(self): def pic_flag(self):
return "-fPIC" return "-fPIC"

View file

@ -65,6 +65,26 @@ def cxx14_flag(self):
else: else:
return "-std=c++14" return "-std=c++14"
@property
def c99_flag(self):
if self.version < ver('12'):
raise UnsupportedCompilerFlag(self,
"the C99 standard",
"c99_flag",
"< 12")
else:
return "-std=c99"
@property
def c11_flag(self):
if self.version < ver('16'):
raise UnsupportedCompilerFlag(self,
"the C11 standard",
"c11_flag",
"< 16")
else:
return "-std=c1x"
@property @property
def pic_flag(self): def pic_flag(self):
return "-fPIC" return "-fPIC"

View file

@ -43,6 +43,14 @@ def cxx11_flag(self):
else: else:
return "-qlanglvl=extended0x" return "-qlanglvl=extended0x"
@property
def c99_flag(self):
return '-std=c99'
@property
def c11_flag(self):
return '-std=c11'
@property @property
def pic_flag(self): def pic_flag(self):
return "-qpic" return "-qpic"