Bug 141156 - Set MOZ_DEBUG globally as both a CONFIG and a #define. r?mshal
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 24 Oct 2017 14:07:37 +0900
changeset 1328716 0c3fc661292a41eba1904b8603774cdcb822af01
parent 1328715 4b1d21473dc647509f17c19a2a92ccc6d06f07ab
child 1328717 921409aeeedb4eb8e6e0cb1fcd0c3e14f679e478
push id230031
push usermh@glandium.org
push dateTue, 24 Oct 2017 05:24:12 +0000
treeherdertry@921409aeeedb [default view] [failures only]
reviewersmshal
bugs141156, 1365460, 1261161
milestone58.0a1
Bug 141156 - Set MOZ_DEBUG globally as both a CONFIG and a #define. r?mshal Bug 1365460 introduced code paths behind MOZ_DEBUG #ifdefs, but MOZ_DEBUG is never defined, while it is available in CONFIG in moz.builds. This is kind of a confusing situation, but the fact that we've been able to avoid those problems for so long would tend to put the blame on mozjemalloc, and fixes should go there. Except that bug 1261161 explains that the only existing alternative (the DEBUG #define), as used in MFBT, is not working for spidermonkey, so it actually makes sense to converge to MOZ_DEBUG rather than DEBUG. So start defining MOZ_DEBUG globally, fixing the mozjemalloc issues of not having the debug code enabled. Bug 1261161 can then take care of changing the DEBUG #ifdefs.
js/src/old-configure.in
moz.configure
old-configure.in
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -1947,17 +1947,16 @@ AC_SUBST(AS)
 AC_SUBST(ASFLAGS)
 AC_SUBST(AS_DASH_C_FLAG)
 AC_SUBST(RC)
 AC_SUBST(RCFLAGS)
 AC_SUBST(WINDRES)
 AC_SUBST(IMPLIB)
 AC_SUBST(FILTER)
 AC_SUBST(BIN_FLAGS)
-AC_SUBST(MOZ_DEBUG)
 AC_SUBST(MOZ_DEBUG_LDFLAGS)
 AC_SUBST(WARNINGS_AS_ERRORS)
 AC_SUBST(LIBICONV)
 
 AC_SUBST(ENABLE_STRIP)
 AC_SUBST(PKG_SKIP_STRIP)
 AC_SUBST(INCREMENTAL_LINKER)
 
--- a/moz.configure
+++ b/moz.configure
@@ -96,18 +96,24 @@ set_define('GTEST_USE_OWN_TR1_TUPLE',
 set_define('GTEST_HAS_CLONE',
            linux_gtest_defines.has_clone)
 
 js_option('--enable-debug',
           nargs='?',
           help='Enable building with developer debug info '
                '(using the given compiler flags).')
 
-add_old_configure_assignment('MOZ_DEBUG',
-                             depends('--enable-debug')(lambda v: bool(v)))
+@depends('--enable-debug')
+def moz_debug(debug):
+    if debug:
+        return bool(debug)
+
+set_config('MOZ_DEBUG', moz_debug)
+set_define('MOZ_DEBUG', moz_debug)
+add_old_configure_assignment('MOZ_DEBUG', moz_debug)
 
 js_option('--enable-rust-debug',
           help='Build Rust code with debug assertions turned on.')
 
 @depends('--enable-rust-debug', '--enable-debug')
 def debug_rust(value, debug):
     if value.origin == 'default':
         return bool(debug) or None
--- a/old-configure.in
+++ b/old-configure.in
@@ -4480,17 +4480,16 @@ AC_SUBST(AS_DASH_C_FLAG)
 AC_SUBST(RC)
 AC_SUBST(RCFLAGS)
 AC_SUBST(WINDRES)
 AC_SUBST(IMPLIB)
 AC_SUBST(FILTER)
 AC_SUBST(BIN_FLAGS)
 AC_SUBST(MOZ_AUTH_EXTENSION)
 AC_SUBST(MOZ_PREF_EXTENSIONS)
-AC_SUBST(MOZ_DEBUG)
 AC_SUBST(MOZ_DEBUG_LDFLAGS)
 AC_SUBST(WARNINGS_AS_ERRORS)
 AC_SUBST_SET(MOZ_EXTENSIONS)
 AC_SUBST(LIBICONV)
 AC_SUBST(MOZ_TOOLKIT_SEARCH)
 AC_SUBST(MOZ_FEEDS)
 
 AC_SUBST(MOZ_UNIVERSALCHARDET)