diff options
author | nicole mazzuca <mazzucan@outlook.com> | 2019-05-05 11:19:04 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-05-05 21:19:04 +0300 |
commit | 24d5c73b0a55b83bbc6120a322b16808ec1c1118 (patch) | |
tree | a362ba829599aafdeec7033173a20ca5fad622d6 /mesonbuild/compilers/cpp.py | |
parent | 261878f438261585daa637e147c37dc60922afb1 (diff) | |
download | meson-24d5c73b0a55b83bbc6120a322b16808ec1c1118.zip meson-24d5c73b0a55b83bbc6120a322b16808ec1c1118.tar.gz meson-24d5c73b0a55b83bbc6120a322b16808ec1c1118.tar.bz2 |
add -fno-exceptions if cpp_eh=none is specified
Diffstat (limited to 'mesonbuild/compilers/cpp.py')
-rw-r--r-- | mesonbuild/compilers/cpp.py | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index e2bcaf0..a089a5b 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -142,7 +142,11 @@ class ClangCPPCompiler(ClangCompiler, CPPCompiler): def get_options(self): opts = CPPCompiler.get_options(self) - opts.update({'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use', + opts.update({'cpp_eh': coredata.UserComboOption('cpp_eh', + 'C++ exception handling type.', + ['none', 'default'], + 'default'), + 'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use', ['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z', 'c++2a', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z', 'gnu++2a'], 'none')}) @@ -153,6 +157,8 @@ class ClangCPPCompiler(ClangCompiler, CPPCompiler): std = options['cpp_std'] if std.value != 'none': args.append(self._find_best_cpp_std(std.value)) + if options['cpp_eh'].value == 'none': + args.append('-fno-exceptions') return args def get_option_link_args(self, options): @@ -174,7 +180,11 @@ class ArmclangCPPCompiler(ArmclangCompiler, CPPCompiler): def get_options(self): opts = CPPCompiler.get_options(self) - opts.update({'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use', + opts.update({'cpp_eh': coredata.UserComboOption('cpp_eh', + 'C++ exception handling type.', + ['none', 'default'], + 'default'), + 'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use', ['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'gnu++98', 'gnu++03', 'gnu++11', 'gnu++14', 'gnu++17'], 'none')}) @@ -185,6 +195,8 @@ class ArmclangCPPCompiler(ArmclangCompiler, CPPCompiler): std = options['cpp_std'] if std.value != 'none': args.append('-std=' + std.value) + if options['cpp_eh'].value == 'none': + args.append('-fno-exceptions') return args def get_option_link_args(self, options): @@ -203,7 +215,11 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): def get_options(self): opts = CPPCompiler.get_options(self) - opts.update({'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use', + opts.update({'cpp_eh': coredata.UserComboOption('cpp_eh', + 'C++ exception handling type.', + ['none', 'default'], + 'default'), + 'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use', ['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z', 'c++2a', 'gnu++03', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z', 'gnu++2a'], 'none'), @@ -221,6 +237,8 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): std = options['cpp_std'] if std.value != 'none': args.append(self._find_best_cpp_std(std.value)) + if options['cpp_eh'].value == 'none': + args.append('-fno-exceptions') if options['cpp_debugstl'].value: args.append('-D_GLIBCXX_DEBUG=1') return args @@ -251,7 +269,11 @@ 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 = CPPCompiler.get_options(self) - opts.update({'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use', + opts.update({'cpp_eh': coredata.UserComboOption('cpp_eh', + 'C++ exception handling type.', + ['none', 'default'], + 'default'), + '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'], 'none'), @@ -297,7 +319,11 @@ class IntelCPPCompiler(IntelCompiler, CPPCompiler): c_stds += ['c++17'] if version_compare(self.version, '>=17.0.0'): g_stds += ['gnu++14'] - opts.update({'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use', + opts.update({'cpp_eh': coredata.UserComboOption('cpp_eh', + 'C++ exception handling type.', + ['none', 'default'], + 'default'), + 'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use', ['none'] + c_stds + g_stds, 'none'), 'cpp_debugstl': coredata.UserBooleanOption('cpp_debugstl', @@ -314,6 +340,8 @@ class IntelCPPCompiler(IntelCompiler, CPPCompiler): 'gnu++03': 'gnu++98' } args.append('-std=' + remap_cpp03.get(std.value, std.value)) + if options['cpp_eh'].value == 'none': + args.append('-fno-exceptions') if options['cpp_debugstl'].value: args.append('-D_GLIBCXX_DEBUG=1') return args @@ -343,8 +371,8 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler): opts = CPPCompiler.get_options(self) opts.update({'cpp_eh': coredata.UserComboOption('cpp_eh', 'C++ exception handling type.', - ['none', 'a', 's', 'sc'], - 'sc'), + ['none', 'a', 's', 'sc', 'default'], + 'default'), 'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use', cpp_stds, @@ -358,7 +386,9 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler): args = [] eh = options['cpp_eh'] - if eh.value != 'none': + if eh.value == 'default': + args.append('/EHsc') + elif eh.value != 'none': args.append('/EH' + eh.value) vc_version_map = { |