diff options
author | Chih-hung Hsieh <chh@google.com> | 2016-10-13 00:42:01 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-10-13 00:42:01 +0000 |
commit | 355e96774bd762eb96005f8b5e699747bf5a0e4a (patch) | |
tree | d0367de473fc4926e5ee112f3b80c4a3bff8c212 | |
parent | f8d8458eddd469ad1de4bb581acbe8ef4975b053 (diff) | |
parent | bab04888283f9f6d4d29e8d32ea9efe23e789a3e (diff) | |
download | build-android-n-mr1-preview-2.tar.gz |
Merge "Add -Werror to compile warning free projects."android-n-mr1-preview-2android-n-mr1-preview-1
-rw-r--r-- | core/binary.mk | 10 | ||||
-rw-r--r-- | core/config.mk | 35 |
2 files changed, 45 insertions, 0 deletions
diff --git a/core/binary.mk b/core/binary.mk index 4dcb152b74..c682d4e6b7 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -1596,6 +1596,16 @@ ifeq ($(my_strict),true) my_cflags += -DANDROID_STRICT endif +# Add -Werror if LOCAL_PATH is in the WARNING_DISALLOWED project list, +# or not in the WARNING_ALLOWED project list. +ifneq (,$(strip $(call find_warning_disallowed_projects,$(LOCAL_PATH)))) + my_cflags_no_override += -Werror +else + ifeq (,$(strip $(call find_warning_allowed_projects,$(LOCAL_PATH)))) + my_cflags_no_override += -Werror + endif +endif + # Disable clang-tidy if it is not found. ifeq ($(PATH_TO_CLANG_TIDY),) my_tidy_enabled := false diff --git a/core/config.mk b/core/config.mk index 17fb82cbab..c35bfdaa11 100644 --- a/core/config.mk +++ b/core/config.mk @@ -790,4 +790,39 @@ export ANDROID_BUILD_PATHS:=$(abspath $(BUILD_SYSTEM)/no_java_path):$(ANDROID_BU export PATH:=$(abspath $(BUILD_SYSTEM)/no_java_path):$(PATH) endif +# Projects clean of compiler warnings should be compiled with -Werror. +# If most modules in a directory such as external/ have warnings, +# the directory should be in ANDROID_WARNING_ALLOWED_PROJECTS list. +# When some of its subdirectories are cleaned up, the subdirectories +# can be added into ANDROID_WARNING_DISALLOWED_PROJECTS list, e.g. +# external/fio/. +ANDROID_WARNING_DISALLOWED_PROJECTS := \ + art/% \ + bionic/% \ + external/fio/% \ + +define find_warning_disallowed_projects + $(filter $(ANDROID_WARNING_DISALLOWED_PROJECTS),$(1)/) +endef + +# Projects with compiler warnings are compiled without -Werror. +ANDROID_WARNING_ALLOWED_PROJECTS := \ + bootable/% \ + cts/% \ + dalvik/% \ + development/% \ + device/% \ + external/% \ + frameworks/% \ + hardware/% \ + packages/% \ + system/% \ + test/vts/% \ + tools/adt/idea/android/ultimate/get_modification_time/jni/% \ + vendor/% \ + +define find_warning_allowed_projects + $(filter $(ANDROID_WARNING_ALLOWED_PROJECTS),$(1)/) +endef + include $(BUILD_SYSTEM)/dumpvar.mk |