Compilers: Chain-up to parent class in get_options()
Parent class could have common options for all compilers, and we'll soon add some.
This commit is contained in:
parent
3c4c8bf775
commit
6eeea9dd54
|
@ -931,10 +931,12 @@ class ClangCCompiler(ClangCompiler, CCompiler):
|
|||
'3': default_warn_args + ['-Wextra', '-Wpedantic']}
|
||||
|
||||
def get_options(self):
|
||||
return {'c_std': coredata.UserComboOption('c_std', 'C language standard to use',
|
||||
['none', 'c89', 'c99', 'c11',
|
||||
'gnu89', 'gnu99', 'gnu11'],
|
||||
'none')}
|
||||
opts = CCompiler.get_options(self)
|
||||
opts.update({'c_std': coredata.UserComboOption('c_std', 'C language standard to use',
|
||||
['none', 'c89', 'c99', 'c11',
|
||||
'gnu89', 'gnu99', 'gnu11'],
|
||||
'none')})
|
||||
return opts
|
||||
|
||||
def get_option_compile_args(self, options):
|
||||
args = []
|
||||
|
@ -963,10 +965,11 @@ class GnuCCompiler(GnuCompiler, CCompiler):
|
|||
'3': default_warn_args + ['-Wextra', '-Wpedantic']}
|
||||
|
||||
def get_options(self):
|
||||
opts = {'c_std': coredata.UserComboOption('c_std', 'C language standard to use',
|
||||
['none', 'c89', 'c99', 'c11',
|
||||
'gnu89', 'gnu99', 'gnu11'],
|
||||
'none')}
|
||||
opts = CCompiler.get_options(self)
|
||||
opts.update({'c_std': coredata.UserComboOption('c_std', 'C language standard to use',
|
||||
['none', 'c89', 'c99', 'c11',
|
||||
'gnu89', 'gnu99', 'gnu11'],
|
||||
'none')})
|
||||
if self.gcc_type == GCC_MINGW:
|
||||
opts.update({
|
||||
'c_winlibs': coredata.UserArrayOption('c_winlibs', 'Standard Win libraries to link against',
|
||||
|
@ -999,11 +1002,12 @@ class ElbrusCCompiler(GnuCCompiler, ElbrusCompiler):
|
|||
|
||||
# It does support some various ISO standards and c/gnu 90, 9x, 1x in addition to those which GNU CC supports.
|
||||
def get_options(self):
|
||||
opts = {'c_std': coredata.UserComboOption('c_std', 'C language standard to use',
|
||||
['none', 'c89', 'c90', 'c9x', 'c99', 'c1x', 'c11',
|
||||
'gnu89', 'gnu90', 'gnu9x', 'gnu99', 'gnu1x', 'gnu11',
|
||||
'iso9899:2011', 'iso9899:1990', 'iso9899:199409', 'iso9899:1999'],
|
||||
'none')}
|
||||
opts = CCompiler.get_options(self)
|
||||
opts.update({'c_std': coredata.UserComboOption('c_std', 'C language standard to use',
|
||||
['none', 'c89', 'c90', 'c9x', 'c99', 'c1x', 'c11',
|
||||
'gnu89', 'gnu90', 'gnu9x', 'gnu99', 'gnu1x', 'gnu11',
|
||||
'iso9899:2011', 'iso9899:1990', 'iso9899:199409', 'iso9899:1999'],
|
||||
'none')})
|
||||
return opts
|
||||
|
||||
# Elbrus C compiler does not have lchmod, but there is only linker warning, not compiler error.
|
||||
|
@ -1026,13 +1030,14 @@ class IntelCCompiler(IntelCompiler, CCompiler):
|
|||
'3': default_warn_args + ['-Wextra', '-Wpedantic']}
|
||||
|
||||
def get_options(self):
|
||||
opts = CCompiler.get_options(self)
|
||||
c_stds = ['c89', 'c99']
|
||||
g_stds = ['gnu89', 'gnu99']
|
||||
if version_compare(self.version, '>=16.0.0'):
|
||||
c_stds += ['c11']
|
||||
opts = {'c_std': coredata.UserComboOption('c_std', 'C language standard to use',
|
||||
['none'] + c_stds + g_stds,
|
||||
'none')}
|
||||
opts.update({'c_std': coredata.UserComboOption('c_std', 'C language standard to use',
|
||||
['none'] + c_stds + g_stds,
|
||||
'none')})
|
||||
return opts
|
||||
|
||||
def get_option_compile_args(self, options):
|
||||
|
@ -1171,10 +1176,11 @@ class VisualStudioCCompiler(CCompiler):
|
|||
return []
|
||||
|
||||
def get_options(self):
|
||||
return {'c_winlibs': coredata.UserArrayOption('c_winlibs',
|
||||
'Windows libs to link against.',
|
||||
msvc_winlibs)
|
||||
}
|
||||
opts = CCompiler.get_options(self)
|
||||
opts.update({'c_winlibs': coredata.UserArrayOption('c_winlibs',
|
||||
'Windows libs to link against.',
|
||||
msvc_winlibs)})
|
||||
return opts
|
||||
|
||||
def get_option_link_args(self, options):
|
||||
return options['c_winlibs'].value[:]
|
||||
|
@ -1295,9 +1301,10 @@ class ArmCCompiler(ArmCompiler, CCompiler):
|
|||
ArmCompiler.__init__(self)
|
||||
|
||||
def get_options(self):
|
||||
opts = {'c_std': coredata.UserComboOption('c_std', 'C language standard to use',
|
||||
['none', 'c90', 'c99'],
|
||||
'none')}
|
||||
opts = CCompiler.get_options(self)
|
||||
opts.update({'c_std': coredata.UserComboOption('c_std', 'C language standard to use',
|
||||
['none', 'c90', 'c99'],
|
||||
'none')})
|
||||
return opts
|
||||
|
||||
def get_option_compile_args(self, options):
|
||||
|
|
|
@ -78,10 +78,12 @@ class ClangCPPCompiler(ClangCompiler, CPPCompiler):
|
|||
'3': default_warn_args + ['-Wextra', '-Wpedantic']}
|
||||
|
||||
def get_options(self):
|
||||
return {'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
|
||||
['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z',
|
||||
'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z'],
|
||||
'none')}
|
||||
opts = CPPCompiler.get_options(self)
|
||||
opts.update({'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
|
||||
['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z',
|
||||
'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z'],
|
||||
'none')})
|
||||
return opts
|
||||
|
||||
def get_option_compile_args(self, options):
|
||||
args = []
|
||||
|
@ -107,13 +109,14 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler):
|
|||
'3': default_warn_args + ['-Wextra', '-Wpedantic']}
|
||||
|
||||
def get_options(self):
|
||||
opts = {'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
|
||||
['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z',
|
||||
'gnu++03', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z'],
|
||||
'none'),
|
||||
'cpp_debugstl': coredata.UserBooleanOption('cpp_debugstl',
|
||||
'STL debug mode',
|
||||
False)}
|
||||
opts = CPPCompiler.get_options(self)
|
||||
opts.update({'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
|
||||
['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z',
|
||||
'gnu++03', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z'],
|
||||
'none'),
|
||||
'cpp_debugstl': coredata.UserBooleanOption('cpp_debugstl',
|
||||
'STL debug mode',
|
||||
False)})
|
||||
if self.gcc_type == GCC_MINGW:
|
||||
opts.update({
|
||||
'cpp_winlibs': coredata.UserArrayOption('cpp_winlibs', 'Standard Win libraries to link against',
|
||||
|
@ -148,7 +151,7 @@ class ElbrusCPPCompiler(GnuCPPCompiler, ElbrusCompiler):
|
|||
|
||||
# It does not support c++/gnu++ 17 and 1z, but still does support 0x, 1y, and gnu++98.
|
||||
def get_options(self):
|
||||
opts = super().get_options()
|
||||
opts = CPPCompiler.get_options(self)
|
||||
opts['cpp_std'] = coredata.UserComboOption('cpp_std', 'C++ language standard to use',
|
||||
['none', 'c++98', 'c++03', 'c++0x', 'c++11', 'c++14', 'c++1y',
|
||||
'gnu++98', 'gnu++03', 'gnu++0x', 'gnu++11', 'gnu++14', 'gnu++1y'],
|
||||
|
@ -176,6 +179,7 @@ class IntelCPPCompiler(IntelCompiler, CPPCompiler):
|
|||
'3': default_warn_args + ['-Wextra', '-Wpedantic']}
|
||||
|
||||
def get_options(self):
|
||||
opts = CPPCompiler.get_options(self)
|
||||
c_stds = []
|
||||
g_stds = ['gnu++98']
|
||||
if version_compare(self.version, '>=15.0.0'):
|
||||
|
@ -185,12 +189,12 @@ class IntelCPPCompiler(IntelCompiler, CPPCompiler):
|
|||
c_stds += ['c++17']
|
||||
if version_compare(self.version, '>=17.0.0'):
|
||||
g_stds += ['gnu++14']
|
||||
opts = {'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
|
||||
['none'] + c_stds + g_stds,
|
||||
'none'),
|
||||
'cpp_debugstl': coredata.UserBooleanOption('cpp_debugstl',
|
||||
'STL debug mode',
|
||||
False)}
|
||||
opts.update({'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
|
||||
['none'] + c_stds + g_stds,
|
||||
'none'),
|
||||
'cpp_debugstl': coredata.UserBooleanOption('cpp_debugstl',
|
||||
'STL debug mode',
|
||||
False)})
|
||||
return opts
|
||||
|
||||
def get_option_compile_args(self, options):
|
||||
|
@ -213,14 +217,15 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler):
|
|||
self.base_options = ['b_pch'] # FIXME add lto, pgo and the like
|
||||
|
||||
def get_options(self):
|
||||
return {'cpp_eh': coredata.UserComboOption('cpp_eh',
|
||||
'C++ exception handling type.',
|
||||
['none', 'a', 's', 'sc'],
|
||||
'sc'),
|
||||
'cpp_winlibs': coredata.UserArrayOption('cpp_winlibs',
|
||||
'Windows libs to link against.',
|
||||
msvc_winlibs)
|
||||
}
|
||||
opts = CPPCompiler.get_options(self)
|
||||
opts.update({'cpp_eh': coredata.UserComboOption('cpp_eh',
|
||||
'C++ exception handling type.',
|
||||
['none', 'a', 's', 'sc'],
|
||||
'sc'),
|
||||
'cpp_winlibs': coredata.UserArrayOption('cpp_winlibs',
|
||||
'Windows libs to link against.',
|
||||
msvc_winlibs)})
|
||||
return opts
|
||||
|
||||
def get_option_compile_args(self, options):
|
||||
args = []
|
||||
|
@ -244,9 +249,10 @@ class ArmCPPCompiler(ArmCompiler, CPPCompiler):
|
|||
ArmCompiler.__init__(self)
|
||||
|
||||
def get_options(self):
|
||||
opts = {'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
|
||||
['none', 'c++03', 'c++11'],
|
||||
'none')}
|
||||
opts = CPPCompiler.get_options(self)
|
||||
opts.update({'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
|
||||
['none', 'c++03', 'c++11'],
|
||||
'none')})
|
||||
return opts
|
||||
|
||||
def get_option_compile_args(self, options):
|
||||
|
|
Loading…
Reference in New Issue