[gjs: 4/12] build: Use Meson built-in setting for RTTI




commit c3bd72d86f3f6c83d9c378d98684d58cd07d5f6f
Author: Philip Chimento <philip chimento gmail com>
Date:   Sat Feb 13 14:29:47 2021 -0800

    build: Use Meson built-in setting for RTTI
    
    There's no need to implement our own setting for RTTI, since Meson already
    has a built-in setting. We just set the default to false, since that's
    also the default for SpiderMonkey.

 meson.build       | 28 +++++++++++-----------------
 meson_options.txt |  2 --
 2 files changed, 11 insertions(+), 19 deletions(-)
---
diff --git a/meson.build b/meson.build
index 9850f683..8cc69835 100644
--- a/meson.build
+++ b/meson.build
@@ -4,7 +4,12 @@
 
 project('gjs', 'cpp', 'c', version: '1.67.2', license: ['MIT', 'LGPL2+'],
     meson_version: '>= 0.52.0',
-    default_options: ['cpp_std=c++17', 'c_std=c99', 'warning_level=2'])
+    default_options: ['cpp_std=c++17', 'cpp_rtti=false', 'c_std=c99',
+        'warning_level=2'])
+
+# cpp_rtti: SpiderMonkey can be compiled with or without runtime type
+# information, and the default is without. We must match that option because we
+# need to derive from SpiderMonkey classes.
 
 api_version = '1.0'
 api_name = '@0@-@1@'.format(meson.project_name(), api_version)
@@ -46,7 +51,7 @@ if cc.get_id() == 'msvc'
     ]), language: ['cpp', 'c'])
 else
     # Ignore spurious compiler warnings for things that GLib and SpiderMonkey
-    # header files commonly do 
+    # header files commonly do
     add_project_arguments(cxx.get_supported_arguments([
         '-fno-strict-aliasing',
         '-Wno-variadic-macros',  # GLib uses these in header files
@@ -79,21 +84,10 @@ else
     endif
 endif
 
-# SpiderMonkey can be compiled with or without runtime type information, we must
-# match that option because we need to derive from SpiderMonkey classes
-if get_option('spidermonkey_rtti')
-    if cxx.has_argument('-GR-')
-        add_project_arguments('-GR-', language: 'cpp')  # MSVC/clang-cl option
-    endif
-else
-    if cxx.has_argument('-fno-rtti')
-        add_project_arguments('-fno-rtti', language: 'cpp')
-        # -fno-rtti is not compatible with the vptr sanitizer (part of ubsan)
-        if get_option('b_sanitize') != 'none' and \
-            cxx.has_argument('-fno-sanitize=vptr')
-            add_project_arguments('-fno-sanitize=vptr', language: 'cpp')
-        endif
-    endif
+# -fno-rtti is not compatible with the vptr sanitizer (part of ubsan)
+if not get_option('cpp_rtti') and get_option('b_sanitize') != 'none' and \
+    cxx.has_argument('-fno-sanitize=vptr')
+    add_project_arguments('-fno-sanitize=vptr', language: 'cpp')
 endif
 
 if get_option('verbose_logs')
diff --git a/meson_options.txt b/meson_options.txt
index 70890583..081fac3d 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -20,8 +20,6 @@ option('systemtap', type: 'boolean', value: false,
     description: 'Include systemtap trace support (requires -Ddtrace=true)')
 option('bsymbolic_functions', type: 'boolean', value: true,
     description: 'Link with -Bsymbolic-functions linker flag used to avoid intra-library PLT jumps, if 
supported; not used for Visual Studio and clang-cl builds')
-option('spidermonkey_rtti', type: 'boolean', value: false,
-    description: 'Needs to match SpiderMonkey\'s config option')
 option('skip_dbus_tests', type: 'boolean', value: false,
     description: 'Skip tests that use a DBus session bus')
 option('skip_gtk_tests', type: 'boolean', value: false,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]