forked from mirrors/gecko-dev
		
	Bug 1899098 - No longer use GNU_CC, CLANG_CC and the likes in moz.build r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D211720
This commit is contained in:
		
							parent
							
								
									4c80e08fec
								
							
						
					
					
						commit
						ba312a93d5
					
				
					 10 changed files with 41 additions and 39 deletions
				
			
		|  | @ -129,13 +129,6 @@ endif | |||
| endif | ||||
| DEFINES += -DLPROJ_ROOT=$(LPROJ_ROOT) | ||||
| 
 | ||||
| ifdef CLANG_CXX | ||||
| DEFINES += -DCLANG_CXX | ||||
| endif | ||||
| ifdef CLANG_CL | ||||
| DEFINES += -DCLANG_CL | ||||
| endif | ||||
| 
 | ||||
| ifdef LLVM_SYMBOLIZER | ||||
| DEFINES += -DLLVM_SYMBOLIZER=$(notdir $(LLVM_SYMBOLIZER)) | ||||
| endif | ||||
|  |  | |||
|  | @ -262,7 +262,7 @@ export LIB | |||
| endif | ||||
| 
 | ||||
| ifdef MOZ_USING_CCACHE | ||||
| ifdef CLANG_CXX | ||||
| ifeq ($(CC_TYPE),clang) | ||||
| export CCACHE_CPP2=1 | ||||
| endif | ||||
| endif | ||||
|  |  | |||
|  | @ -128,7 +128,7 @@ LINK_PDBFILE = $(basename $@).pdb | |||
| endif | ||||
| endif | ||||
| 
 | ||||
| ifndef GNU_CC | ||||
| ifeq ($(CC_TYPE),clang-cl) | ||||
| 
 | ||||
| ifdef SIMPLE_PROGRAMS | ||||
| COMPILE_PDB_FLAG ?= -Fd$(basename $(@F)).pdb | ||||
|  | @ -140,7 +140,7 @@ ifdef MOZ_DEBUG | |||
| CODFILE=$(basename $(@F)).cod | ||||
| endif | ||||
| 
 | ||||
| endif # !GNU_CC
 | ||||
| endif # CC_TYPE == clang-cl
 | ||||
| endif # WINNT
 | ||||
| 
 | ||||
| ifeq (arm-Darwin,$(TARGET_CPU)-$(OS_TARGET)) | ||||
|  | @ -295,7 +295,7 @@ endif | |||
| # MINGW32
 | ||||
| #
 | ||||
| ifeq ($(OS_ARCH),WINNT) | ||||
| ifdef GNU_CC | ||||
| ifneq ($(CC_TYPE),clang-cl) | ||||
| DSO_LDOPTS += -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) | ||||
| endif | ||||
| endif | ||||
|  | @ -308,11 +308,11 @@ IFLAGS1 = -m 644 | |||
| IFLAGS2 = -m 755 | ||||
| endif | ||||
| 
 | ||||
| ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) | ||||
| ifeq (clang-cl_WINNT,$(CC_TYPE)_$(OS_ARCH)) | ||||
| OUTOPTION = -Fo# eol | ||||
| else | ||||
| OUTOPTION = -o # eol | ||||
| endif # WINNT && !GNU_CC
 | ||||
| endif # WINNT && clang-cl
 | ||||
| 
 | ||||
| ifeq (,$(CROSS_COMPILE)) | ||||
| HOST_OUTOPTION = $(OUTOPTION) | ||||
|  | @ -419,12 +419,12 @@ endef | |||
| $(PROGRAM): $(PROGOBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(call resfile,$(PROGRAM)) $(GLOBAL_DEPS) $(call mkdir_deps,$(FINAL_TARGET)) | ||||
| 	$(REPORT_BUILD) | ||||
| 	$(call BUILDSTATUS,START_Program $(@F)) | ||||
| ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) | ||||
| ifeq (clang-cl_WINNT,$(CC_TYPE)_$(OS_ARCH)) | ||||
| 	$(LINKER) -OUT:$@ -PDB:$(LINK_PDBFILE) -IMPLIB:$(basename $(@F)).lib $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $($(notdir $@)_OBJS) $(filter %.res,$^) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS) | ||||
| else # !WINNT || GNU_CC
 | ||||
