Bug 1258618 - Use True instead of '1' for set_define. r=nalexander
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 22 Mar 2016 13:44:00 +0900
changeset 313716 34d422497ef9a8d95435c63778652b4d135769bf
parent 313715 0f1ddce63248c64f491f1bee530f1cb538aa44e0
child 313717 43d66eea833b04be65a145051c708dd5c6587a80
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1258618
milestone48.0a1
Bug 1258618 - Use True instead of '1' for set_define. r=nalexander
b2g/common.configure
build/moz.configure/init.configure
js/moz.configure
moz.configure
toolkit/moz.configure
--- a/b2g/common.configure
+++ b/b2g/common.configure
@@ -10,12 +10,12 @@ option(env='MOZTTDIR', nargs=1, help='Pa
 
 @depends('MOZTTDIR')
 def mozttdir(value):
     if value:
         path = value[0]
         if not os.path.isdir(path):
             error('MOZTTDIR "%s" is not a valid directory' % path)
         set_config('MOZTTDIR', path)
-        set_define('PACKAGE_MOZTT', '1')
+        set_define('PACKAGE_MOZTT', True)
 
 
 include('../toolkit/moz.configure')
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -532,31 +532,31 @@ def host_variables(host):
         os_arch = host.kernel
     add_old_configure_assignment('HOST_OS_ARCH', os_arch)
     set_config('HOST_OS_ARCH', os_arch)
 
 
 @depends(target)
 def target_platform_defines(target):
     if target.kernel == 'WINNT':
-        set_define('_WINDOWS', '1')
-        set_define('WIN32', '1')
-        set_define('XP_WIN', '1')
-        set_define('XP_WIN32', '1')
+        set_define('_WINDOWS', True)
+        set_define('WIN32', True)
+        set_define('XP_WIN', True)
+        set_define('XP_WIN32', True)
     else:
-        set_define('XP_UNIX', '1')
+        set_define('XP_UNIX', True)
 
     if target.kernel == 'Darwin':
-        set_define('XP_DARWIN', '1')
+        set_define('XP_DARWIN', True)
         if target.os == 'iOS':
-            set_define('XP_IOS', '1')
+            set_define('XP_IOS', True)
         elif target.os == 'OSX':
-            set_define('XP_MACOSX', '1')
+            set_define('XP_MACOSX', True)
     elif target.kernel == 'Linux':
-        set_define('XP_LINUX', '1')
+        set_define('XP_LINUX', True)
 
 
 # The application/project to build
 # ==============================================================
 option('--enable-application', nargs=1, env='MOZ_BUILD_APP',
        help='Application to build. Same as --enable-project.')
 
 @depends('--enable-application', '--help')
@@ -620,22 +620,22 @@ def milestone(build_env):
         milestone = fh.read().splitlines()[-1]
 
     set_config('GRE_MILESTONE', milestone)
 
     is_nightly = is_release = False
 
     if 'a1' in milestone:
         set_config('NIGHTLY_BUILD', True)
-        set_define('NIGHTLY_BUILD', '1')
+        set_define('NIGHTLY_BUILD', True)
         add_old_configure_assignment('NIGHTLY_BUILD', '1')
         is_nightly = True
     elif 'a' not in milestone:
         set_config('RELEASE_BUILD', True)
-        set_define('RELEASE_BUILD', '1')
+        set_define('RELEASE_BUILD', True)
         add_old_configure_assignment('RELEASE_BUILD', '1')
         is_release = True
 
     return namespace(version=milestone,
                      is_nightly=is_nightly,
                      is_release=is_release)
 
 # This is temporary until js/src/configure and configure are merged.
--- a/js/moz.configure
+++ b/js/moz.configure
@@ -37,17 +37,17 @@ def js_shell(value):
 # Use SpiderMonkey Promise implementation if it's enabled
 # =======================================================
 js_option('--enable-sm-promise', help='Enable SpiderMonkey promises')
 
 @depends('--enable-sm-promise')
 def sm_promise(value):
     if value:
         set_config('SPIDERMONKEY_PROMISE', True)
-        set_define('SPIDERMONKEY_PROMISE', '1')
+        set_define('SPIDERMONKEY_PROMISE', True)
 
 
 # SpiderMonkey as a shared library, and how its symbols are exported
 # ==================================================================
 js_option('--disable-shared-js', default=building_js,
           help='Do not create a shared library')
 
 js_option('--disable-export-js', default=building_js,
@@ -57,20 +57,20 @@ js_option('--disable-export-js', default
 def static_js(shared_js, export_js):
     if shared_js:
         if not export_js:
             error('Must export JS symbols when building a shared library.')
         set_config('JS_SHARED_LIBRARY', True)
         add_old_configure_assignment('JS_SHARED_LIBRARY', '1')
     else:
         if export_js:
-            set_define('STATIC_EXPORTABLE_JS_API', '1')
+            set_define('STATIC_EXPORTABLE_JS_API', True)
         else:
-            set_define('STATIC_JS_API', '1')
-        set_define('MOZ_STATIC_JS', '1')
+            set_define('STATIC_JS_API', True)
+        set_define('MOZ_STATIC_JS', True)
 
 
 @deprecated_option(env='DISABLE_SHARED_JS', nargs='?')
 def disable_shared_js(value):
     # DISABLE_SHARED_JS=1 gets us an empty PositiveOptionValue
     if value and not len(value):
         suggestion = '--disable-shared-js'
     else:
@@ -98,46 +98,46 @@ js_option('--enable-instruments', env='M
 
 @depends('--enable-instruments', target)
 def instruments(value, target):
     if value and target.os != 'OSX':
         error('--enable-instruments cannot be used when targeting %s'
               % target.os)
     if value:
         set_config('MOZ_INSTRUMENTS', True)
-        set_define('MOZ_INSTRUMENTS', '1')
+        set_define('MOZ_INSTRUMENTS', True)
         add_old_configure_assignment('MOZ_INSTRUMENTS', '1')
         imply_option('--enable-profiling', reason='--enable-instruments')
 
 
 js_option('--enable-callgrind', env='MOZ_CALLGRIND',
           help='Enable callgrind profiling')
 
 @depends('--enable-callgrind')
 def callgrind(value):
     if value:
-        set_define('MOZ_CALLGRIND', '1')
+        set_define('MOZ_CALLGRIND', True)
         imply_option('--enable-profiling')
 
 
 js_option('--enable-profiling', env='MOZ_PROFILING',
           help='Set compile flags necessary for using sampling profilers '
                '(e.g. shark, perf)')
 
 @depends('--enable-profiling', target)
 def profiling(value, target):
     if value:
         set_config('MOZ_PROFILING', True)
-        set_define('MOZ_PROFILING', '1')
+        set_define('MOZ_PROFILING', True)
         add_old_configure_assignment('MOZ_PROFILING', '1')
 
         if target.kernel == 'WINNT' or (target.kernel == 'Linux' and
                                         target.os == 'GNU'):
             imply_option('--enable-vtune', reason='--enable-profiling')
 
 
 js_option('--enable-vtune', env='MOZ_VTUNE', help='Enable vtune profiling')
 
 @depends('--enable-vtune')
 def vtune(value):
     if value:
         set_config('MOZ_VTUNE', True)
-        set_define('MOZ_VTUNE', '1')
+        set_define('MOZ_VTUNE', True)
--- a/moz.configure
+++ b/moz.configure
@@ -16,17 +16,17 @@ include('build/moz.configure/checks.conf
 # - etc.
 
 # Multiprocess Firefox Testing UI - Nightly and Aurora
 # To be removed in Bug 1003313
 @depends(milestone)
 def e10s_testing_only(milestone):
     if not milestone.is_release:
         set_config('E10S_TESTING_ONLY', True)
-        set_define('E10S_TESTING_ONLY', '1')
+        set_define('E10S_TESTING_ONLY', True)
 
 
 option('--enable-artifact-builds', env='MOZ_ARTIFACT_BUILDS',
        help='Download and use prebuilt binary artifacts.')
 
 @depends('--enable-artifact-builds')
 def artifact_builds(value):
     if value:
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -13,54 +13,54 @@ option('--enable-systrace', env='MOZ_USE
        help='Turn on systrace for the Gecko profiler on android/b2g')
 
 @depends('--enable-systrace', target)
 def systrace(value, target):
     if value and target.os != 'Android':
         error('--enable-systrace cannot be used when targetting %s'
               % target.os)
     if value:
-        set_define('MOZ_USE_SYSTRACE', '1')
+        set_define('MOZ_USE_SYSTRACE', True)
 
 
 option('--enable-jprof', env='MOZ_JPROF',
        help='Enable jprof profiling tool (needs mozilla/tools/jprof)')
 
 @depends('--enable-jprof')
 def jprof(value):
     if value:
         set_config('MOZ_JPROF', True)
-        set_define('MOZ_JPROF', '1')
+        set_define('MOZ_JPROF', True)
         imply_option('--enable-profiling')
 
 
 @depends(target)
 def sps_profiler(target):
     if target.os == 'Android':
         return target.cpu in ('arm', 'x86')
     elif target.kernel == 'Linux':
         return target.cpu in ('x86', 'x86_64')
     return target.os in ('OSX', 'WINNT')
 
 @depends(sps_profiler)
 def sps_profiler_define(value):
     if value:
         set_config('MOZ_ENABLE_PROFILER_SPS', True)
-        set_define('MOZ_ENABLE_PROFILER_SPS', '1')
+        set_define('MOZ_ENABLE_PROFILER_SPS', True)
 
 
 option('--enable-dmd', env='MOZ_DMD',
        help='Enable Dark Matter Detector (heap profiler). '
             'Also enables jemalloc, replace-malloc and profiling')
 
 @depends('--enable-dmd')
 def dmd(value):
     if value:
         set_config('MOZ_DMD', True)
-        set_define('MOZ_DMD', '1')
+        set_define('MOZ_DMD', True)
         add_old_configure_assignment('MOZ_DMD', '1')
         imply_option('--enable-profiling')
 
 
 # Javascript engine
 # ==============================================================
 include('../js/moz.configure')
 
@@ -134,17 +134,17 @@ def toolkit(toolkit):
     set_config('MOZ_WIDGET_TOOLKIT', widget_toolkit)
     add_old_configure_assignment('MOZ_WIDGET_TOOLKIT', widget_toolkit)
 
     if widget_toolkit == 'gtk2':
         set_define('MOZ_WIDGET_GTK', '2')
     elif widget_toolkit == 'gtk3':
         set_define('MOZ_WIDGET_GTK', '3')
     elif widget_toolkit != 'windows':
-        set_define('MOZ_WIDGET_%s' % widget_toolkit.upper(), '1')
+        set_define('MOZ_WIDGET_%s' % widget_toolkit.upper(), True)
 
     return widget_toolkit
 
 
 option('--without-x', env='WITHOUT_X', help='Disable X11 support')
 
 @depends('--without-x', toolkit)
 def x11(value, toolkit):
@@ -153,39 +153,39 @@ def x11(value, toolkit):
 
     x11_toolkits = ('gtk2', 'gtk3', 'qt')
     if value and value.origin != 'default' and toolkit not in x11_toolkits:
         error('--with-x is only valid with --enable-default-toolkit={%s}'
               % ','.join(x11_toolkits))
 
     if value and toolkit in x11_toolkits:
         set_config('MOZ_ENABLE_XREMOTE', True)
-        set_define('MOZ_ENABLE_XREMOTE', '1')
+        set_define('MOZ_ENABLE_XREMOTE', True)
         set_config('MOZ_X11', True)
-        set_define('MOZ_X11', '1')
+        set_define('MOZ_X11', True)
         add_old_configure_assignment('MOZ_X11', '1')
 
     return value and toolkit in x11_toolkits
 
 
 # GL Provider
 # ==============================================================
 option('--with-gl-provider', nargs=1, help='Set GL provider backend type')
 
 @depends('--with-gl-provider', x11)
 def gl_provider(value, x11):
     if value:
         provider = value[0]
         set_config('MOZ_GL_PROVIDER', provider)
         set_define('MOZ_GL_PROVIDER', 'GLContextProvider%s' % provider)
         set_config('MOZ_GL_DEFAULT_PROVIDER', provider)
-        set_define('GL_PROVIDER_%s' % provider, '1')
+        set_define('GL_PROVIDER_%s' % provider, True)
     elif x11:
         set_config('MOZ_GL_DEFAULT_PROVIDER', 'GLX')
-        set_define('GL_PROVIDER_GLX', '1')
+        set_define('GL_PROVIDER_GLX', True)
 
 
 # PDF printing
 # ==============================================================
 @depends(toolkit)
 def pdf_printing(toolkit):
     if toolkit in ('windows', 'gtk2', 'gtk3', 'qt', 'android', 'gonk'):
         set_config('MOZ_PDF_PRINTING', True)
@@ -200,17 +200,17 @@ def pdf_printing(toolkit):
 option(env='MOZ_INSTRUMENT_EVENT_LOOP',
        help='Force-enable event loop instrumentation')
 
 @depends('MOZ_INSTRUMENT_EVENT_LOOP', toolkit)
 def instrument_event_loop(value, toolkit):
     if value or (toolkit in ('windows', 'gtk2', 'gtk3', 'cocoa', 'android',
                              'gonk') and value.origin == 'default'):
         set_config('MOZ_INSTRUMENT_EVENT_LOOP', True)
-        set_define('MOZ_INSTRUMENT_EVENT_LOOP', '1')
+        set_define('MOZ_INSTRUMENT_EVENT_LOOP', True)
 
 
 # Fontconfig Freetype
 # ==============================================================
 option(env='USE_FC_FREETYPE',
        help='Force-enable the use of fontconfig freetype')
 
 @depends('USE_FC_FREETYPE', toolkit)
@@ -221,17 +221,17 @@ def fc_freetype(value, toolkit):
 
 
 # Apple platform decoder support
 # ==============================================================
 @depends(toolkit)
 def applemedia(toolkit):
     if toolkit in ('cocoa', 'uikit'):
         set_config('MOZ_APPLEMEDIA', True)
-        set_define('MOZ_APPLEMEDIA', '1')
+        set_define('MOZ_APPLEMEDIA', True)
         add_old_configure_assignment('MOZ_APPLEMEDIA', '1')
         return True
     return False
 
 
 # Windows Media Foundation support
 # ==============================================================
 option('--disable-wmf',
@@ -245,32 +245,32 @@ def wmf(value, target):
         # Note our minimum SDK version is Windows 7 SDK, so we are (currently)
         # guaranteed to have a recent-enough SDK to build WMF.
         enabled = target.os == 'WINNT'
     if enabled and target.os != 'WINNT':
         error('Cannot enable Windows Media Foundation support on %s'
               % target.os)
     if enabled:
         set_config('MOZ_WMF', True)
-        set_define('MOZ_WMF', '1')
+        set_define('MOZ_WMF', True)
     return enabled
 
 
 # FFmpeg H264/AAC Decoding Support
 # ==============================================================
 option('--disable-ffmpeg',
        help='Disable FFmpeg for fragmented H264/AAC decoding')
 
 @depends('--disable-ffmpeg', target)
 def ffmpeg(value, target):
     enabled = bool(value)
     if value.origin == 'default':
         enabled = target.os not in ('Android', 'WINNT')
     if enabled:
-        set_define('MOZ_FFMPEG', '1')
+        set_define('MOZ_FFMPEG', True)
         set_config('MOZ_FFMPEG', True)
         imply_option('--enable-fmp4', '--enable-ffmpeg')
     return enabled
 
 
 # Built-in fragmented MP4 support.
 # ==============================================================
 option('--disable-fmp4', env='MOZ_FMP4',
@@ -279,17 +279,17 @@ option('--disable-fmp4', env='MOZ_FMP4',
 @depends('--disable-fmp4', target, wmf, applemedia)
 def fmp4(value, target, wmf, applemedia):
     enabled = bool(value)
     if value.origin == 'default':
         # target.os == 'Android' includes all B2G versions
         enabled = wmf or applemedia or target.os == 'Android'
     if enabled:
         set_config('MOZ_FMP4', True)
-        set_define('MOZ_FMP4', '1')
+        set_define('MOZ_FMP4', True)
         add_old_configure_assignment('MOZ_FMP4', '1')
     return enabled
 
 
 # EME Support
 # ==============================================================
 option('--enable-eme', nargs='*', choices=('adobe',),
        help='Enable support for Encrypted Media Extensions')
@@ -299,15 +299,15 @@ def eme(value, fmp4):
     enabled = bool(value)
     if value.origin == 'default':
         enabled = enabled or fmp4
     if enabled and not fmp4:
         error('Encrypted Media Extension support requires '
               'Fragmented MP4 support')
     if enabled:
         set_config('MOZ_EME', True)
-        set_define('MOZ_EME', '1')
+        set_define('MOZ_EME', True)
     # Theoretically, we could pass `value` directly when it is a
     # PositiveOptionValue, but somehow, the JSON serialization in configure.py
     # outputs inconsistent data in some cases when we do (a closing bracket
     # without an opening one).
     set_config('MOZ_EME_MODULES', list(value) if value else [])
     return enabled