Bug 1521691 - Remove _MSC_VER from configure. r=chmanchester
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 23 Jan 2019 00:35:10 +0000
changeset 455072 ade025709ebf79c303b5f8a6ae9ebf6daedd8b50
parent 455071 9d2e8060ccde8ce387918c811382eeea22ad86ad
child 455073 95d021c3e7e27788e649041648155dfbc22fb42d
push id111397
push useraciure@mozilla.com
push dateWed, 23 Jan 2019 18:56:11 +0000
treeherdermozilla-inbound@309abca54dae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1521691
milestone66.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 1521691 - Remove _MSC_VER from configure. r=chmanchester The only use in configure itself is for a MSVC version check that is now always true (we don't accept versions < 19.15 anymore). The only uses in the build system are in code that could just use CC_TYPE instead. Differential Revision: https://phabricator.services.mozilla.com/D17207
config/config.mk
config/rules.mk
js/src/old-configure.in
old-configure.in
python/mozbuild/mozbuild/action/check_binary.py
python/mozbuild/mozbuild/frontend/gyp_reader.py
--- a/config/config.mk
+++ b/config/config.mk
@@ -101,23 +101,23 @@ ACDEFINES += -DXPI_NAME=$(XPI_NAME)
 endif
 
 # The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
 VERSION_NUMBER		= 50
 
 CONFIG_TOOLS	= $(MOZ_BUILD_ROOT)/config
 AUTOCONF_TOOLS	= $(MOZILLA_DIR)/build/autoconf
 
-ifdef _MSC_VER
+ifeq (msvc,$(CC_TYPE))
 # clang-cl is smart enough to generate dependencies directly.
-ifeq (,$(CLANG_CL)$(MOZ_USING_SCCACHE))
+ifeq (,$(MOZ_USING_SCCACHE))
 CC_WRAPPER ?= $(call py_action,cl)
 CXX_WRAPPER ?= $(call py_action,cl)
-endif # CLANG_CL/MOZ_USING_SCCACHE
-endif # _MSC_VER
+endif # MOZ_USING_SCCACHE
+endif # CC_TYPE
 
 CC := $(CC_WRAPPER) $(CC)
 CXX := $(CXX_WRAPPER) $(CXX)
 MKDIR ?= mkdir
 SLEEP ?= sleep
 TOUCH ?= touch
 
 PYTHON_PATH = $(PYTHON) $(topsrcdir)/config/pythonpath.py
@@ -295,17 +295,17 @@ else # MOZ_WINCONSOLE
 WIN32_EXE_LDFLAGS	+= $(WIN32_GUI_EXE_LDFLAGS)
 endif
 else
 # For setting subsystem version
 WIN32_EXE_LDFLAGS	+= $(WIN32_CONSOLE_EXE_LDFLAGS)
 endif
 endif # WINNT
 
-ifdef _MSC_VER
+ifneq (,$(filter msvc clang-cl,$(CC_TYPE)))
 ifeq ($(CPU_ARCH),x86_64)
 # Normal operation on 64-bit Windows needs 2 MB of stack. (Bug 582910)
 # ASAN requires 6 MB of stack.
 # Setting the stack to 8 MB to match the capability of other systems
 # to deal with frame construction for unreasonably deep DOM trees
 # with worst-case styling. This uses address space unnecessarily for
 # non-main threads, but that should be tolerable on 64-bit systems.
 # (Bug 256180)
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -669,17 +669,17 @@ ifeq ($(OS_ARCH),WINNT)
 # have run before considering other targets that depend on the import library.
 # See bug 795204.
 $(IMPORT_LIBRARY): $(SHARED_LIBRARY) ;
 endif
 
 $(HOST_SHARED_LIBRARY): Makefile
 	$(REPORT_BUILD)
 	$(RM) $@
-ifdef _MSC_VER
+ifneq (,$(filter msvc clang-cl,$(HOST_CC_TYPE)))
 	$(HOST_LINKER) -NOLOGO -DLL -OUT:$@ $($(notdir $@)_OBJS) $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LINKER_LIBPATHS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 else
 	$(HOST_CXX) $(HOST_OUTOPTION)$@ $($(notdir $@)_OBJS) $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 endif
 
 # On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
 # so instead of deleting .o files after repacking them into a dylib, we make
 # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -154,31 +154,27 @@ case "$target" in
             [ unsigned *test = new unsigned(42); ],,
             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
         AC_LANG_RESTORE
 
         changequote(,)
         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
         changequote([,])
 
-        _MSC_VER=`echo ${CC_VERSION} | cut -c 1-2,4-5`
-
         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
         AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
 
-        if test "$_MSC_VER" -ge "1910"; then # VS2017+
-            # C5038: Enable initializer list order warnings
-            # The -w1#### flag treats warning C#### as if it was a warning level
-            # 1 warning, and thus enables it because we enable /W3 warnings. We
-            # don't use -we#### because it would enable warning C#### but treat
-            # it as an error, even in third-party code.
-            # https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level
-            CXXFLAGS="$CXXFLAGS -w15038"
-        fi
+        # C5038: Enable initializer list order warnings
+        # The -w1#### flag treats warning C#### as if it was a warning level
+        # 1 warning, and thus enables it because we enable /W3 warnings. We
+        # don't use -we#### because it would enable warning C#### but treat
+        # it as an error, even in third-party code.
+        # https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level
+        CXXFLAGS="$CXXFLAGS -w15038"
 
         _CC_SUITE=14
         MSVC_C_RUNTIME_DLL=vcruntime140.dll
         MSVC_CXX_RUNTIME_DLL=msvcp140.dll
 
         # C5026: move constructor was implicitly defined as deleted
         CXXFLAGS="$CXXFLAGS -wd5026"
 
@@ -261,18 +257,16 @@ if test -n "$SBCONF"; then
     _sb_version_minor=`echo $_sb_version | cut -f2 -d.`
     _sb_version_point=`echo $_sb_version | cut -f3 -d.`
     if test $_sb_version_major -eq 1 -a $_sb_version_minor -eq 0 -a $_sb_version_point -le 16; then
         QEMU_CANT_RUN_JS_SHELL=1
     fi
 fi
 AC_SUBST(QEMU_CANT_RUN_JS_SHELL)
 
-AC_SUBST(_MSC_VER)
-
 AC_SUBST(GNU_CC)
 AC_SUBST(GNU_CXX)
 
 dnl ========================================================
 dnl Checks for programs.
 dnl ========================================================
 if test "$COMPILE_ENVIRONMENT"; then
 
--- a/old-configure.in
+++ b/old-configure.in
@@ -155,40 +155,36 @@ case "$target" in
             [ unsigned *test = new unsigned(42); ],,
             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
         AC_LANG_RESTORE
 
         changequote(,)
         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
         changequote([,])
 
-        _MSC_VER=`echo ${CC_VERSION} | cut -c 1-2,4-5`
-
         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
         AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
 
         _CC_SUITE=14
         MSVC_C_RUNTIME_DLL=vcruntime140.dll
         MSVC_CXX_RUNTIME_DLL=msvcp140.dll
 
         MOZ_CHECK_HEADER(dia2.h, MSVC_HAS_DIA_SDK=1)
         if test -n "$MSVC_HAS_DIA_SDK"; then
             AC_DEFINE(MSVC_HAS_DIA_SDK)
         fi
 
-        if test "$_MSC_VER" -ge "1910"; then # VS2017+
-            # C5038: Enable initializer list order warnings
-            # The -w1#### flag treats warning C#### as if it was a warning level
-            # 1 warning, and thus enables it because we enable /W3 warnings. We
-            # don't use -we#### because it would enable warning C#### but treat
-            # it as an error, even in third-party code.
-            # https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level
-            CXXFLAGS="$CXXFLAGS -w15038"
-        fi
+        # C5038: Enable initializer list order warnings
+        # The -w1#### flag treats warning C#### as if it was a warning level
+        # 1 warning, and thus enables it because we enable /W3 warnings. We
+        # don't use -we#### because it would enable warning C#### but treat
+        # it as an error, even in third-party code.
+        # https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level
+        CXXFLAGS="$CXXFLAGS -w15038"
 
         # C5026: move constructor was implicitly defined as deleted
         CXXFLAGS="$CXXFLAGS -wd5026"
 
         # C5027: move assignment operator was implicitly defined as deleted
         CXXFLAGS="$CXXFLAGS -wd5027"
 
         # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
@@ -290,18 +286,16 @@ if test -n "$_WIN32_MSVC"; then
     # Since we're skipping compiler and library checks, hard-code
     # some facts here.
     AC_DEFINE(HAVE_IO_H)
     AC_DEFINE(HAVE_ISATTY)
 fi
 
 fi # COMPILE_ENVIRONMENT
 
-AC_SUBST(_MSC_VER)
-
 AC_SUBST(GNU_CC)
 AC_SUBST(GNU_CXX)
 
 AC_SUBST_LIST(STL_FLAGS)
 AC_SUBST(WRAP_STL_INCLUDES)
 
 dnl ========================================================
 dnl Checks for programs.
--- a/python/mozbuild/mozbuild/action/check_binary.py
+++ b/python/mozbuild/mozbuild/action/check_binary.py
@@ -167,17 +167,17 @@ def is_libxul(binary):
     basename = os.path.basename(binary).lower()
     return 'xul' in basename
 
 
 def check_nsmodules(target, binary):
     if target is HOST or not is_libxul(binary):
         raise Skip()
     symbols = []
-    if buildconfig.substs.get('_MSC_VER'):
+    if buildconfig.substs.get('CC_TYPE') in ('msvc', 'clang-cl'):
         for line in get_output('dumpbin.exe', '-exports', binary):
             data = line.split(None, 3)
             if data and len(data) == 4 and data[0].isdigit() and \
                     ishex(data[1]) and ishex(data[2]):
                 # - Some symbols in the table can be aliases, and appear as
                 #   `foo = bar`.
                 # - The MSVC mangling has some type info following `@@`
                 # - Any namespacing that can happen on the symbol appears as a
@@ -235,17 +235,17 @@ def check_nsmodules(target, binary):
         for addr, size, sym in symbols:
             print('%x %d %s' % (addr, size, sym))
 
     symbols = sorted(symbols)
     next_addr = None
     # MSVC linker, when doing incremental linking, adds padding when
     # merging sections. Allow there to be more space between the NSModule
     # symbols, as long as they are in the right order.
-    test_msvc = (buildconfig.substs.get('_MSC_VER') and \
+    test_msvc = (buildconfig.substs.get('CC_TYPE') in ('msvc', 'clang-cl') and \
         buildconfig.substs.get('DEVELOPER_OPTIONS'))
     test_clang = (buildconfig.substs.get('CC_TYPE') == 'clang' and \
         buildconfig.substs.get('OS_ARCH') == 'WINNT')
     if test_msvc or test_clang:
         sym_cmp = lambda guessed, actual: guessed <= actual
     else:
         sym_cmp = lambda guessed, actual: guessed == actual
 
--- a/python/mozbuild/mozbuild/frontend/gyp_reader.py
+++ b/python/mozbuild/mozbuild/frontend/gyp_reader.py
@@ -238,17 +238,17 @@ def process_gyp_result(gyp_result, gyp_d
                 if ext == '.s':
                     use_defines_in_asflags = True
 
             # The context expects alphabetical order when adding sources
             context['SOURCES'] = alphabetical_sorted(sources)
             context['UNIFIED_SOURCES'] = alphabetical_sorted(unified_sources)
 
             defines = target_conf.get('defines', [])
-            if bool(config.substs['_MSC_VER']) and no_chromium:
+            if config.substs['CC_TYPE'] in ('msvc', 'clang-cl') and no_chromium:
                 msvs_settings = gyp.msvs_emulation.MsvsSettings(spec, {})
                 defines.extend(msvs_settings.GetComputedDefines(c))
             for define in defines:
                 if '=' in define:
                     name, value = define.split('=', 1)
                     # The NSS gyp file doesn't expose a way to override this
                     # currently, so we do so here.
                     if name == 'NSS_ALLOW_SSLKEYLOGFILE' and config.substs.get('RELEASE_OR_BETA', False):
@@ -375,17 +375,17 @@ class GypProcessor(object):
         self._gyp_dir_attrs = gyp_dir_attrs
         self._action_overrides = action_overrides
         self.execution_time = 0.0
         self._results = []
 
         # gyp expects plain str instead of unicode. The frontend code gives us
         # unicode strings, so convert them.
         path = encode(path)
-        if bool(config.substs['_MSC_VER']):
+        if config.substs['CC_TYPE'] in ('msvc', 'clang-cl'):
             # This isn't actually used anywhere in this generator, but it's needed
             # to override the registry detection of VC++ in gyp.
             os.environ['GYP_MSVS_OVERRIDE_PATH'] = 'fake_path'
 
             os.environ['GYP_MSVS_VERSION'] = config.substs['MSVS_VERSION']
 
         params = {
             b'parallel': False,