| else # !WINNT || !clang-cl
 | ||||
| 	$(call EXPAND_CC_OR_CXX,$@) -o $@ $(COMPUTED_CXX_LDFLAGS) $($(notdir $@)_OBJS) $(filter %.res,$^) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS) | ||||
| 	$(call py_action,check_binary $(@F),$@) | ||||
| endif # WINNT && !GNU_CC
 | ||||
| endif # WINNT && clang-cl
 | ||||
| 
 | ||||
| ifdef ENABLE_STRIP | ||||
| 	$(STRIP) $(STRIP_FLAGS) $@ | ||||
|  | @ -437,7 +437,7 @@ endif | |||
| $(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS) $(call mkdir_deps,$(DEPTH)/dist/host/bin) | ||||
| 	$(REPORT_BUILD) | ||||
| 	$(call BUILDSTATUS,START_Program $(@F)) | ||||
| ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH)) | ||||
| ifeq (clang-cl_WINNT,$(HOST_CC_TYPE)_$(HOST_OS_ARCH)) | ||||
| 	$(HOST_LINKER) -OUT:$@ -PDB:$(HOST_PDBFILE) $($(notdir $@)_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LINKER_LIBPATHS) $(HOST_LIBS) $(HOST_EXTRA_LIBS) | ||||
| else | ||||
| ifeq ($(HOST_CPP_PROG_LINK),1) | ||||
|  | @ -464,12 +464,12 @@ $(foreach p,$(SIMPLE_PROGRAMS),$(eval $(call simple_program_deps,$(p)))) | |||
| $(SIMPLE_PROGRAMS): | ||||
| 	$(REPORT_BUILD) | ||||
| 	$(call BUILDSTATUS,START_Program $(@F)) | ||||
| ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) | ||||
| ifeq (clang-cl_WINNT,$(CC_TYPE)_$(OS_ARCH)) | ||||
| 	$(LINKER) -out:$@ -pdb:$(LINK_PDBFILE) $($@_OBJS) $(filter %.res,$^) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS) | ||||
| else | ||||
| 	$(call EXPAND_CC_OR_CXX,$@) $(COMPUTED_CXX_LDFLAGS) -o $@ $($@_OBJS) $(filter %.res,$^) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS) | ||||
| 	$(call py_action,check_binary $(@F),$@) | ||||
| endif # WINNT && !GNU_CC
 | ||||
| endif # WINNT && clang-cl
 | ||||
| 
 | ||||
| ifdef ENABLE_STRIP | ||||
| 	$(STRIP) $(STRIP_FLAGS) $@ | ||||
|  | @ -482,7 +482,7 @@ endif | |||
| $(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): $(HOST_LIBS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS) | ||||
| 	$(REPORT_BUILD) | ||||
| 	$(call BUILDSTATUS,START_Program $(@F)) | ||||
| ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC)) | ||||
| ifeq (WINNT_clang-cl,$(HOST_OS_ARCH)_$(HOST_CC_TYPE)) | ||||
| 	$(HOST_LINKER) -OUT:$@ -PDB:$(HOST_PDBFILE) $($(notdir $@)_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LINKER_LIBPATHS) $(HOST_LIBS) $(HOST_EXTRA_LIBS) | ||||
| else | ||||
| ifneq (,$(HOST_CPPSRCS)$(USE_HOST_CXX)) | ||||
|  | @ -538,10 +538,10 @@ $(SHARED_LIBRARY): $(OBJS) $(call resfile,$(SHARED_LIBRARY)) $(STATIC_LIBS) $(EX | |||
| 	$(REPORT_BUILD) | ||||
| 	$(call BUILDSTATUS,START_SharedLib $@) | ||||
| 	$(RM) $@ | ||||
| 	$(MKSHLIB) $(if $(filter _WINNT,$(GNU_CC)_$(OS_ARCH)),-IMPLIB:$(basename $(@F)).lib )$($(notdir $@)_OBJS) $(filter %.res,$^) $(RELRHACK_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) | ||||
| 	$(MKSHLIB) $(if $(filter clang-cl_WINNT,$(CC_TYPE)_$(OS_ARCH)),-IMPLIB:$(basename $(@F)).lib )$($(notdir $@)_OBJS) $(filter %.res,$^) $(RELRHACK_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) | ||||
| 	$(call py_action,check_binary,$@) | ||||
| 
 | ||||
| ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) | ||||
| ifeq (clang-cl_WINNT,$(CC_TYPE)_$(OS_ARCH)) | ||||
| endif	# WINNT && !GCC
 | ||||
