Bug 1523851 - Remove the dynamic_cast<void*> test. r=froydnj
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 30 Jan 2019 14:25:33 +0000
changeset 456233 699954de14e37c54a20651b01351365c30c5f932
parent 456232 697b9cab7789cb0b5701a636efbecbf24f211ad4
child 456234 d7d0d7ad4c0bc5dad1031d2101dd2e46777f9f7c
push id111603
push userrmaries@mozilla.com
push dateThu, 31 Jan 2019 17:05:49 +0000
treeherdermozilla-inbound@81112cc261ce [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1523851
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1523851 - Remove the dynamic_cast<void*> test. r=froydnj It relies on AC_TRY_RUN, which doesn't work on cross-compiles. What this means is that the feature has been disabled on mac builds on automation ever since we switched to cross-compiles. It's still enabled on local mac builds because the test runs there, and returns "yes". It also means it's disabled on Android, where it probably works (at least debug tests on try don't complain). It also doesn't currently run on Windows because it's in a skipped section on Windows, but if moved out of that section, the test returns "no". So, we remove any configure test for the feature, in favor of preprocessor checks in nsTraceRefcnt.cpp. Depends on D18055 Differential Revision: https://phabricator.services.mozilla.com/D18056
js/src/old-configure.in
old-configure.in
xpcom/base/nsTraceRefcnt.cpp
xpcom/xpcom-config.h.in
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -1146,40 +1146,16 @@ if test "$GNU_CC"; then
     else
         ARM_ABI_PREFIX=oabi-
     fi
   fi
 
   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
 fi
 
-dnl See if a dynamic_cast to void* gives the most derived object.
-AC_CACHE_CHECK(for C++ dynamic_cast to void*,
-               ac_cv_cpp_dynamic_cast_void_ptr,
-               [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
-                            class Y { int j; public: virtual ~Y() { } };
-                            class Z : public X, public Y { int k; };
-
-                            int main() {
-                                 Z mdo;
-                                 X *subx = (X*)&mdo;
-                                 Y *suby = (Y*)&mdo;
-                                 return !((((void*)&mdo != (void*)subx) &&
-                                           ((void*)&mdo == dynamic_cast<void*>(subx))) ||
-                                          (((void*)&mdo != (void*)suby) &&
-                                           ((void*)&mdo == dynamic_cast<void*>(suby))));
-                            }],
-                           ac_cv_cpp_dynamic_cast_void_ptr=yes,
-                           ac_cv_cpp_dynamic_cast_void_ptr=no,
-                           ac_cv_cpp_dynamic_cast_void_ptr=no)])
-if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
-   AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
-fi
-
-
 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
 # linking XUL.
 _SAVE_LDFLAGS=$LDFLAGS
 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
 AC_CACHE_CHECK(for __thread keyword for TLS variables,
                ac_cv_thread_keyword,
--- a/old-configure.in
+++ b/old-configure.in
@@ -1428,40 +1428,16 @@ if test "$GNU_CC"; then
     else
         ARM_ABI_PREFIX=oabi-
     fi
   fi
 
   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
 fi
 
-dnl See if a dynamic_cast to void* gives the most derived object.
-AC_CACHE_CHECK(for C++ dynamic_cast to void*,
-               ac_cv_cpp_dynamic_cast_void_ptr,
-               [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
-                            class Y { int j; public: virtual ~Y() { } };
-                            class Z : public X, public Y { int k; };
-
-                            int main() {
-                                 Z mdo;
-                                 X *subx = (X*)&mdo;
-                                 Y *suby = (Y*)&mdo;
-                                 return !((((void*)&mdo != (void*)subx) &&
-                                           ((void*)&mdo == dynamic_cast<void*>(subx))) ||
-                                          (((void*)&mdo != (void*)suby) &&
-                                           ((void*)&mdo == dynamic_cast<void*>(suby))));
-                            }],
-                           ac_cv_cpp_dynamic_cast_void_ptr=yes,
-                           ac_cv_cpp_dynamic_cast_void_ptr=no,
-                           ac_cv_cpp_dynamic_cast_void_ptr=no)])
-if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
-   AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
-fi
-
-
 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
 # linking XUL.
 _SAVE_LDFLAGS=$LDFLAGS
 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
 AC_CACHE_CHECK(for __thread keyword for TLS variables,
                ac_cv_thread_keyword,
@@ -3632,17 +3608,16 @@ if test -n "$A11Y_LOG"; then
 fi
 
 dnl Spit out some output
 dnl ========================================================
 
 dnl The following defines are used by xpcom
 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
 CPP_THROW_NEW
-HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
 HAVE_GETPAGESIZE
 HAVE_STATVFS64
 HAVE_STATVFS
 HAVE_STATFS64
 HAVE_STATFS
 HAVE_SYS_STATVFS_H
 HAVE_SYS_STATFS_H
 HAVE_SYS_VFS_H
--- a/xpcom/base/nsTraceRefcnt.cpp
+++ b/xpcom/base/nsTraceRefcnt.cpp
@@ -47,16 +47,21 @@
 #  include <dlfcn.h>
 #endif
 
 #ifdef MOZ_DMD
 #  include "base/process_util.h"
 #  include "nsMemoryInfoDumper.h"
 #endif
 
+// dynamic_cast<void*> is not supported on Windows without RTTI.
+#ifndef _WIN32
+#define HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
+#endif
+
 ////////////////////////////////////////////////////////////////////////////////
 
 #include "prthread.h"
 
 // We use a spin lock instead of a regular mutex because this lock is usually
 // only held for a very short time, and gets grabbed at a very high frequency
 // (~100000 times per second). On Mac, the overhead of using a regular lock
 // is very high, see bug 1137963.
--- a/xpcom/xpcom-config.h.in
+++ b/xpcom/xpcom-config.h.in
@@ -7,15 +7,12 @@
 #ifndef _XPCOM_CONFIG_H_
 #define _XPCOM_CONFIG_H_
 
 /* Define this to throw() if the compiler complains about 
  * constructors returning NULL
  */
 #undef CPP_THROW_NEW
 
-/* Define if a dyanmic_cast to void* gives the most derived object */
-#undef HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
-
 /* Define to a string describing the XPCOM ABI in use */
 #undef TARGET_XPCOM_ABI
 
 #endif /* _XPCOM_CONFIG_H_ */