Bug 1235738 - Simplify MOZ_DEBUG_DEFINES. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 29 Dec 2015 16:46:09 +0900
changeset 278041 51b8dcf42ee00572dd45e10444f023a1468d92ad
parent 278040 3a68ebf32f839b03c99708ed136045bfbf0d020a
child 278042 8ccb671b37fcde5bde27fd28846e75ad86c9ce8e
push id29841
push userryanvm@gmail.com
push dateSat, 02 Jan 2016 00:29:52 +0000
treeherdermozilla-central@f7fbc524f9f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1235738
milestone46.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 1235738 - Simplify MOZ_DEBUG_DEFINES. r=gps Now that it's not directly used in command lines, it can just become a list of symbols that ought to be defined. This simplifies all the uses of it.
build/autoconf/compiler-opts.m4
js/src/builtin/embedjs.py
python/mozbuild/mozbuild/frontend/context.py
--- a/build/autoconf/compiler-opts.m4
+++ b/build/autoconf/compiler-opts.m4
@@ -123,23 +123,23 @@ MOZ_ARG_ENABLE_STRING(debug,
   MOZ_DEBUG=)
 
 if test -z "$MOZ_DEBUG" -o -n "$MOZ_ASAN"; then
     MOZ_NO_DEBUG_RTL=1
 fi
 
 AC_SUBST(MOZ_NO_DEBUG_RTL)
 
-MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -DTRACING"
+MOZ_DEBUG_ENABLE_DEFS="DEBUG TRACING"
 MOZ_ARG_WITH_STRING(debug-label,
 [  --with-debug-label=LABELS
                           Define DEBUG_<value> for each comma-separated
                           value given.],
 [ for option in `echo $withval | sed 's/,/ /g'`; do
-    MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
+    MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS DEBUG_${option}"
 done])
 
 if test -n "$MOZ_DEBUG"; then
     AC_MSG_CHECKING([for valid debug flags])
     _SAVE_CFLAGS=$CFLAGS
     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
     AC_TRY_COMPILE([#include <stdio.h>],
         [printf("Hello World\n");],
@@ -148,20 +148,20 @@ if test -n "$MOZ_DEBUG"; then
     AC_MSG_RESULT([$_results])
     if test "$_results" = "no"; then
         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
     fi
     CFLAGS=$_SAVE_CFLAGS
 
     MOZ_DEBUG_DEFINES="$MOZ_DEBUG_ENABLE_DEFS"
 else
-    MOZ_DEBUG_DEFINES="-DNDEBUG -DTRIMMED"
+    MOZ_DEBUG_DEFINES="NDEBUG TRIMMED"
 fi
 
-AC_SUBST(MOZ_DEBUG_DEFINES)
+AC_SUBST_LIST(MOZ_DEBUG_DEFINES)
 
 dnl ========================================================
 dnl = Enable generation of debug symbols
 dnl ========================================================
 MOZ_ARG_ENABLE_STRING(debug-symbols,
 [  --enable-debug-symbols[=DBG]
                           Enable debugging symbols (using compiler flags DBG)],
 [ if test "$enableval" != "no"; then
--- a/js/src/builtin/embedjs.py
+++ b/js/src/builtin/embedjs.py
@@ -129,22 +129,18 @@ def messages(jsmsg):
       # Make sure that MSG_DEF isn't preceded by whitespace
       assert not line.strip().startswith("MSG_DEF")
   return '\n'.join(defines)
 
 def get_config_defines(buildconfig):
   # Collect defines equivalent to ACDEFINES and add MOZ_DEBUG_DEFINES.
   env = {key: value for key, value in buildconfig.defines.iteritems()
          if key not in buildconfig.non_global_defines}
-  for value in buildconfig.substs['MOZ_DEBUG_DEFINES'].split():
-    assert value[:2] == "-D"
-    pair = value[2:].split('=', 1)
-    if len(pair) == 1:
-      pair.append(1)
-    env[pair[0]] = pair[1]
+  for define in buildconfig.substs['MOZ_DEBUG_DEFINES']:
+    env[define] = 1
   return env
 
 def process_inputs(namespace, c_out, msg_file, inputs):
   deps = [path for path in inputs if path.endswith(".h")]
   sources = [path for path in inputs if path.endswith(".js")]
   assert len(deps) + len(sources) == len(inputs)
   cxx = shlex.split(buildconfig.substs['CXX'])
   cxx_option = buildconfig.substs['PREPROCESS_OPTION']
--- a/python/mozbuild/mozbuild/frontend/context.py
+++ b/python/mozbuild/mozbuild/frontend/context.py
@@ -279,22 +279,18 @@ class SubContext(Context, ContextDerived
 
     def __exit__(self, exc_type, exc_value, traceback):
         self._sandbox().pop_subcontext(self)
 
 
 class InitializedDefines(ContextDerivedValue, OrderedDict):
     def __init__(self, context, value=None):
         OrderedDict.__init__(self)
-        for define in context.config.substs.get('MOZ_DEBUG_DEFINES', '').split():
-            assert define[:2] == "-D"
-            pair = define[2:].split('=', 1)
-            if len(pair) == 1:
-                pair.append(1)
-            self[pair[0]] = pair[1]
+        for define in context.config.substs.get('MOZ_DEBUG_DEFINES', ()):
+            self[define] = 1
         if value:
             self.update(value)
 
 
 class FinalTargetValue(ContextDerivedValue, unicode):
     def __new__(cls, context, value=""):
         if not value:
             value = 'dist/'