| 	chmod +x $@ | ||||
| ifdef ENABLE_STRIP | ||||
|  |  | |||
|  | @ -79,10 +79,10 @@ CFLAGS += $(MOZ_ZLIB_CFLAGS) | |||
| ifeq ($(OS_ARCH),SunOS) | ||||
| ifeq ($(TARGET_CPU),sparc) | ||||
| 
 | ||||
| ifdef GNU_CC | ||||
| ifneq ($(CC_TYPE),clang-cl) | ||||
| CFLAGS   += -mcpu=v9 | ||||
| CXXFLAGS += -mcpu=v9 | ||||
| endif # GNU_CC
 | ||||
| endif # !clang-cl
 | ||||
| 
 | ||||
| endif | ||||
| endif | ||||
|  |  | |||
|  | @ -688,7 +688,10 @@ if buildconfig.substs.get("MOZ_CODE_COVERAGE"): | |||
|     ) | ||||
| 
 | ||||
| 
 | ||||
| if buildconfig.substs.get("MOZ_ASAN") and buildconfig.substs.get("CLANG_CL"): | ||||
| if ( | ||||
|     buildconfig.substs.get("MOZ_ASAN") | ||||
|     and buildconfig.substs.get("CC_TYPE") == "clang-cl" | ||||
| ): | ||||
|     asan_dll = { | ||||
|         "source": buildconfig.topobjdir, | ||||
|         "base": "dist/bin", | ||||
|  |  | |||
|  | @ -484,7 +484,7 @@ class LinkFlags(BaseCompileFlags): | |||
|         if all( | ||||
|             [ | ||||
|                 self._context.config.substs.get("OS_ARCH") == "WINNT", | ||||
|                 not self._context.config.substs.get("GNU_CC"), | ||||
|                 self._context.config.substs.get("CC_TYPE") == "clang-cl", | ||||
|                 not self._context.config.substs.get("MOZ_DEBUG"), | ||||
|             ] | ||||
|         ): | ||||
|  |  | |||
|  | @ -870,10 +870,10 @@ class SharedLibrary(Library): | |||
|                     + self.symbols_file | ||||
|                 ) | ||||
|             elif os_target == "WINNT": | ||||
|                 if context.config.substs.get("GNU_CC"): | ||||
|                     self.symbols_link_arg = self.symbols_file | ||||
|                 else: | ||||
|                 if context.config.substs.get("CC_TYPE") == "clang-cl": | ||||
|                     self.symbols_link_arg = "-DEF:" + self.symbols_file | ||||
|                 else: | ||||
|                     self.symbols_link_arg = self.symbols_file | ||||
|             elif context.config.substs.get("GCC_USE_GNU_LD"): | ||||
|                 self.symbols_link_arg = "-Wl,--version-script," + self.symbols_file | ||||
| 
 | ||||
|  |  | |||
|  | @ -1297,10 +1297,10 @@ class TreeMetadataEmitter(LoggingMixin): | |||
|             else: | ||||
|                 path = deffile.target_basename | ||||
| 
 | ||||
