Bug 1896063 - Move _MOZ_USE_RTTI to moz.configure r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D210009
This commit is contained in:
serge-sans-paille 2024-05-23 12:31:07 +00:00
parent 51cd916c25
commit 29440c6680
2 changed files with 11 additions and 23 deletions

View File

@ -4,31 +4,9 @@ dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
dnl Add compiler specific options
dnl ============================================================================
dnl C++ rtti
dnl We don't use it in the code, but it can be usefull for debugging, so give
dnl the user the option of enabling it.
dnl ============================================================================
AC_DEFUN([MOZ_RTTI],
[
if test -z "$_MOZ_USE_RTTI"; then
if test "$GNU_CC"; then
CXXFLAGS="$CXXFLAGS -fno-rtti"
else
case "$target" in
*-mingw*)
CXXFLAGS="$CXXFLAGS -GR-"
esac
fi
fi
])
dnl A high level macro for selecting compiler options.
AC_DEFUN([MOZ_COMPILER_OPTS],
[
MOZ_RTTI
if test "$GNU_CC"; then
if test -z "$DEVELOPER_OPTIONS"; then
CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"

View File

@ -3310,9 +3310,19 @@ def nm_names(toolchain_prefix, c_compiler):
check_prog("NM", nm_names, paths=clang_search_path, when=target_has_linux_kernel)
# We don't use it in the code, but it can be useful for debugging, so give
# the user the option of enabling it.
option("--enable-cpp-rtti", help="Enable C++ RTTI")
add_old_configure_assignment("_MOZ_USE_RTTI", "1", when="--enable-cpp-rtti")
@depends(compilation_flags, c_compiler, "--enable-cpp-rtti")
def enable_cpp_rtti(compilation_flags, c_compiler, enable_rtti):
if enable_rtti:
return
if c_compiler.type == "clang-cl":
compilation_flags.cxxflags.append("-GR-")
else:
compilation_flags.cxxflags.append("-fno-rtti")
option(