Clean up some kati warnings
Kati has a `--warn` option that adds some extra Kati-specific warnings
-- like using undefined make functions, undefined user functions, likely
bad variable lookups, etc. Some of these are bugs, others are fine doing
nothing. This fixes up all of them in the core build system.
It also complains about $(eval) usage in a recipe not being recommended.
Those aren't handled as part of this change.
Bug: 72661763
Test: build-aosp_arm.ninja is identical before and after
Change-Id: I8e00af142a7745236d3ad4efc9e91ec3ce71a511
diff --git a/core/aux_config.mk b/core/aux_config.mk
index 41c14ae..bdae86a 100644
--- a/core/aux_config.mk
+++ b/core/aux_config.mk
@@ -102,10 +102,10 @@
$(eval AUX_OS_VARIANT_LIST_$(AUX_OS_$(1)):=) \
$(call aux-variant-setup-paths,$(_name)) \
$(eval AUX_ALL_VARIANTS += $(_name)) \
-$(eval AUX_ALL_OSES := $(filterout $(AUX_OS_$(_name)),$(AUX_ALL_OSES)) $(AUX_OS_$(_name))) \
-$(eval AUX_ALL_CPUS := $(filterout $(AUX_CPU_$(_name)),$(AUX_ALL_CPUS)) $(AUX_CPU_$(_name))) \
-$(eval AUX_ALL_ARCHS := $(filterout $(AUX_ARCH_$(_name)),$(AUX_ALL_ARCHS)) $(AUX_ARCH_$(_name))) \
-$(eval AUX_ALL_SUBARCHS := $(filterout $(AUX_SUBARCH_$(_name)),$(AUX_ALL_SUBARCHS)) $(AUX_SUBARCH_$(_name)))
+$(eval AUX_ALL_OSES := $(filter-out $(AUX_OS_$(_name)),$(AUX_ALL_OSES)) $(AUX_OS_$(_name))) \
+$(eval AUX_ALL_CPUS := $(filter-out $(AUX_CPU_$(_name)),$(AUX_ALL_CPUS)) $(AUX_CPU_$(_name))) \
+$(eval AUX_ALL_ARCHS := $(filter-out $(AUX_ARCH_$(_name)),$(AUX_ALL_ARCHS)) $(AUX_ARCH_$(_name))) \
+$(eval AUX_ALL_SUBARCHS := $(filter-out $(AUX_SUBARCH_$(_name)),$(AUX_ALL_SUBARCHS)) $(AUX_SUBARCH_$(_name)))
endef
# Load system configuration referenced by AUX variant config;
@@ -138,7 +138,7 @@
$(eval _all:=) \
$(eval _req:=$(addsuffix _$(1),$(aux_env))) \
$(foreach var,$(_req),$(eval _all += $(var))) \
-$(eval _missing := $(filterout $(_all),$(_req))) \
+$(eval _missing := $(filter-out $(_all),$(_req))) \
$(if $(_missing),$(error AUX variant $(1) must define vars: $(_missing)))
endef
diff --git a/core/config.mk b/core/config.mk
index 37ab875..d0a4af5 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -840,7 +840,7 @@
ifdef DEVICE_FRAMEWORK_MANIFEST_FILE
FRAMEWORK_MANIFEST_INPUT_FILES += $(DEVICE_FRAMEWORK_MANIFEST_FILE)
endif
-$(.KATI_obsolete_var DEVICE_FRAMEWORK_MANIFEST_FILE,No one should ever need to use this.)
+$(KATI_obsolete_var DEVICE_FRAMEWORK_MANIFEST_FILE,No one should ever need to use this.)
BUILD_NUMBER_FROM_FILE := $$(cat $(OUT_DIR)/build_number.txt)
BUILD_DATETIME_FROM_FILE := $$(cat $(OUT_DIR)/build_date.txt)
diff --git a/core/definitions.mk b/core/definitions.mk
index 6ccb82b..2be4f59 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1723,6 +1723,10 @@
$(if $(PRIVATE_ALL_OBJECTS),,$(hide) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)AR) d $(1) $(dir $(1))dummy.o \
&& rm -f $(dir $(1))dummy.o)
endef
+else
+create-dummy.o-if-no-objs =
+get-dummy.o-if-no-objs =
+delete-dummy.o-if-no-objs =
endif # HOST_OS is darwin
# Explicitly delete the archive first so that ar doesn't
diff --git a/core/executable_internal.mk b/core/executable_internal.mk
index 0aec275..4a62fbf 100644
--- a/core/executable_internal.mk
+++ b/core/executable_internal.mk
@@ -12,7 +12,9 @@
LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
endif
+ifdef target-executable-hook
$(call target-executable-hook)
+endif
skip_build_from_source :=
ifdef LOCAL_PREBUILT_MODULE_FILE
diff --git a/core/host_executable_internal.mk b/core/host_executable_internal.mk
index 19200fd..c4f9f66 100644
--- a/core/host_executable_internal.mk
+++ b/core/host_executable_internal.mk
@@ -12,7 +12,9 @@
LOCAL_MODULE_SUFFIX := $($(my_prefix)EXECUTABLE_SUFFIX)
endif
+ifdef host-executable-hook
$(call host-executable-hook)
+endif
skip_build_from_source :=
ifdef LOCAL_PREBUILT_MODULE_FILE
diff --git a/core/host_shared_library_internal.mk b/core/host_shared_library_internal.mk
index 5e199cc..0a3b317 100644
--- a/core/host_shared_library_internal.mk
+++ b/core/host_shared_library_internal.mk
@@ -20,7 +20,9 @@
$(error $(LOCAL_PATH): Cannot set module stem for a library)
endif
+ifdef host-shared-library-hook
$(call host-shared-library-hook)
+endif
skip_build_from_source :=
ifdef LOCAL_PREBUILT_MODULE_FILE
diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk
index 687536b..ab887e0 100644
--- a/core/shared_library_internal.mk
+++ b/core/shared_library_internal.mk
@@ -20,7 +20,9 @@
$(error $(LOCAL_PATH): Cannot set module stem for a library)
endif
+ifdef target-shared-library-hook
$(call target-shared-library-hook)
+endif
skip_build_from_source :=
ifdef LOCAL_PREBUILT_MODULE_FILE