diff --git a/config/config.mk b/config/config.mk index 28595e711910..a31645da013f 100644 --- a/config/config.mk +++ b/config/config.mk @@ -106,13 +106,13 @@ 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) @@ -300,7 +300,7 @@ 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. diff --git a/config/rules.mk b/config/rules.mk index f0dbbfafc3c4..d31d77269908 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -674,7 +674,7 @@ 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) diff --git a/js/src/old-configure.in b/js/src/old-configure.in index a2b9c101550a..624c60956607 100644 --- a/js/src/old-configure.in +++ b/js/src/old-configure.in @@ -159,21 +159,17 @@ case "$target" in _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 @@ -266,8 +262,6 @@ if test -n "$SBCONF"; then fi AC_SUBST(QEMU_CANT_RUN_JS_SHELL) -AC_SUBST(_MSC_VER) - AC_SUBST(GNU_CC) AC_SUBST(GNU_CXX) diff --git a/old-configure.in b/old-configure.in index 95b3a5e7e684..4be91798156b 100644 --- a/old-configure.in +++ b/old-configure.in @@ -160,8 +160,6 @@ case "$target" in _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. @@ -175,15 +173,13 @@ case "$target" in 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" @@ -295,8 +291,6 @@ fi fi # COMPILE_ENVIRONMENT -AC_SUBST(_MSC_VER) - AC_SUBST(GNU_CC) AC_SUBST(GNU_CXX) diff --git a/python/mozbuild/mozbuild/action/check_binary.py b/python/mozbuild/mozbuild/action/check_binary.py index aea4d36d3e25..38c91d5816df 100644 --- a/python/mozbuild/mozbuild/action/check_binary.py +++ b/python/mozbuild/mozbuild/action/check_binary.py @@ -172,7 +172,7 @@ 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 \ @@ -240,7 +240,7 @@ def check_nsmodules(target, binary): # 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') diff --git a/python/mozbuild/mozbuild/frontend/gyp_reader.py b/python/mozbuild/mozbuild/frontend/gyp_reader.py index 4d106f72d152..0dabdf249778 100644 --- a/python/mozbuild/mozbuild/frontend/gyp_reader.py +++ b/python/mozbuild/mozbuild/frontend/gyp_reader.py @@ -243,7 +243,7 @@ def process_gyp_result(gyp_result, gyp_dir_attrs, path, config, output, 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: @@ -380,7 +380,7 @@ class GypProcessor(object): # 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'