|             if context.config.substs.get("GNU_CC"): | ||||
|                 computed_link_flags.resolve_flags("DEFFILE", [path]) | ||||
|             else: | ||||
|             if context.config.substs.get("CC_TYPE") == "clang-cl": | ||||
|                 computed_link_flags.resolve_flags("DEFFILE", ["-DEF:" + path]) | ||||
|             else: | ||||
|                 computed_link_flags.resolve_flags("DEFFILE", [path]) | ||||
| 
 | ||||
|         dist_install = context["DIST_INSTALL"] | ||||
|         if dist_install is True: | ||||
|  | @ -1312,9 +1312,10 @@ class TreeMetadataEmitter(LoggingMixin): | |||
|         # the moment because USE_STATIC_LIBS can be set after a template | ||||
|         # returns. Eventually, with context-based templates, it will be | ||||
|         # possible. | ||||
|         if context.config.substs.get( | ||||
|             "OS_ARCH" | ||||
|         ) == "WINNT" and not context.config.substs.get("GNU_CC"): | ||||
|         if ( | ||||
|             context.config.substs.get("OS_ARCH") == "WINNT" | ||||
|             and context.config.substs.get("CC_TYPE") == "clang-cl" | ||||
|         ): | ||||
|             use_static_lib = context.get( | ||||
|                 "USE_STATIC_LIBS" | ||||
|             ) and not context.config.substs.get("MOZ_ASAN") | ||||
|  |  | |||
|  | @ -277,7 +277,7 @@ class TestEmitterBasic(unittest.TestCase): | |||
|             "link-flags", | ||||
|             extra_substs={ | ||||
|                 "OS_ARCH": "WINNT", | ||||
|                 "GNU_CC": "", | ||||
|                 "CC_TYPE": "clang-cl", | ||||
|                 "MOZ_OPTIMIZE": "1", | ||||
|                 "MOZ_DEBUG_LDFLAGS": ["-DEBUG"], | ||||
|                 "MOZ_DEBUG_SYMBOLS": "1", | ||||
|  | @ -295,7 +295,7 @@ class TestEmitterBasic(unittest.TestCase): | |||
|             "link-flags", | ||||
|             extra_substs={ | ||||
|                 "OS_ARCH": "WINNT", | ||||
|                 "GNU_CC": "", | ||||
|                 "CC_TYPE": "clang-cl", | ||||
|                 "MOZ_DMD": "1", | ||||
|                 "MOZ_DEBUG_LDFLAGS": ["-DEBUG"], | ||||
|                 "MOZ_DEBUG_SYMBOLS": "1", | ||||
|  | @ -366,7 +366,12 @@ class TestEmitterBasic(unittest.TestCase): | |||
| 
 | ||||
|     def test_host_rtl_flag(self): | ||||
|         reader = self.reader( | ||||
|             "host-compile-flags", extra_substs={"OS_ARCH": "WINNT", "MOZ_DEBUG": "1"} | ||||
|             "host-compile-flags", | ||||
|             extra_substs={ | ||||
|                 "OS_ARCH": "WINNT", | ||||
|                 "MOZ_DEBUG": "1", | ||||
|                 "CC_TYPE": "clang-cl", | ||||
|             }, | ||||
|         ) | ||||
|         sources, ldflags, flags, lib, target_flags = self.read_topsrcdir(reader) | ||||
|         self.assertIsInstance(flags, ComputedFlags) | ||||
|  |  | |||
|  | @ -17,5 +17,5 @@ LOCAL_INCLUDES += [ | |||
| 
 | ||||
| FINAL_LIBRARY = "xul-gtest" | ||||
| 
 | ||||
| if CONFIG["GNU_CXX"]: | ||||
| if CONFIG["CC_TYPE"] != "clang-cl": | ||||
|     CXXFLAGS += ["-Wshadow"] | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 serge-sans-paille
						serge-sans-paille