Merge changes from topic "build_time_vintf"
* changes:
Improve BUILT_ASSEMBLED_*_MANIFEST checks
Add check-vintf-all target.
diff --git a/common/math.mk b/common/math.mk
index ac3151e..83f2218 100644
--- a/common/math.mk
+++ b/common/math.mk
@@ -33,8 +33,8 @@
math-expect-error :=
# Run the math tests with:
-# make -f ${ANDROID_BUILD_TOP}/build/make/core/math.mk RUN_MATH_TESTS=true
-# $(get_build_var CKATI) -f ${ANDROID_BUILD_TOP}//build/make/core/math.mk RUN_MATH_TESTS=true
+# make -f ${ANDROID_BUILD_TOP}/build/make/common/math.mk RUN_MATH_TESTS=true
+# $(get_build_var CKATI) -f ${ANDROID_BUILD_TOP}//build/make/common/math.mk RUN_MATH_TESTS=true
ifdef RUN_MATH_TESTS
MATH_TEST_FAILURE :=
MATH_TEST_ERROR :=
@@ -134,6 +134,10 @@
$(if $(filter $(1),$(call math_max,$(1),$(2))),true)
endef
+define math_gt
+$(if $(call math_gt_or_eq,$(2),$(1)),,true)
+endef
+
define math_lt
$(if $(call math_gt_or_eq,$(1),$(2)),,true)
endef
@@ -141,6 +145,12 @@
$(call math-expect-true,(call math_gt_or_eq, 2, 1))
$(call math-expect-true,(call math_gt_or_eq, 1, 1))
$(call math-expect-false,(call math_gt_or_eq, 1, 2))
+$(call math-expect-true,(call math_gt, 4, 3))
+$(call math-expect-false,(call math_gt, 5, 5))
+$(call math-expect-false,(call math_gt, 6, 7))
+$(call math-expect-false,(call math_lt, 1, 0))
+$(call math-expect-false,(call math_lt, 8, 8))
+$(call math-expect-true,(call math_lt, 10, 11))
# $1 is the variable name to increment
define inc_and_print
diff --git a/core/binary.mk b/core/binary.mk
index cf3cfd5..560fff7 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -816,7 +816,7 @@
$(intermediates)/,$(y_yacc_sources:.y=.c))
ifneq ($(y_yacc_cs),)
$(y_yacc_cs): $(intermediates)/%.c: \
- $(TOPDIR)$(LOCAL_PATH)/%.y $(BISON) $(BISON_DATA) \
+ $(TOPDIR)$(LOCAL_PATH)/%.y $(BISON) $(BISON_DATA) $(M4) \
$(my_additional_dependencies)
$(call transform-y-to-c-or-cpp)
$(call track-src-file-gen,$(y_yacc_sources),$(y_yacc_cs))
@@ -829,7 +829,7 @@
$(intermediates)/,$(yy_yacc_sources:.yy=$(LOCAL_CPP_EXTENSION)))
ifneq ($(yy_yacc_cpps),)
$(yy_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
- $(TOPDIR)$(LOCAL_PATH)/%.yy $(BISON) $(BISON_DATA) \
+ $(TOPDIR)$(LOCAL_PATH)/%.yy $(BISON) $(BISON_DATA) $(M4) \
$(my_additional_dependencies)
$(call transform-y-to-c-or-cpp)
$(call track-src-file-gen,$(yy_yacc_sources),$(yy_yacc_cpps))
@@ -845,6 +845,7 @@
l_lex_cs := $(addprefix \
$(intermediates)/,$(l_lex_sources:.l=.c))
ifneq ($(l_lex_cs),)
+$(l_lex_cs): $(LEX) $(M4)
$(l_lex_cs): $(intermediates)/%.c: \
$(TOPDIR)$(LOCAL_PATH)/%.l
$(transform-l-to-c-or-cpp)
@@ -857,6 +858,7 @@
ll_lex_cpps := $(addprefix \
$(intermediates)/,$(ll_lex_sources:.ll=$(LOCAL_CPP_EXTENSION)))
ifneq ($(ll_lex_cpps),)
+$(ll_lex_cpps): $(LEX) $(M4)
$(ll_lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
$(TOPDIR)$(LOCAL_PATH)/%.ll
$(transform-l-to-c-or-cpp)
diff --git a/core/config.mk b/core/config.mk
index 4cc78b8..c5f54de 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -553,6 +553,7 @@
BISON := $(prebuilt_build_tools_bin_noasan)/bison
YACC := $(BISON) -d
BISON_DATA := $(wildcard $(BISON_PKGDATADIR)/* $(BISON_PKGDATADIR)/*/*)
+M4 :=$= $(prebuilt_build_tools_bin_noasan)/m4
YASM := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/yasm/yasm
@@ -709,19 +710,37 @@
PRODUCT_USE_VNDK := $(PRODUCT_USE_VNDK_OVERRIDE)
else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),)
# No shipping level defined
-else ifeq ($(call math_gt_or_eq,27,$(PRODUCT_SHIPPING_API_LEVEL)),)
+else ifeq ($(call math_gt,$(PRODUCT_SHIPPING_API_LEVEL),27),true)
PRODUCT_USE_VNDK := $(PRODUCT_FULL_TREBLE)
endif
+# Define PRODUCT_PRODUCT_VNDK_VERSION if PRODUCT_USE_VNDK is true and
+# PRODUCT_SHIPPING_API_LEVEL is greater than 29.
+PRODUCT_USE_PRODUCT_VNDK := false
ifeq ($(PRODUCT_USE_VNDK),true)
+ ifneq ($(PRODUCT_USE_PRODUCT_VNDK_OVERRIDE),)
+ PRODUCT_USE_PRODUCT_VNDK := $(PRODUCT_USE_PRODUCT_VNDK_OVERRIDE)
+ else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),)
+ # No shipping level defined
+ else ifeq ($(call math_gt,$(PRODUCT_SHIPPING_API_LEVEL),29),true)
+ PRODUCT_USE_PRODUCT_VNDK := true
+ endif
+
ifndef BOARD_VNDK_VERSION
BOARD_VNDK_VERSION := current
endif
+
+ ifeq ($(PRODUCT_USE_PRODUCT_VNDK),true)
+ ifndef PRODUCT_PRODUCT_VNDK_VERSION
+ PRODUCT_PRODUCT_VNDK_VERSION := current
+ endif
+ endif
endif
-$(KATI_obsolete_var PRODUCT_USE_VNDK_OVERRIDE,Use PRODUCT_USE_VNDK instead)
-.KATI_READONLY := \
- PRODUCT_USE_VNDK
+$(KATI_obsolete_var PRODUCT_USE_VNDK,Use BOARD_VNDK_VERSION instead)
+$(KATI_obsolete_var PRODUCT_USE_VNDK_OVERRIDE,Use BOARD_VNDK_VERSION instead)
+$(KATI_obsolete_var PRODUCT_USE_PRODUCT_VNDK,Use PRODUCT_PRODUCT_VNDK_VERSION instead)
+$(KATI_obsolete_var PRODUCT_USE_PRODUCT_VNDK_OVERRIDE,Use PRODUCT_PRODUCT_VNDK_VERSION instead)
# Set BOARD_SYSTEMSDK_VERSIONS to the latest SystemSDK version starting from P-launching
# devices if unset.
diff --git a/core/definitions.mk b/core/definitions.mk
index ff435e2..49747ed 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -889,7 +889,7 @@
define transform-l-to-c-or-cpp
@echo "Lex: $(PRIVATE_MODULE) <= $<"
@mkdir -p $(dir $@)
-$(hide) $(LEX) -o$@ $<
+M4=$(M4) $(LEX) -o$@ $<
endef
###########################################################
@@ -900,7 +900,7 @@
define transform-y-to-c-or-cpp
@echo "Yacc: $(PRIVATE_MODULE) <= $<"
@mkdir -p $(dir $@)
-$(YACC) $(PRIVATE_YACCFLAGS) \
+M4=$(M4) $(YACC) $(PRIVATE_YACCFLAGS) \
--defines=$(basename $@).h \
-o $@ $<
endef
diff --git a/core/dex_preopt_config.mk b/core/dex_preopt_config.mk
index 78cc012..5dd5505 100644
--- a/core/dex_preopt_config.mk
+++ b/core/dex_preopt_config.mk
@@ -37,14 +37,6 @@
endif
endif
-# Default to debug version to help find bugs.
-# Set USE_DEX2OAT_DEBUG to false for only building non-debug versions.
-ifeq ($(USE_DEX2OAT_DEBUG),false)
-DEX2OAT := $(SOONG_HOST_OUT_EXECUTABLES)/dex2oat$(HOST_EXECUTABLE_SUFFIX)
-else
-DEX2OAT := $(SOONG_HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
-endif
-
# Use the first preloaded-classes file in PRODUCT_COPY_FILES.
PRELOADED_CLASSES := $(call word-colon,1,$(firstword \
$(filter %system/etc/preloaded-classes,$(PRODUCT_COPY_FILES))))
@@ -134,16 +126,6 @@
$(call add_json_str, Dex2oatImageXmx, $(DEX2OAT_IMAGE_XMX))
$(call add_json_str, Dex2oatImageXms, $(DEX2OAT_IMAGE_XMS))
- $(call add_json_map, Tools)
- $(call add_json_str, Profman, $(SOONG_HOST_OUT_EXECUTABLES)/profman)
- $(call add_json_str, Dex2oat, $(DEX2OAT))
- $(call add_json_str, Aapt, $(SOONG_HOST_OUT_EXECUTABLES)/aapt)
- $(call add_json_str, SoongZip, $(SOONG_ZIP))
- $(call add_json_str, Zip2zip, $(ZIP2ZIP))
- $(call add_json_str, ManifestCheck, $(SOONG_HOST_OUT_EXECUTABLES)/manifest_check)
- $(call add_json_str, ConstructContext, $(BUILD_SYSTEM)/construct_context.sh)
- $(call end_json_map)
-
$(call json_end)
$(shell mkdir -p $(dir $(DEX_PREOPT_CONFIG)))
@@ -156,11 +138,3 @@
rm $(DEX_PREOPT_CONFIG).tmp; \
fi)
endif
-
-DEXPREOPT_GEN_DEPS := \
- $(SOONG_HOST_OUT_EXECUTABLES)/profman \
- $(DEX2OAT) \
- $(SOONG_HOST_OUT_EXECUTABLES)/aapt \
- $(SOONG_ZIP) \
- $(ZIP2ZIP) \
- $(BUILD_SYSTEM)/construct_context.sh \
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index e6b5010..0fb2dd2 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -114,7 +114,7 @@
my_dexpreopt_image_locations :=
my_dexpreopt_infix := boot
ifeq (true, $(DEXPREOPT_USE_APEX_IMAGE))
- my_dexpreopt_infix := apex
+ my_dexpreopt_infix := jitzygote-boot
endif
ifdef LOCAL_DEX_PREOPT
@@ -259,12 +259,16 @@
.KATI_RESTAT: $(my_dexpreopt_script)
$(my_dexpreopt_script): PRIVATE_MODULE := $(LOCAL_MODULE)
+ $(my_dexpreopt_script): PRIVATE_GLOBAL_SOONG_CONFIG := $(DEX_PREOPT_SOONG_CONFIG_FOR_MAKE)
$(my_dexpreopt_script): PRIVATE_GLOBAL_CONFIG := $(DEX_PREOPT_CONFIG_FOR_MAKE)
$(my_dexpreopt_script): PRIVATE_MODULE_CONFIG := $(my_dexpreopt_config)
$(my_dexpreopt_script): $(DEXPREOPT_GEN)
- $(my_dexpreopt_script): $(my_dexpreopt_config) $(DEX_PREOPT_CONFIG_FOR_MAKE)
+ $(my_dexpreopt_script): $(my_dexpreopt_config) $(DEX_PREOPT_SOONG_CONFIG_FOR_MAKE) $(DEX_PREOPT_CONFIG_FOR_MAKE)
@echo "$(PRIVATE_MODULE) dexpreopt gen"
- $(DEXPREOPT_GEN) -global $(PRIVATE_GLOBAL_CONFIG) -module $(PRIVATE_MODULE_CONFIG) \
+ $(DEXPREOPT_GEN) \
+ -global_soong $(PRIVATE_GLOBAL_SOONG_CONFIG) \
+ -global $(PRIVATE_GLOBAL_CONFIG) \
+ -module $(PRIVATE_MODULE_CONFIG) \
-dexpreopt_script $@ \
-out_dir $(OUT_DIR)
diff --git a/core/main.mk b/core/main.mk
index e0bf6ea..0400856 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1606,7 +1606,7 @@
endif
ifeq ($(EMMA_INSTRUMENT),true)
- $(JACOCO_REPORT_CLASSES_ALL) : $(INSTALLED_SYSTEMIMAGE_TARGET)
+ $(JACOCO_REPORT_CLASSES_ALL) : $(modules_to_install)
$(call dist-for-goals, dist_files, $(JACOCO_REPORT_CLASSES_ALL))
endif
diff --git a/core/tasks/boot_jars_package_check.mk b/core/tasks/boot_jars_package_check.mk
index ba383f5..ceaff54 100644
--- a/core/tasks/boot_jars_package_check.mk
+++ b/core/tasks/boot_jars_package_check.mk
@@ -22,10 +22,23 @@
intermediates := $(call intermediates-dir-for, PACKAGING, boot-jars-package-check,,COMMON)
stamp := $(intermediates)/stamp
-art_boot_jars := $(addsuffix .com.android.art.release,$(filter $(ART_APEX_JARS), $(PRODUCT_BOOT_JARS)))
-conscrypt_boot_jars := $(addsuffix .com.android.conscrypt,$(filter conscrypt, $(PRODUCT_BOOT_JARS)))
-noncore_boot_jars := $(filter-out $(ART_APEX_JARS) conscrypt, $(PRODUCT_BOOT_JARS))
-built_boot_jars := $(foreach j, $(art_boot_jars) $(conscrypt_boot_jars) $(noncore_boot_jars), \
+
+# The actual names for the updatable jars are <jar_name>.<apex_name> e.g., updatable-media.com.android.media
+updatable_boot_jars := $(foreach pair,$(PRODUCT_UPDATABLE_BOOT_JARS),\
+ $(eval apex := $(call word-colon,1,$(pair)))\
+ $(eval jar := $(call word-colon,2,$(pair)))\
+ $(jar).$(apex)\
+)
+#TODO(jiyong) merge art_boot_jars into updatable_boot_jars
+art_boot_jars := $(addsuffix .com.android.art.release,$(filter $(ART_APEX_JARS),$(PRODUCT_BOOT_JARS)))
+
+platform_boot_jars := $(filter-out \
+ $(ART_APEX_JARS)\
+ $(foreach pair,$(PRODUCT_UPDATABLE_BOOT_JARS),$(call word-colon,2,$(pair))),\
+ $(PRODUCT_BOOT_JARS)\
+)
+
+built_boot_jars := $(foreach j, $(updatable_boot_jars) $(art_boot_jars) $(platform_boot_jars), \
$(call intermediates-dir-for, JAVA_LIBRARIES, $(j),,COMMON)/classes.jar)
script := build/make/core/tasks/check_boot_jars/check_boot_jars.py
whitelist_file := build/make/core/tasks/check_boot_jars/package_whitelist.txt
diff --git a/core/tasks/check_boot_jars/check_boot_jars.py b/core/tasks/check_boot_jars/check_boot_jars.py
index 9d71553..67b73d5 100755
--- a/core/tasks/check_boot_jars/check_boot_jars.py
+++ b/core/tasks/check_boot_jars/check_boot_jars.py
@@ -53,10 +53,9 @@
if f.endswith('.class'):
package_name = os.path.dirname(f)
package_name = package_name.replace('/', '.')
- # Skip class without a package name
- if package_name and not whitelist_re.match(package_name):
- print >> sys.stderr, ('Error: %s contains class file %s, whose package name %s is not '
- 'in the whitelist %s of packages allowed on the bootclasspath.'
+ if not package_name or not whitelist_re.match(package_name):
+ print >> sys.stderr, ('Error: %s contains class file %s, whose package name %s is empty or'
+ ' not in the whitelist %s of packages allowed on the bootclasspath.'
% (jar, f, package_name, whitelist_path))
return False
return True
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 8095212..5d445e0 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -250,7 +250,7 @@
# It must be of the form "YYYY-MM-DD" on production devices.
# It must match one of the Android Security Patch Level strings of the Public Security Bulletins.
# If there is no $PLATFORM_SECURITY_PATCH set, keep it empty.
- PLATFORM_SECURITY_PATCH := 2019-12-05
+ PLATFORM_SECURITY_PATCH := 2020-01-01
endif
.KATI_READONLY := PLATFORM_SECURITY_PATCH
diff --git a/envsetup.sh b/envsetup.sh
index a44cd50..389fbb7 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1342,7 +1342,7 @@
refreshmod || return 1
fi
- python -c "import json; print '\n'.join(sorted(json.load(open('$ANDROID_PRODUCT_OUT/module-info.json')).keys()))"
+ python -c "import json; print('\n'.join(sorted(json.load(open('$ANDROID_PRODUCT_OUT/module-info.json')).keys())))"
}
# Get the path of a specific module in the android tree, as cached in module-info.json. If any build change
@@ -1368,7 +1368,7 @@
module_info = json.load(open('$ANDROID_PRODUCT_OUT/module-info.json'))
if module not in module_info:
exit(1)
-print module_info[module]['path'][0]" 2>/dev/null)
+print(module_info[module]['path'][0])" 2>/dev/null)
if [ -z "$relpath" ]; then
echo "Could not find module '$1' (try 'refreshmod' if there have been build changes?)." >&2
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 2895801..8ced9ab 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -323,7 +323,7 @@
telephony-common \
voip-common \
ims-common \
- framework-sdkext \
+ framework-sdkextensions \
ike \
updatable-media \
framework-tethering
@@ -332,7 +332,7 @@
com.android.conscrypt:conscrypt \
com.android.ipsec:ike \
com.android.media:updatable-media \
- com.android.sdkext:framework-sdkext \
+ com.android.sdkext:framework-sdkextensions \
com.android.tethering:framework-tethering
PRODUCT_COPY_FILES += \
diff --git a/target/product/gsi/current.txt b/target/product/gsi/current.txt
index c50177f..d29a48f 100644
--- a/target/product/gsi/current.txt
+++ b/target/product/gsi/current.txt
@@ -186,6 +186,7 @@
VNDK-core: android.hardware.usb@1.0.so
VNDK-core: android.hardware.usb@1.1.so
VNDK-core: android.hardware.usb@1.2.so
+VNDK-core: android.hardware.vibrator-V1-ndk_platform.so
VNDK-core: android.hardware.vibrator@1.0.so
VNDK-core: android.hardware.vibrator@1.1.so
VNDK-core: android.hardware.vibrator@1.2.so
@@ -273,7 +274,6 @@
VNDK-core: libxml2.so
VNDK-core: libyuv.so
VNDK-core: libziparchive.so
-VNDK-core: vintf-vibrator-V1-ndk_platform.so
VNDK-private: libbacktrace.so
VNDK-private: libbinderthreadstate.so
VNDK-private: libblas.so
diff --git a/target/product/sdk_phone_x86.mk b/target/product/sdk_phone_x86.mk
index 4f7602d..9df26a9 100644
--- a/target/product/sdk_phone_x86.mk
+++ b/target/product/sdk_phone_x86.mk
@@ -15,7 +15,6 @@
#
QEMU_USE_SYSTEM_EXT_PARTITIONS := true
PRODUCT_USE_DYNAMIC_PARTITIONS := true
-BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flags 2
#
# All components inherited here go to system image
diff --git a/tools/releasetools/check_target_files_vintf.py b/tools/releasetools/check_target_files_vintf.py
index a556f53..f41df37 100755
--- a/tools/releasetools/check_target_files_vintf.py
+++ b/tools/releasetools/check_target_files_vintf.py
@@ -45,6 +45,7 @@
'/vendor': ('VENDOR', 'SYSTEM/vendor'),
'/product': ('PRODUCT', 'SYSTEM/product'),
'/odm': ('ODM', 'VENDOR/odm', 'SYSTEM/vendor/odm'),
+ '/system_ext': ('SYSTEM_EXT', 'SYSTEM/system_ext'),
}
UNZIP_PATTERN = ['META/*', '*/build.prop']
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index b0a0e02..6a6f119 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -62,7 +62,7 @@
'Warning: releasetools script should be invoked as hermetic Python '
'executable -- build and run `{}` directly.'.format(script_name[:-3]),
file=sys.stderr)
- self.search_path = os.path.realpath(os.path.join(exec_path, '..'))
+ self.search_path = os.path.realpath(os.path.join(os.path.dirname(exec_path), '..'))
self.signapk_path = "framework/signapk.jar" # Relative to search_path
self.signapk_shared_library_path = "lib64" # Relative to search_path
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index 35b11c1..fffbace 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -552,8 +552,13 @@
# Ask add_img_to_target_files to rebuild the recovery patch if needed.
elif filename in ("SYSTEM/recovery-from-boot.p",
+ "VENDOR/recovery-from-boot.p",
+
"SYSTEM/etc/recovery.img",
- "SYSTEM/bin/install-recovery.sh"):
+ "VENDOR/etc/recovery.img",
+
+ "SYSTEM/bin/install-recovery.sh",
+ "VENDOR/bin/install-recovery.sh"):
OPTIONS.rebuild_recovery = True
# Don't copy OTA certs if we're replacing them.
diff --git a/tools/warn/android_project_list.py b/tools/warn/android_project_list.py
index 1e9e276..4726fa2 100644
--- a/tools/warn/android_project_list.py
+++ b/tools/warn/android_project_list.py
@@ -1,4 +1,4 @@
-#
+# python3
# Copyright (C) 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,161 +16,160 @@
"""Define a project list to sort warnings by project directory path."""
-def project_name_and_pattern(name, pattern):
- return [name, '(^|.*/)' + pattern + '/.*: warning:']
-
-
-def simple_project_pattern(pattern):
- return project_name_and_pattern(pattern, pattern)
+def create_pattern(name, pattern=None):
+ if pattern is not None:
+ return [name, '(^|.*/)' + pattern + '/.*: warning:']
+ return [name, '(^|.*/)' + name + '/.*: warning:']
# A list of [project_name, file_path_pattern].
# project_name should not contain comma, to be used in CSV output.
project_list = [
- simple_project_pattern('art'),
- simple_project_pattern('bionic'),
- simple_project_pattern('bootable'),
- simple_project_pattern('build'),
- simple_project_pattern('cts'),
- simple_project_pattern('dalvik'),
- simple_project_pattern('developers'),
- simple_project_pattern('development'),
- simple_project_pattern('device'),
- simple_project_pattern('doc'),
+ create_pattern('art'),
+ create_pattern('bionic'),
+ create_pattern('bootable'),
+ create_pattern('build'),
+ create_pattern('cts'),
+ create_pattern('dalvik'),
+ create_pattern('developers'),
+ create_pattern('development'),
+ create_pattern('device'),
+ create_pattern('doc'),
# match external/google* before external/
- project_name_and_pattern('external/google', 'external/google.*'),
- project_name_and_pattern('external/non-google', 'external'),
- simple_project_pattern('frameworks/av/camera'),
- simple_project_pattern('frameworks/av/cmds'),
- simple_project_pattern('frameworks/av/drm'),
- simple_project_pattern('frameworks/av/include'),
- simple_project_pattern('frameworks/av/media/img_utils'),
- simple_project_pattern('frameworks/av/media/libcpustats'),
- simple_project_pattern('frameworks/av/media/libeffects'),
- simple_project_pattern('frameworks/av/media/libmediaplayerservice'),
- simple_project_pattern('frameworks/av/media/libmedia'),
- simple_project_pattern('frameworks/av/media/libstagefright'),
- simple_project_pattern('frameworks/av/media/mtp'),
- simple_project_pattern('frameworks/av/media/ndk'),
- simple_project_pattern('frameworks/av/media/utils'),
- project_name_and_pattern('frameworks/av/media/Other',
- 'frameworks/av/media'),
- simple_project_pattern('frameworks/av/radio'),
- simple_project_pattern('frameworks/av/services'),
- simple_project_pattern('frameworks/av/soundtrigger'),
- project_name_and_pattern('frameworks/av/Other', 'frameworks/av'),
- simple_project_pattern('frameworks/base/cmds'),
- simple_project_pattern('frameworks/base/core'),
- simple_project_pattern('frameworks/base/drm'),
- simple_project_pattern('frameworks/base/media'),
- simple_project_pattern('frameworks/base/libs'),
- simple_project_pattern('frameworks/base/native'),
- simple_project_pattern('frameworks/base/packages'),
- simple_project_pattern('frameworks/base/rs'),
- simple_project_pattern('frameworks/base/services'),
- simple_project_pattern('frameworks/base/tests'),
- simple_project_pattern('frameworks/base/tools'),
- project_name_and_pattern('frameworks/base/Other', 'frameworks/base'),
- simple_project_pattern('frameworks/compile/libbcc'),
- simple_project_pattern('frameworks/compile/mclinker'),
- simple_project_pattern('frameworks/compile/slang'),
- project_name_and_pattern('frameworks/compile/Other', 'frameworks/compile'),
- simple_project_pattern('frameworks/minikin'),
- simple_project_pattern('frameworks/ml'),
- simple_project_pattern('frameworks/native/cmds'),
- simple_project_pattern('frameworks/native/include'),
- simple_project_pattern('frameworks/native/libs'),
- simple_project_pattern('frameworks/native/opengl'),
- simple_project_pattern('frameworks/native/services'),
- simple_project_pattern('frameworks/native/vulkan'),
- project_name_and_pattern('frameworks/native/Other', 'frameworks/native'),
- simple_project_pattern('frameworks/opt'),
- simple_project_pattern('frameworks/rs'),
- simple_project_pattern('frameworks/webview'),
- simple_project_pattern('frameworks/wilhelm'),
- project_name_and_pattern('frameworks/Other', 'frameworks'),
- simple_project_pattern('hardware/akm'),
- simple_project_pattern('hardware/broadcom'),
- simple_project_pattern('hardware/google'),
- simple_project_pattern('hardware/intel'),
- simple_project_pattern('hardware/interfaces'),
- simple_project_pattern('hardware/libhardware'),
- simple_project_pattern('hardware/libhardware_legacy'),
- simple_project_pattern('hardware/qcom'),
- simple_project_pattern('hardware/ril'),
- project_name_and_pattern('hardware/Other', 'hardware'),
- simple_project_pattern('kernel'),
- simple_project_pattern('libcore'),
- simple_project_pattern('libnativehelper'),
- simple_project_pattern('ndk'),
+ create_pattern('external/google', 'external/google.*'),
+ create_pattern('external/non-google', 'external'),
+ create_pattern('frameworks/av/camera'),
+ create_pattern('frameworks/av/cmds'),
+ create_pattern('frameworks/av/drm'),
+ create_pattern('frameworks/av/include'),
+ create_pattern('frameworks/av/media/img_utils'),
+ create_pattern('frameworks/av/media/libcpustats'),
+ create_pattern('frameworks/av/media/libeffects'),
+ create_pattern('frameworks/av/media/libmediaplayerservice'),
+ create_pattern('frameworks/av/media/libmedia'),
+ create_pattern('frameworks/av/media/libstagefright'),
+ create_pattern('frameworks/av/media/mtp'),
+ create_pattern('frameworks/av/media/ndk'),
+ create_pattern('frameworks/av/media/utils'),
+ create_pattern('frameworks/av/media/Other', 'frameworks/av/media'),
+ create_pattern('frameworks/av/radio'),
+ create_pattern('frameworks/av/services'),
+ create_pattern('frameworks/av/soundtrigger'),
+ create_pattern('frameworks/av/Other', 'frameworks/av'),
+ create_pattern('frameworks/base/cmds'),
+ create_pattern('frameworks/base/core'),
+ create_pattern('frameworks/base/drm'),
+ create_pattern('frameworks/base/media'),
+ create_pattern('frameworks/base/libs'),
+ create_pattern('frameworks/base/native'),
+ create_pattern('frameworks/base/packages'),
+ create_pattern('frameworks/base/rs'),
+ create_pattern('frameworks/base/services'),
+ create_pattern('frameworks/base/tests'),
+ create_pattern('frameworks/base/tools'),
+ create_pattern('frameworks/base/Other', 'frameworks/base'),
+ create_pattern('frameworks/compile/libbcc'),
+ create_pattern('frameworks/compile/mclinker'),
+ create_pattern('frameworks/compile/slang'),
+ create_pattern('frameworks/compile/Other', 'frameworks/compile'),
+ create_pattern('frameworks/minikin'),
+ create_pattern('frameworks/ml'),
+ create_pattern('frameworks/native/cmds'),
+ create_pattern('frameworks/native/include'),
+ create_pattern('frameworks/native/libs'),
+ create_pattern('frameworks/native/opengl'),
+ create_pattern('frameworks/native/services'),
+ create_pattern('frameworks/native/vulkan'),
+ create_pattern('frameworks/native/Other', 'frameworks/native'),
+ create_pattern('frameworks/opt'),
+ create_pattern('frameworks/rs'),
+ create_pattern('frameworks/webview'),
+ create_pattern('frameworks/wilhelm'),
+ create_pattern('frameworks/Other', 'frameworks'),
+ create_pattern('hardware/akm'),
+ create_pattern('hardware/broadcom'),
+ create_pattern('hardware/google'),
+ create_pattern('hardware/intel'),
+ create_pattern('hardware/interfaces'),
+ create_pattern('hardware/libhardware'),
+ create_pattern('hardware/libhardware_legacy'),
+ create_pattern('hardware/qcom'),
+ create_pattern('hardware/ril'),
+ create_pattern('hardware/Other', 'hardware'),
+ create_pattern('kernel'),
+ create_pattern('libcore'),
+ create_pattern('libnativehelper'),
+ create_pattern('ndk'),
# match vendor/unbungled_google/packages before other packages
- simple_project_pattern('unbundled_google'),
- simple_project_pattern('packages'),
- simple_project_pattern('pdk'),
- simple_project_pattern('prebuilts'),
- simple_project_pattern('system/bt'),
- simple_project_pattern('system/connectivity'),
- simple_project_pattern('system/core/adb'),
- simple_project_pattern('system/core/base'),
- simple_project_pattern('system/core/debuggerd'),
- simple_project_pattern('system/core/fastboot'),
- simple_project_pattern('system/core/fingerprintd'),
- simple_project_pattern('system/core/fs_mgr'),
- simple_project_pattern('system/core/gatekeeperd'),
- simple_project_pattern('system/core/healthd'),
- simple_project_pattern('system/core/include'),
- simple_project_pattern('system/core/init'),
- simple_project_pattern('system/core/libbacktrace'),
- simple_project_pattern('system/core/liblog'),
- simple_project_pattern('system/core/libpixelflinger'),
- simple_project_pattern('system/core/libprocessgroup'),
- simple_project_pattern('system/core/libsysutils'),
- simple_project_pattern('system/core/logcat'),
- simple_project_pattern('system/core/logd'),
- simple_project_pattern('system/core/run-as'),
- simple_project_pattern('system/core/sdcard'),
- simple_project_pattern('system/core/toolbox'),
- project_name_and_pattern('system/core/Other', 'system/core'),
- simple_project_pattern('system/extras/ANRdaemon'),
- simple_project_pattern('system/extras/cpustats'),
- simple_project_pattern('system/extras/crypto-perf'),
- simple_project_pattern('system/extras/ext4_utils'),
- simple_project_pattern('system/extras/f2fs_utils'),
- simple_project_pattern('system/extras/iotop'),
- simple_project_pattern('system/extras/libfec'),
- simple_project_pattern('system/extras/memory_replay'),
- simple_project_pattern('system/extras/mmap-perf'),
- simple_project_pattern('system/extras/multinetwork'),
- simple_project_pattern('system/extras/procrank'),
- simple_project_pattern('system/extras/runconuid'),
- simple_project_pattern('system/extras/showmap'),
- simple_project_pattern('system/extras/simpleperf'),
- simple_project_pattern('system/extras/su'),
- simple_project_pattern('system/extras/tests'),
- simple_project_pattern('system/extras/verity'),
- project_name_and_pattern('system/extras/Other', 'system/extras'),
- simple_project_pattern('system/gatekeeper'),
- simple_project_pattern('system/keymaster'),
- simple_project_pattern('system/libhidl'),
- simple_project_pattern('system/libhwbinder'),
- simple_project_pattern('system/media'),
- simple_project_pattern('system/netd'),
- simple_project_pattern('system/nvram'),
- simple_project_pattern('system/security'),
- simple_project_pattern('system/sepolicy'),
- simple_project_pattern('system/tools'),
- simple_project_pattern('system/update_engine'),
- simple_project_pattern('system/vold'),
- project_name_and_pattern('system/Other', 'system'),
- simple_project_pattern('toolchain'),
- simple_project_pattern('test'),
- simple_project_pattern('tools'),
+ create_pattern('unbundled_google'),
+ create_pattern('packages'),
+ create_pattern('pdk'),
+ create_pattern('prebuilts'),
+ create_pattern('system/bt'),
+ create_pattern('system/connectivity'),
+ create_pattern('system/core/adb'),
+ create_pattern('system/core/base'),
+ create_pattern('system/core/debuggerd'),
+ create_pattern('system/core/fastboot'),
+ create_pattern('system/core/fingerprintd'),
+ create_pattern('system/core/fs_mgr'),
+ create_pattern('system/core/gatekeeperd'),
+ create_pattern('system/core/healthd'),
+ create_pattern('system/core/include'),
+ create_pattern('system/core/init'),
+ create_pattern('system/core/libbacktrace'),
+ create_pattern('system/core/liblog'),
+ create_pattern('system/core/libpixelflinger'),
+ create_pattern('system/core/libprocessgroup'),
+ create_pattern('system/core/libsysutils'),
+ create_pattern('system/core/logcat'),
+ create_pattern('system/core/logd'),
+ create_pattern('system/core/run-as'),
+ create_pattern('system/core/sdcard'),
+ create_pattern('system/core/toolbox'),
+ create_pattern('system/core/Other', 'system/core'),
+ create_pattern('system/extras/ANRdaemon'),
+ create_pattern('system/extras/cpustats'),
+ create_pattern('system/extras/crypto-perf'),
+ create_pattern('system/extras/ext4_utils'),
+ create_pattern('system/extras/f2fs_utils'),
+ create_pattern('system/extras/iotop'),
+ create_pattern('system/extras/libfec'),
+ create_pattern('system/extras/memory_replay'),
+ create_pattern('system/extras/mmap-perf'),
+ create_pattern('system/extras/multinetwork'),
+ create_pattern('system/extras/perfprofd'),
+ create_pattern('system/extras/procrank'),
+ create_pattern('system/extras/runconuid'),
+ create_pattern('system/extras/showmap'),
+ create_pattern('system/extras/simpleperf'),
+ create_pattern('system/extras/su'),
+ create_pattern('system/extras/tests'),
+ create_pattern('system/extras/verity'),
+ create_pattern('system/extras/Other', 'system/extras'),
+ create_pattern('system/gatekeeper'),
+ create_pattern('system/keymaster'),
+ create_pattern('system/libhidl'),
+ create_pattern('system/libhwbinder'),
+ create_pattern('system/media'),
+ create_pattern('system/netd'),
+ create_pattern('system/nvram'),
+ create_pattern('system/security'),
+ create_pattern('system/sepolicy'),
+ create_pattern('system/tools'),
+ create_pattern('system/update_engine'),
+ create_pattern('system/vold'),
+ create_pattern('system/Other', 'system'),
+ create_pattern('toolchain'),
+ create_pattern('test'),
+ create_pattern('tools'),
# match vendor/google* before vendor/
- project_name_and_pattern('vendor/google', 'vendor/google.*'),
- project_name_and_pattern('vendor/non-google', 'vendor'),
+ create_pattern('vendor/google', 'vendor/google.*'),
+ create_pattern('vendor/non-google', 'vendor'),
# keep out/obj and other patterns at the end.
- ['out/obj',
- '.*/(gen|obj[^/]*)/(include|EXECUTABLES|SHARED_LIBRARIES|'
- 'STATIC_LIBRARIES|NATIVE_TESTS)/.*: warning:'],
+ [
+ 'out/obj', '.*/(gen|obj[^/]*)/(include|EXECUTABLES|SHARED_LIBRARIES|'
+ 'STATIC_LIBRARIES|NATIVE_TESTS)/.*: warning:'
+ ],
['other', '.*'] # all other unrecognized patterns
]
diff --git a/tools/warn/cpp_warn_patterns.py b/tools/warn/cpp_warn_patterns.py
index 8ae0a3c..0c458fb 100644
--- a/tools/warn/cpp_warn_patterns.py
+++ b/tools/warn/cpp_warn_patterns.py
@@ -1,4 +1,4 @@
-#
+# python3
# Copyright (C) 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,563 +15,447 @@
"""Warning patterns for C/C++ compiler, but not clang-tidy."""
-from severity import Severity
+import re
-patterns = [
+# pylint:disable=relative-beyond-top-level
+# pylint:disable=g-importing-member
+from .severity import Severity
+
+
+def cpp_warn(severity, description, pattern_list):
+ return {
+ 'category': 'C/C++',
+ 'severity': severity,
+ 'description': description,
+ 'patterns': pattern_list
+ }
+
+
+def fixmenow(description, pattern_list):
+ return cpp_warn(Severity.FIXMENOW, description, pattern_list)
+
+
+def high(description, pattern_list):
+ return cpp_warn(Severity.HIGH, description, pattern_list)
+
+
+def medium(description, pattern_list):
+ return cpp_warn(Severity.MEDIUM, description, pattern_list)
+
+
+def low(description, pattern_list):
+ return cpp_warn(Severity.LOW, description, pattern_list)
+
+
+def skip(description, pattern_list):
+ return cpp_warn(Severity.SKIP, description, pattern_list)
+
+
+def harmless(description, pattern_list):
+ return cpp_warn(Severity.HARMLESS, description, pattern_list)
+
+
+warn_patterns = [
# pylint:disable=line-too-long,g-inconsistent-quotes
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit-function-declaration',
- 'description': 'Implicit function declaration',
- 'patterns': [r".*: warning: implicit declaration of function .+",
- r".*: warning: implicitly declaring library function"]},
- {'category': 'C/C++', 'severity': Severity.SKIP,
- 'description': 'skip, conflicting types for ...',
- 'patterns': [r".*: warning: conflicting types for '.+'"]},
- {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wtype-limits',
- 'description': 'Expression always evaluates to true or false',
- 'patterns': [r".*: warning: comparison is always .+ due to limited range of data type",
- r".*: warning: comparison of unsigned .*expression .+ is always true",
- r".*: warning: comparison of unsigned .*expression .+ is always false"]},
- {'category': 'C/C++', 'severity': Severity.HIGH,
- 'description': 'Use transient memory for control value',
- 'patterns': [r".*: warning: .+Using such transient memory for the control value is .*dangerous."]},
- {'category': 'C/C++', 'severity': Severity.HIGH,
- 'description': 'Return address of stack memory',
- 'patterns': [r".*: warning: Address of stack memory .+ returned to caller",
- r".*: warning: Address of stack memory .+ will be a dangling reference"]},
- {'category': 'C/C++', 'severity': Severity.HIGH, 'option': 'infinite-recursion',
- 'description': 'Infinite recursion',
- 'patterns': [r".*: warning: all paths through this function will call itself"]},
- {'category': 'C/C++', 'severity': Severity.HIGH,
- 'description': 'Potential buffer overflow',
- 'patterns': [r".*: warning: Size argument is greater than .+ the destination buffer",
- r".*: warning: Potential buffer overflow.",
- r".*: warning: String copy function overflows destination buffer"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Incompatible pointer types',
- 'patterns': [r".*: warning: assignment from incompatible pointer type",
- r".*: warning: return from incompatible pointer type",
- r".*: warning: passing argument [0-9]+ of '.*' from incompatible pointer type",
- r".*: warning: initialization from incompatible pointer type"]},
- {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-fno-builtin',
- 'description': 'Incompatible declaration of built in function',
- 'patterns': [r".*: warning: incompatible implicit declaration of built-in function .+"]},
- {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wincompatible-library-redeclaration',
- 'description': 'Incompatible redeclaration of library function',
- 'patterns': [r".*: warning: incompatible redeclaration of library function .+"]},
- {'category': 'C/C++', 'severity': Severity.HIGH,
- 'description': 'Null passed as non-null argument',
- 'patterns': [r".*: warning: Null passed to a callee that requires a non-null"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-parameter',
- 'description': 'Unused parameter',
- 'patterns': [r".*: warning: unused parameter '.*'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused',
- 'description': 'Unused function, variable, label, comparison, etc.',
- 'patterns': [r".*: warning: '.+' defined but not used",
- r".*: warning: unused function '.+'",
- r".*: warning: unused label '.+'",
- r".*: warning: relational comparison result unused",
- r".*: warning: lambda capture .* is not used",
- r".*: warning: private field '.+' is not used",
- r".*: warning: unused variable '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-value',
- 'description': 'Statement with no effect or result unused',
- 'patterns': [r".*: warning: statement with no effect",
- r".*: warning: expression result unused"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused-result',
- 'description': 'Ignoreing return value of function',
- 'patterns': [r".*: warning: ignoring return value of function .+Wunused-result"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-field-initializers',
- 'description': 'Missing initializer',
- 'patterns': [r".*: warning: missing initializer"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wdelete-non-virtual-dtor',
- 'description': 'Need virtual destructor',
- 'patterns': [r".*: warning: delete called .* has virtual functions but non-virtual destructor"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, near initialization for ...',
- 'patterns': [r".*: warning: \(near initialization for '.+'\)"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wdate-time',
- 'description': 'Expansion of data or time macro',
- 'patterns': [r".*: warning: expansion of date or time macro is not reproducible"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wexpansion-to-defined',
- 'description': 'Macro expansion has undefined behavior',
- 'patterns': [r".*: warning: macro expansion .* has undefined behavior"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat',
- 'description': 'Format string does not match arguments',
- 'patterns': [r".*: warning: format '.+' expects type '.+', but argument [0-9]+ has type '.+'",
- r".*: warning: more '%' conversions than data arguments",
- r".*: warning: data argument not used by format string",
- r".*: warning: incomplete format specifier",
- r".*: warning: unknown conversion type .* in format",
- r".*: warning: format .+ expects .+ but argument .+Wformat=",
- r".*: warning: field precision should have .+ but argument has .+Wformat",
- r".*: warning: format specifies type .+ but the argument has .*type .+Wformat"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat-extra-args',
- 'description': 'Too many arguments for format string',
- 'patterns': [r".*: warning: too many arguments for format"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Too many arguments in call',
- 'patterns': [r".*: warning: too many arguments in call to "]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wformat-invalid-specifier',
- 'description': 'Invalid format specifier',
- 'patterns': [r".*: warning: invalid .+ specifier '.+'.+format-invalid-specifier"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-compare',
- 'description': 'Comparison between signed and unsigned',
- 'patterns': [r".*: warning: comparison between signed and unsigned",
- r".*: warning: comparison of promoted \~unsigned with unsigned",
- r".*: warning: signed and unsigned type in conditional expression"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Comparison between enum and non-enum',
- 'patterns': [r".*: warning: enumeral and non-enumeral type in conditional expression"]},
- {'category': 'libpng', 'severity': Severity.MEDIUM,
- 'description': 'libpng: zero area',
- 'patterns': [r".*libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area"]},
- {'category': 'aapt', 'severity': Severity.MEDIUM,
- 'description': 'aapt: no comment for public symbol',
- 'patterns': [r".*: warning: No comment for public symbol .+"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-braces',
- 'description': 'Missing braces around initializer',
- 'patterns': [r".*: warning: missing braces around initializer.*"]},
- {'category': 'C/C++', 'severity': Severity.HARMLESS,
- 'description': 'No newline at end of file',
- 'patterns': [r".*: warning: no newline at end of file"]},
- {'category': 'C/C++', 'severity': Severity.HARMLESS,
- 'description': 'Missing space after macro name',
- 'patterns': [r".*: warning: missing whitespace after the macro name"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcast-align',
- 'description': 'Cast increases required alignment',
- 'patterns': [r".*: warning: cast from .* to .* increases required alignment .*"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wcast-qual',
- 'description': 'Qualifier discarded',
- 'patterns': [r".*: warning: passing argument [0-9]+ of '.+' discards qualifiers from pointer target type",
- r".*: warning: assignment discards qualifiers from pointer target type",
- r".*: warning: passing .+ to parameter of type .+ discards qualifiers",
- r".*: warning: assigning to .+ from .+ discards qualifiers",
- r".*: warning: initializing .+ discards qualifiers .+types-discards-qualifiers",
- r".*: warning: return discards qualifiers from pointer target type"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunknown-attributes',
- 'description': 'Unknown attribute',
- 'patterns': [r".*: warning: unknown attribute '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wignored-attributes',
- 'description': 'Attribute ignored',
- 'patterns': [r".*: warning: '_*packed_*' attribute ignored",
- r".*: warning: attribute declaration must precede definition .+ignored-attributes"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wvisibility',
- 'description': 'Visibility problem',
- 'patterns': [r".*: warning: declaration of '.+' will not be visible outside of this function"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wattributes',
- 'description': 'Visibility mismatch',
- 'patterns': [r".*: warning: '.+' declared with greater visibility than the type of its field '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Shift count greater than width of type',
- 'patterns': [r".*: warning: (left|right) shift count >= width of type"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wextern-initializer',
- 'description': 'extern <foo> is initialized',
- 'patterns': [r".*: warning: '.+' initialized and declared 'extern'",
- r".*: warning: 'extern' variable has an initializer"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wold-style-declaration',
- 'description': 'Old style declaration',
- 'patterns': [r".*: warning: 'static' is not at beginning of declaration"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wreturn-type',
- 'description': 'Missing return value',
- 'patterns': [r".*: warning: control reaches end of non-void function"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit-int',
- 'description': 'Implicit int type',
- 'patterns': [r".*: warning: type specifier missing, defaults to 'int'",
- r".*: warning: type defaults to 'int' in declaration of '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmain-return-type',
- 'description': 'Main function should return int',
- 'patterns': [r".*: warning: return type of 'main' is not 'int'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wuninitialized',
- 'description': 'Variable may be used uninitialized',
- 'patterns': [r".*: warning: '.+' may be used uninitialized in this function"]},
- {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wuninitialized',
- 'description': 'Variable is used uninitialized',
- 'patterns': [r".*: warning: '.+' is used uninitialized in this function",
- r".*: warning: variable '.+' is uninitialized when used here"]},
- {'category': 'ld', 'severity': Severity.MEDIUM, 'option': '-fshort-enums',
- 'description': 'ld: possible enum size mismatch',
- 'patterns': [r".*: warning: .* uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-sign',
- 'description': 'Pointer targets differ in signedness',
- 'patterns': [r".*: warning: pointer targets in initialization differ in signedness",
- r".*: warning: pointer targets in assignment differ in signedness",
- r".*: warning: pointer targets in return differ in signedness",
- r".*: warning: pointer targets in passing argument [0-9]+ of '.+' differ in signedness"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-overflow',
- 'description': 'Assuming overflow does not occur',
- 'patterns': [r".*: warning: assuming signed overflow does not occur when assuming that .* is always (true|false)"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wempty-body',
- 'description': 'Suggest adding braces around empty body',
- 'patterns': [r".*: warning: suggest braces around empty body in an 'if' statement",
- r".*: warning: empty body in an if-statement",
- r".*: warning: suggest braces around empty body in an 'else' statement",
- r".*: warning: empty body in an else-statement"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wparentheses',
- 'description': 'Suggest adding parentheses',
- 'patterns': [r".*: warning: suggest explicit braces to avoid ambiguous 'else'",
- r".*: warning: suggest parentheses around arithmetic in operand of '.+'",
- r".*: warning: suggest parentheses around comparison in operand of '.+'",
- r".*: warning: logical not is only applied to the left hand side of this comparison",
- r".*: warning: using the result of an assignment as a condition without parentheses",
- r".*: warning: .+ has lower precedence than .+ be evaluated first .+Wparentheses",
- r".*: warning: suggest parentheses around '.+?' .+ '.+?'",
- r".*: warning: suggest parentheses around assignment used as truth value"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Static variable used in non-static inline function',
- 'patterns': [r".*: warning: '.+' is static but used in inline function '.+' which is not static"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit int',
- 'description': 'No type or storage class (will default to int)',
- 'patterns': [r".*: warning: data definition has no type or storage class"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, parameter name (without types) in function declaration',
- 'patterns': [r".*: warning: parameter names \(without types\) in function declaration"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-aliasing',
- 'description': 'Dereferencing <foo> breaks strict aliasing rules',
- 'patterns': [r".*: warning: dereferencing .* break strict-aliasing rules"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-to-int-cast',
- 'description': 'Cast from pointer to integer of different size',
- 'patterns': [r".*: warning: cast from pointer to integer of different size",
- r".*: warning: initialization makes pointer from integer without a cast"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wint-to-pointer-cast',
- 'description': 'Cast to pointer from integer of different size',
- 'patterns': [r".*: warning: cast to pointer from integer of different size"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Macro redefined',
- 'patterns': [r".*: warning: '.+' macro redefined"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, ... location of the previous definition',
- 'patterns': [r".*: warning: this is the location of the previous definition"]},
- {'category': 'ld', 'severity': Severity.MEDIUM,
- 'description': 'ld: type and size of dynamic symbol are not defined',
- 'patterns': [r".*: warning: type and size of dynamic symbol `.+' are not defined"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Pointer from integer without cast',
- 'patterns': [r".*: warning: assignment makes pointer from integer without a cast"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Pointer from integer without cast',
- 'patterns': [r".*: warning: passing argument [0-9]+ of '.+' makes pointer from integer without a cast"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Integer from pointer without cast',
- 'patterns': [r".*: warning: assignment makes integer from pointer without a cast"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Integer from pointer without cast',
- 'patterns': [r".*: warning: passing argument [0-9]+ of '.+' makes integer from pointer without a cast"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Integer from pointer without cast',
- 'patterns': [r".*: warning: return makes integer from pointer without a cast"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunknown-pragmas',
- 'description': 'Ignoring pragma',
- 'patterns': [r".*: warning: ignoring #pragma .+"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-W#pragma-messages',
- 'description': 'Pragma warning messages',
- 'patterns': [r".*: warning: .+W#pragma-messages"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wclobbered',
- 'description': 'Variable might be clobbered by longjmp or vfork',
- 'patterns': [r".*: warning: variable '.+' might be clobbered by 'longjmp' or 'vfork'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wclobbered',
- 'description': 'Argument might be clobbered by longjmp or vfork',
- 'patterns': [r".*: warning: argument '.+' might be clobbered by 'longjmp' or 'vfork'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wredundant-decls',
- 'description': 'Redundant declaration',
- 'patterns': [r".*: warning: redundant redeclaration of '.+'"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, previous declaration ... was here',
- 'patterns': [r".*: warning: previous declaration of '.+' was here"]},
- {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wswitch-enum',
- 'description': 'Enum value not handled in switch',
- 'patterns': [r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wuser-defined-warnings',
- 'description': 'User defined warnings',
- 'patterns': [r".*: warning: .* \[-Wuser-defined-warnings\]$"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Taking address of temporary',
- 'patterns': [r".*: warning: taking address of temporary"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Taking address of packed member',
- 'patterns': [r".*: warning: taking address of packed member"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Possible broken line continuation',
- 'patterns': [r".*: warning: backslash and newline separated by space"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wundefined-var-template',
- 'description': 'Undefined variable template',
- 'patterns': [r".*: warning: instantiation of variable .* no definition is available"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wundefined-inline',
- 'description': 'Inline function is not defined',
- 'patterns': [r".*: warning: inline function '.*' is not defined"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Excess elements in initializer',
- 'patterns': [r".*: warning: excess elements in .+ initializer"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Decimal constant is unsigned only in ISO C90',
- 'patterns': [r".*: warning: this decimal constant is unsigned only in ISO C90"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmain',
- 'description': 'main is usually a function',
- 'patterns': [r".*: warning: 'main' is usually a function"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Typedef ignored',
- 'patterns': [r".*: warning: 'typedef' was ignored in this declaration"]},
- {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Waddress',
- 'description': 'Address always evaluates to true',
- 'patterns': [r".*: warning: the address of '.+' will always evaluate as 'true'"]},
- {'category': 'C/C++', 'severity': Severity.FIXMENOW,
- 'description': 'Freeing a non-heap object',
- 'patterns': [r".*: warning: attempt to free a non-heap object '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wchar-subscripts',
- 'description': 'Array subscript has type char',
- 'patterns': [r".*: warning: array subscript .+ type 'char'.+Wchar-subscripts"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Constant too large for type',
- 'patterns': [r".*: warning: integer constant is too large for '.+' type"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Woverflow',
- 'description': 'Constant too large for type, truncated',
- 'patterns': [r".*: warning: large integer implicitly truncated to unsigned type"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Winteger-overflow',
- 'description': 'Overflow in expression',
- 'patterns': [r".*: warning: overflow in expression; .*Winteger-overflow"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Woverflow',
- 'description': 'Overflow in implicit constant conversion',
- 'patterns': [r".*: warning: overflow in implicit constant conversion"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Declaration does not declare anything',
- 'patterns': [r".*: warning: declaration 'class .+' does not declare anything"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wreorder',
- 'description': 'Initialization order will be different',
- 'patterns': [r".*: warning: '.+' will be initialized after",
- r".*: warning: field .+ will be initialized after .+Wreorder"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, ....',
- 'patterns': [r".*: warning: '.+'"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, base ...',
- 'patterns': [r".*: warning: base '.+'"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, when initialized here',
- 'patterns': [r".*: warning: when initialized here"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-parameter-type',
- 'description': 'Parameter type not specified',
- 'patterns': [r".*: warning: type of '.+' defaults to 'int'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-declarations',
- 'description': 'Missing declarations',
- 'patterns': [r".*: warning: declaration does not declare anything"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wmissing-noreturn',
- 'description': 'Missing noreturn',
- 'patterns': [r".*: warning: function '.*' could be declared with attribute 'noreturn'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'User warning',
- 'patterns': [r".*: warning: #warning "".+"""]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wvexing-parse',
- 'description': 'Vexing parsing problem',
- 'patterns': [r".*: warning: empty parentheses interpreted as a function declaration"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wextra',
- 'description': 'Dereferencing void*',
- 'patterns': [r".*: warning: dereferencing 'void \*' pointer"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Comparison of pointer and integer',
- 'patterns': [r".*: warning: ordered comparison of pointer with integer zero",
- r".*: warning: .*comparison between pointer and integer"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Use of error-prone unary operator',
- 'patterns': [r".*: warning: use of unary operator that may be intended as compound assignment"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wwrite-strings',
- 'description': 'Conversion of string constant to non-const char*',
- 'patterns': [r".*: warning: deprecated conversion from string constant to '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wstrict-prototypes',
- 'description': 'Function declaration isn''t a prototype',
- 'patterns': [r".*: warning: function declaration isn't a prototype"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wignored-qualifiers',
- 'description': 'Type qualifiers ignored on function return value',
- 'patterns': [r".*: warning: type qualifiers ignored on function return type",
- r".*: warning: .+ type qualifier .+ has no effect .+Wignored-qualifiers"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': '<foo> declared inside parameter list, scope limited to this definition',
- 'patterns': [r".*: warning: '.+' declared inside parameter list"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, its scope is only this ...',
- 'patterns': [r".*: warning: its scope is only this definition or declaration, which is probably not what you want"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcomment',
- 'description': 'Line continuation inside comment',
- 'patterns': [r".*: warning: multi-line comment"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wcomment',
- 'description': 'Comment inside comment',
- 'patterns': [r".*: warning: '.+' within block comment .*-Wcomment"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wdeprecated-declarations',
- 'description': 'Deprecated declarations',
- 'patterns': [r".*: warning: .+ is deprecated.+deprecated-declarations"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wdeprecated-register',
- 'description': 'Deprecated register',
- 'patterns': [r".*: warning: 'register' storage class specifier is deprecated"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wpointer-sign',
- 'description': 'Converts between pointers to integer types with different sign',
- 'patterns': [r".*: warning: .+ converts between pointers to integer types with different sign"]},
- {'category': 'C/C++', 'severity': Severity.HARMLESS,
- 'description': 'Extra tokens after #endif',
- 'patterns': [r".*: warning: extra tokens at end of #endif directive"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wenum-compare',
- 'description': 'Comparison between different enums',
- 'patterns': [r".*: warning: comparison between '.+' and '.+'.+Wenum-compare",
- r".*: warning: comparison of .* enumeration types .*-Wenum-compare-switch"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wconversion',
- 'description': 'Conversion may change value',
- 'patterns': [r".*: warning: converting negative value '.+' to '.+'",
- r".*: warning: conversion to '.+' .+ may (alter|change)"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wconversion-null',
- 'description': 'Converting to non-pointer type from NULL',
- 'patterns': [r".*: warning: converting to non-pointer type '.+' from NULL"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-conversion',
- 'description': 'Implicit sign conversion',
- 'patterns': [r".*: warning: implicit conversion changes signedness"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnull-conversion',
- 'description': 'Converting NULL to non-pointer type',
- 'patterns': [r".*: warning: implicit conversion of NULL constant to '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnon-literal-null-conversion',
- 'description': 'Zero used as null pointer',
- 'patterns': [r".*: warning: expression .* zero treated as a null pointer constant"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Implicit conversion changes value or loses precision',
- 'patterns': [r".*: warning: implicit conversion .* changes value from .* to .*-conversion",
- r".*: warning: implicit conversion loses integer precision:"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Passing NULL as non-pointer argument',
- 'patterns': [r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wctor-dtor-privacy',
- 'description': 'Class seems unusable because of private ctor/dtor',
- 'patterns': [r".*: warning: all member functions in class '.+' are private"]},
+ medium('Implicit function declaration',
+ [r".*: warning: implicit declaration of function .+",
+ r".*: warning: implicitly declaring library function"]),
+ skip('skip, conflicting types for ...',
+ [r".*: warning: conflicting types for '.+'"]),
+ high('Expression always evaluates to true or false',
+ [r".*: warning: comparison is always .+ due to limited range of data type",
+ r".*: warning: comparison of unsigned .*expression .+ is always true",
+ r".*: warning: comparison of unsigned .*expression .+ is always false"]),
+ high('Use transient memory for control value',
+ [r".*: warning: .+Using such transient memory for the control value is .*dangerous."]),
+ high('Return address of stack memory',
+ [r".*: warning: Address of stack memory .+ returned to caller",
+ r".*: warning: Address of stack memory .+ will be a dangling reference"]),
+ high('Infinite recursion',
+ [r".*: warning: all paths through this function will call itself"]),
+ high('Potential buffer overflow',
+ [r".*: warning: Size argument is greater than .+ the destination buffer",
+ r".*: warning: Potential buffer overflow.",
+ r".*: warning: String copy function overflows destination buffer"]),
+ medium('Incompatible pointer types',
+ [r".*: warning: assignment from incompatible pointer type",
+ r".*: warning: return from incompatible pointer type",
+ r".*: warning: passing argument [0-9]+ of '.*' from incompatible pointer type",
+ r".*: warning: initialization from incompatible pointer type"]),
+ high('Incompatible declaration of built in function',
+ [r".*: warning: incompatible implicit declaration of built-in function .+"]),
+ high('Incompatible redeclaration of library function',
+ [r".*: warning: incompatible redeclaration of library function .+"]),
+ high('Null passed as non-null argument',
+ [r".*: warning: Null passed to a callee that requires a non-null"]),
+ medium('Unused parameter',
+ [r".*: warning: unused parameter '.*'"]),
+ medium('Unused function, variable, label, comparison, etc.',
+ [r".*: warning: '.+' defined but not used",
+ r".*: warning: unused function '.+'",
+ r".*: warning: unused label '.+'",
+ r".*: warning: relational comparison result unused",
+ r".*: warning: lambda capture .* is not used",
+ r".*: warning: private field '.+' is not used",
+ r".*: warning: unused variable '.+'"]),
+ medium('Statement with no effect or result unused',
+ [r".*: warning: statement with no effect",
+ r".*: warning: expression result unused"]),
+ medium('Ignoreing return value of function',
+ [r".*: warning: ignoring return value of function .+Wunused-result"]),
+ medium('Missing initializer',
+ [r".*: warning: missing initializer"]),
+ medium('Need virtual destructor',
+ [r".*: warning: delete called .* has virtual functions but non-virtual destructor"]),
+ skip('skip, near initialization for ...',
+ [r".*: warning: \(near initialization for '.+'\)"]),
+ medium('Expansion of data or time macro',
+ [r".*: warning: expansion of date or time macro is not reproducible"]),
+ medium('Macro expansion has undefined behavior',
+ [r".*: warning: macro expansion .* has undefined behavior"]),
+ medium('Format string does not match arguments',
+ [r".*: warning: format '.+' expects type '.+', but argument [0-9]+ has type '.+'",
+ r".*: warning: more '%' conversions than data arguments",
+ r".*: warning: data argument not used by format string",
+ r".*: warning: incomplete format specifier",
+ r".*: warning: unknown conversion type .* in format",
+ r".*: warning: format .+ expects .+ but argument .+Wformat=",
+ r".*: warning: field precision should have .+ but argument has .+Wformat",
+ r".*: warning: format specifies type .+ but the argument has .*type .+Wformat"]),
+ medium('Too many arguments for format string',
+ [r".*: warning: too many arguments for format"]),
+ medium('Too many arguments in call',
+ [r".*: warning: too many arguments in call to "]),
+ medium('Invalid format specifier',
+ [r".*: warning: invalid .+ specifier '.+'.+format-invalid-specifier"]),
+ medium('Comparison between signed and unsigned',
+ [r".*: warning: comparison between signed and unsigned",
+ r".*: warning: comparison of promoted \~unsigned with unsigned",
+ r".*: warning: signed and unsigned type in conditional expression"]),
+ medium('Comparison between enum and non-enum',
+ [r".*: warning: enumeral and non-enumeral type in conditional expression"]),
+ medium('libpng: zero area',
+ [r".*libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area"]),
+ medium('Missing braces around initializer',
+ [r".*: warning: missing braces around initializer.*"]),
+ harmless('No newline at end of file',
+ [r".*: warning: no newline at end of file"]),
+ harmless('Missing space after macro name',
+ [r".*: warning: missing whitespace after the macro name"]),
+ low('Cast increases required alignment',
+ [r".*: warning: cast from .* to .* increases required alignment .*"]),
+ medium('Qualifier discarded',
+ [r".*: warning: passing argument [0-9]+ of '.+' discards qualifiers from pointer target type",
+ r".*: warning: assignment discards qualifiers from pointer target type",
+ r".*: warning: passing .+ to parameter of type .+ discards qualifiers",
+ r".*: warning: assigning to .+ from .+ discards qualifiers",
+ r".*: warning: initializing .+ discards qualifiers .+types-discards-qualifiers",
+ r".*: warning: return discards qualifiers from pointer target type"]),
+ medium('Unknown attribute',
+ [r".*: warning: unknown attribute '.+'"]),
+ medium('Attribute ignored',
+ [r".*: warning: '_*packed_*' attribute ignored",
+ r".*: warning: attribute declaration must precede definition .+ignored-attributes"]),
+ medium('Visibility problem',
+ [r".*: warning: declaration of '.+' will not be visible outside of this function"]),
+ medium('Visibility mismatch',
+ [r".*: warning: '.+' declared with greater visibility than the type of its field '.+'"]),
+ medium('Shift count greater than width of type',
+ [r".*: warning: (left|right) shift count >= width of type"]),
+ medium('extern <foo> is initialized',
+ [r".*: warning: '.+' initialized and declared 'extern'",
+ r".*: warning: 'extern' variable has an initializer"]),
+ medium('Old style declaration',
+ [r".*: warning: 'static' is not at beginning of declaration"]),
+ medium('Missing return value',
+ [r".*: warning: control reaches end of non-void function"]),
+ medium('Implicit int type',
+ [r".*: warning: type specifier missing, defaults to 'int'",
+ r".*: warning: type defaults to 'int' in declaration of '.+'"]),
+ medium('Main function should return int',
+ [r".*: warning: return type of 'main' is not 'int'"]),
+ medium('Variable may be used uninitialized',
+ [r".*: warning: '.+' may be used uninitialized in this function"]),
+ high('Variable is used uninitialized',
+ [r".*: warning: '.+' is used uninitialized in this function",
+ r".*: warning: variable '.+' is uninitialized when used here"]),
+ medium('ld: possible enum size mismatch',
+ [r".*: warning: .* uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail"]),
+ medium('Pointer targets differ in signedness',
+ [r".*: warning: pointer targets in initialization differ in signedness",
+ r".*: warning: pointer targets in assignment differ in signedness",
+ r".*: warning: pointer targets in return differ in signedness",
+ r".*: warning: pointer targets in passing argument [0-9]+ of '.+' differ in signedness"]),
+ medium('Assuming overflow does not occur',
+ [r".*: warning: assuming signed overflow does not occur when assuming that .* is always (true|false)"]),
+ medium('Suggest adding braces around empty body',
+ [r".*: warning: suggest braces around empty body in an 'if' statement",
+ r".*: warning: empty body in an if-statement",
+ r".*: warning: suggest braces around empty body in an 'else' statement",
+ r".*: warning: empty body in an else-statement"]),
+ medium('Suggest adding parentheses',
+ [r".*: warning: suggest explicit braces to avoid ambiguous 'else'",
+ r".*: warning: suggest parentheses around arithmetic in operand of '.+'",
+ r".*: warning: suggest parentheses around comparison in operand of '.+'",
+ r".*: warning: logical not is only applied to the left hand side of this comparison",
+ r".*: warning: using the result of an assignment as a condition without parentheses",
+ r".*: warning: .+ has lower precedence than .+ be evaluated first .+Wparentheses",
+ r".*: warning: suggest parentheses around '.+?' .+ '.+?'",
+ r".*: warning: suggest parentheses around assignment used as truth value"]),
+ medium('Static variable used in non-static inline function',
+ [r".*: warning: '.+' is static but used in inline function '.+' which is not static"]),
+ medium('No type or storage class (will default to int)',
+ [r".*: warning: data definition has no type or storage class"]),
+ skip('skip, parameter name (without types) in function declaration',
+ [r".*: warning: parameter names \(without types\) in function declaration"]),
+ medium('Dereferencing <foo> breaks strict aliasing rules',
+ [r".*: warning: dereferencing .* break strict-aliasing rules"]),
+ medium('Cast from pointer to integer of different size',
+ [r".*: warning: cast from pointer to integer of different size",
+ r".*: warning: initialization makes pointer from integer without a cast"]),
+ medium('Cast to pointer from integer of different size',
+ [r".*: warning: cast to pointer from integer of different size"]),
+ medium('Macro redefined',
+ [r".*: warning: '.+' macro redefined"]),
+ skip('skip, ... location of the previous definition',
+ [r".*: warning: this is the location of the previous definition"]),
+ medium('ld: type and size of dynamic symbol are not defined',
+ [r".*: warning: type and size of dynamic symbol `.+' are not defined"]),
+ medium('Pointer from integer without cast',
+ [r".*: warning: assignment makes pointer from integer without a cast"]),
+ medium('Pointer from integer without cast',
+ [r".*: warning: passing argument [0-9]+ of '.+' makes pointer from integer without a cast"]),
+ medium('Integer from pointer without cast',
+ [r".*: warning: assignment makes integer from pointer without a cast"]),
+ medium('Integer from pointer without cast',
+ [r".*: warning: passing argument [0-9]+ of '.+' makes integer from pointer without a cast"]),
+ medium('Integer from pointer without cast',
+ [r".*: warning: return makes integer from pointer without a cast"]),
+ medium('Ignoring pragma',
+ [r".*: warning: ignoring #pragma .+"]),
+ medium('Pragma warning messages',
+ [r".*: warning: .+W#pragma-messages"]),
+ medium('Variable might be clobbered by longjmp or vfork',
+ [r".*: warning: variable '.+' might be clobbered by 'longjmp' or 'vfork'"]),
+ medium('Argument might be clobbered by longjmp or vfork',
+ [r".*: warning: argument '.+' might be clobbered by 'longjmp' or 'vfork'"]),
+ medium('Redundant declaration',
+ [r".*: warning: redundant redeclaration of '.+'"]),
+ skip('skip, previous declaration ... was here',
+ [r".*: warning: previous declaration of '.+' was here"]),
+ high('Enum value not handled in switch',
+ [r".*: warning: .*enumeration value.* not handled in switch.+Wswitch"]),
+ medium('User defined warnings',
+ [r".*: warning: .* \[-Wuser-defined-warnings\]$"]),
+ medium('Taking address of temporary',
+ [r".*: warning: taking address of temporary"]),
+ medium('Taking address of packed member',
+ [r".*: warning: taking address of packed member"]),
+ medium('Possible broken line continuation',
+ [r".*: warning: backslash and newline separated by space"]),
+ medium('Undefined variable template',
+ [r".*: warning: instantiation of variable .* no definition is available"]),
+ medium('Inline function is not defined',
+ [r".*: warning: inline function '.*' is not defined"]),
+ medium('Excess elements in initializer',
+ [r".*: warning: excess elements in .+ initializer"]),
+ medium('Decimal constant is unsigned only in ISO C90',
+ [r".*: warning: this decimal constant is unsigned only in ISO C90"]),
+ medium('main is usually a function',
+ [r".*: warning: 'main' is usually a function"]),
+ medium('Typedef ignored',
+ [r".*: warning: 'typedef' was ignored in this declaration"]),
+ high('Address always evaluates to true',
+ [r".*: warning: the address of '.+' will always evaluate as 'true'"]),
+ fixmenow('Freeing a non-heap object',
+ [r".*: warning: attempt to free a non-heap object '.+'"]),
+ medium('Array subscript has type char',
+ [r".*: warning: array subscript .+ type 'char'.+Wchar-subscripts"]),
+ medium('Constant too large for type',
+ [r".*: warning: integer constant is too large for '.+' type"]),
+ medium('Constant too large for type, truncated',
+ [r".*: warning: large integer implicitly truncated to unsigned type"]),
+ medium('Overflow in expression',
+ [r".*: warning: overflow in expression; .*Winteger-overflow"]),
+ medium('Overflow in implicit constant conversion',
+ [r".*: warning: overflow in implicit constant conversion"]),
+ medium('Declaration does not declare anything',
+ [r".*: warning: declaration 'class .+' does not declare anything"]),
+ medium('Initialization order will be different',
+ [r".*: warning: '.+' will be initialized after",
+ r".*: warning: field .+ will be initialized after .+Wreorder"]),
+ skip('skip, ....',
+ [r".*: warning: '.+'"]),
+ skip('skip, base ...',
+ [r".*: warning: base '.+'"]),
+ skip('skip, when initialized here',
+ [r".*: warning: when initialized here"]),
+ medium('Parameter type not specified',
+ [r".*: warning: type of '.+' defaults to 'int'"]),
+ medium('Missing declarations',
+ [r".*: warning: declaration does not declare anything"]),
+ medium('Missing noreturn',
+ [r".*: warning: function '.*' could be declared with attribute 'noreturn'"]),
+ medium('User warning',
+ [r".*: warning: #warning "".+"""]),
+ medium('Vexing parsing problem',
+ [r".*: warning: empty parentheses interpreted as a function declaration"]),
+ medium('Dereferencing void*',
+ [r".*: warning: dereferencing 'void \*' pointer"]),
+ medium('Comparison of pointer and integer',
+ [r".*: warning: ordered comparison of pointer with integer zero",
+ r".*: warning: .*comparison between pointer and integer"]),
+ medium('Use of error-prone unary operator',
+ [r".*: warning: use of unary operator that may be intended as compound assignment"]),
+ medium('Conversion of string constant to non-const char*',
+ [r".*: warning: deprecated conversion from string constant to '.+'"]),
+ medium('Function declaration isn''t a prototype',
+ [r".*: warning: function declaration isn't a prototype"]),
+ medium('Type qualifiers ignored on function return value',
+ [r".*: warning: type qualifiers ignored on function return type",
+ r".*: warning: .+ type qualifier .+ has no effect .+Wignored-qualifiers"]),
+ medium('<foo> declared inside parameter list, scope limited to this definition',
+ [r".*: warning: '.+' declared inside parameter list"]),
+ skip('skip, its scope is only this ...',
+ [r".*: warning: its scope is only this definition or declaration, which is probably not what you want"]),
+ low('Line continuation inside comment',
+ [r".*: warning: multi-line comment"]),
+ low('Comment inside comment',
+ [r".*: warning: '.+' within block comment .*-Wcomment"]),
+ low('Deprecated declarations',
+ [r".*: warning: .+ is deprecated.+deprecated-declarations"]),
+ low('Deprecated register',
+ [r".*: warning: 'register' storage class specifier is deprecated"]),
+ low('Converts between pointers to integer types with different sign',
+ [r".*: warning: .+ converts between pointers to integer types with different sign"]),
+ harmless('Extra tokens after #endif',
+ [r".*: warning: extra tokens at end of #endif directive"]),
+ medium('Comparison between different enums',
+ [r".*: warning: comparison between '.+' and '.+'.+Wenum-compare",
+ r".*: warning: comparison of .* enumeration types .*-Wenum-compare-switch"]),
+ medium('Conversion may change value',
+ [r".*: warning: converting negative value '.+' to '.+'",
+ r".*: warning: conversion to '.+' .+ may (alter|change)"]),
+ medium('Converting to non-pointer type from NULL',
+ [r".*: warning: converting to non-pointer type '.+' from NULL"]),
+ medium('Implicit sign conversion',
+ [r".*: warning: implicit conversion changes signedness"]),
+ medium('Converting NULL to non-pointer type',
+ [r".*: warning: implicit conversion of NULL constant to '.+'"]),
+ medium('Zero used as null pointer',
+ [r".*: warning: expression .* zero treated as a null pointer constant"]),
+ medium('Compare pointer to null character',
+ [r".*: warning: comparing a pointer to a null character constant"]),
+ medium('Implicit conversion changes value or loses precision',
+ [r".*: warning: implicit conversion .* changes value from .* to .*-conversion",
+ r".*: warning: implicit conversion loses integer precision:"]),
+ medium('Passing NULL as non-pointer argument',
+ [r".*: warning: passing NULL to non-pointer argument [0-9]+ of '.+'"]),
+ medium('Class seems unusable because of private ctor/dtor',
+ [r".*: warning: all member functions in class '.+' are private"]),
# skip this next one, because it only points out some RefBase-based classes
# where having a private destructor is perfectly fine
- {'category': 'C/C++', 'severity': Severity.SKIP, 'option': '-Wctor-dtor-privacy',
- 'description': 'Class seems unusable because of private ctor/dtor',
- 'patterns': [r".*: warning: 'class .+' only defines a private destructor and has no friends"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wctor-dtor-privacy',
- 'description': 'Class seems unusable because of private ctor/dtor',
- 'patterns': [r".*: warning: 'class .+' only defines private constructors and has no friends"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wgnu-static-float-init',
- 'description': 'In-class initializer for static const float/double',
- 'patterns': [r".*: warning: in-class initializer for static data member of .+const (float|double)"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-arith',
- 'description': 'void* used in arithmetic',
- 'patterns': [r".*: warning: pointer of type 'void \*' used in (arithmetic|subtraction)",
- r".*: warning: arithmetic on .+ to void is a GNU extension.*Wpointer-arith",
- r".*: warning: wrong type argument to increment"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsign-promo',
- 'description': 'Overload resolution chose to promote from unsigned or enum to signed type',
- 'patterns': [r".*: warning: passing '.+' chooses '.+' over '.+'.*Wsign-promo"]},
- {'category': 'cont.', 'severity': Severity.SKIP,
- 'description': 'skip, in call to ...',
- 'patterns': [r".*: warning: in call to '.+'"]},
- {'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wextra',
- 'description': 'Base should be explicitly initialized in copy constructor',
- 'patterns': [r".*: warning: base class '.+' should be explicitly initialized in the copy constructor"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Return value from void function',
- 'patterns': [r".*: warning: 'return' with a value, in function returning void"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'multichar',
- 'description': 'Multi-character character constant',
- 'patterns': [r".*: warning: multi-character character constant"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'writable-strings',
- 'description': 'Conversion from string literal to char*',
- 'patterns': [r".*: warning: .+ does not allow conversion from string literal to 'char \*'"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wextra-semi',
- 'description': 'Extra \';\'',
- 'patterns': [r".*: warning: extra ';' .+extra-semi"]},
- {'category': 'C/C++', 'severity': Severity.LOW,
- 'description': 'Useless specifier',
- 'patterns': [r".*: warning: useless storage class specifier in empty declaration"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wduplicate-decl-specifier',
- 'description': 'Duplicate declaration specifier',
- 'patterns': [r".*: warning: duplicate '.+' declaration specifier"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'tautological-compare',
- 'description': 'Comparison of self is always false',
- 'patterns': [r".*: self-comparison always evaluates to false"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'constant-logical-operand',
- 'description': 'Logical op with constant operand',
- 'patterns': [r".*: use of logical '.+' with constant operand"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'literal-suffix',
- 'description': 'Needs a space between literal and string macro',
- 'patterns': [r".*: warning: invalid suffix on literal.+ requires a space .+Wliteral-suffix"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '#warnings',
- 'description': 'Warnings from #warning',
- 'patterns': [r".*: warning: .+-W#warnings"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': 'absolute-value',
- 'description': 'Using float/int absolute value function with int/float argument',
- 'patterns': [r".*: warning: using .+ absolute value function .+ when argument is .+ type .+Wabsolute-value",
- r".*: warning: absolute value function '.+' given .+ which may cause truncation .+Wabsolute-value"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Wc++11-extensions',
- 'description': 'Using C++11 extensions',
- 'patterns': [r".*: warning: 'auto' type specifier is a C\+\+11 extension"]},
- {'category': 'C/C++', 'severity': Severity.LOW,
- 'description': 'Refers to implicitly defined namespace',
- 'patterns': [r".*: warning: using directive refers to implicitly-defined namespace .+"]},
- {'category': 'C/C++', 'severity': Severity.LOW, 'option': '-Winvalid-pp-token',
- 'description': 'Invalid pp token',
- 'patterns': [r".*: warning: missing .+Winvalid-pp-token"]},
- {'category': 'link', 'severity': Severity.LOW,
- 'description': 'need glibc to link',
- 'patterns': [r".*: warning: .* requires at runtime .* glibc .* for linking"]},
-
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Operator new returns NULL',
- 'patterns': [r".*: warning: 'operator new' must not return NULL unless it is declared 'throw\(\)' .+"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnull-arithmetic',
- 'description': 'NULL used in arithmetic',
- 'patterns': [r".*: warning: NULL used in arithmetic",
- r".*: warning: comparison between NULL and non-pointer"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'header-guard',
- 'description': 'Misspelled header guard',
- 'patterns': [r".*: warning: '.+' is used as a header guard .+ followed by .+ different macro"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'empty-body',
- 'description': 'Empty loop body',
- 'patterns': [r".*: warning: .+ loop has empty body"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'enum-conversion',
- 'description': 'Implicit conversion from enumeration type',
- 'patterns': [r".*: warning: implicit conversion from enumeration type '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': 'switch',
- 'description': 'case value not in enumerated type',
- 'patterns': [r".*: warning: case value not in enumerated type '.+'"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Use of deprecated method',
- 'patterns': [r".*: warning: '.+' is deprecated .+"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Use of garbage or uninitialized value',
- 'patterns': [r".*: warning: .+ uninitialized .+\[-Wsometimes-uninitialized\]"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsizeof-array-argument',
- 'description': 'Sizeof on array argument',
- 'patterns': [r".*: warning: sizeof on array function parameter will return"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wsizeof-pointer-memacces',
- 'description': 'Bad argument size of memory access functions',
- 'patterns': [r".*: warning: .+\[-Wsizeof-pointer-memaccess\]"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Return value not checked',
- 'patterns': [r".*: warning: The return value from .+ is not checked"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Possible heap pollution',
- 'patterns': [r".*: warning: .*Possible heap pollution from .+ type .+"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wfor-loop-analysis',
- 'description': 'Variable used in loop condition not modified in loop body',
- 'patterns': [r".*: warning: variable '.+' used in loop condition.*Wfor-loop-analysis"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM,
- 'description': 'Closing a previously closed file',
- 'patterns': [r".*: warning: Closing a previously closed file"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunnamed-type-template-args',
- 'description': 'Unnamed template type argument',
- 'patterns': [r".*: warning: template argument.+Wunnamed-type-template-args"]},
- {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wimplicit-fallthrough',
- 'description': 'Unannotated fall-through between switch labels',
- 'patterns': [r".*: warning: unannotated fall-through between switch labels.+Wimplicit-fallthrough"]},
- {'category': 'C/C++', 'severity': Severity.HARMLESS,
- 'description': 'Discarded qualifier from pointer target type',
- 'patterns': [r".*: warning: .+ discards '.+' qualifier from pointer target type"]},
- {'category': 'C/C++', 'severity': Severity.HARMLESS,
- 'description': 'Use snprintf instead of sprintf',
- 'patterns': [r".*: warning: .*sprintf is often misused; please use snprintf"]},
- {'category': 'C/C++', 'severity': Severity.HARMLESS,
- 'description': 'Unsupported optimizaton flag',
- 'patterns': [r".*: warning: optimization flag '.+' is not supported"]},
- {'category': 'C/C++', 'severity': Severity.HARMLESS,
- 'description': 'Extra or missing parentheses',
- 'patterns': [r".*: warning: equality comparison with extraneous parentheses",
- r".*: warning: .+ within .+Wlogical-op-parentheses"]},
- {'category': 'C/C++', 'severity': Severity.HARMLESS, 'option': 'mismatched-tags',
- 'description': 'Mismatched class vs struct tags',
- 'patterns': [r".*: warning: '.+' defined as a .+ here but previously declared as a .+mismatched-tags",
- r".*: warning: .+ was previously declared as a .+mismatched-tags"]},
+ skip('Class seems unusable because of private ctor/dtor',
+ [r".*: warning: 'class .+' only defines a private destructor and has no friends"]),
+ medium('Class seems unusable because of private ctor/dtor',
+ [r".*: warning: 'class .+' only defines private constructors and has no friends"]),
+ medium('In-class initializer for static const float/double',
+ [r".*: warning: in-class initializer for static data member of .+const (float|double)"]),
+ medium('void* used in arithmetic',
+ [r".*: warning: pointer of type 'void \*' used in (arithmetic|subtraction)",
+ r".*: warning: arithmetic on .+ to void is a GNU extension.*Wpointer-arith",
+ r".*: warning: wrong type argument to increment"]),
+ medium('Overload resolution chose to promote from unsigned or enum to signed type',
+ [r".*: warning: passing '.+' chooses '.+' over '.+'.*Wsign-promo"]),
+ skip('skip, in call to ...',
+ [r".*: warning: in call to '.+'"]),
+ high('Base should be explicitly initialized in copy constructor',
+ [r".*: warning: base class '.+' should be explicitly initialized in the copy constructor"]),
+ medium('Return value from void function',
+ [r".*: warning: 'return' with a value, in function returning void"]),
+ medium('Multi-character character constant',
+ [r".*: warning: multi-character character constant"]),
+ medium('Conversion from string literal to char*',
+ [r".*: warning: .+ does not allow conversion from string literal to 'char \*'"]),
+ low('Extra \';\'',
+ [r".*: warning: extra ';' .+extra-semi"]),
+ low('Useless specifier',
+ [r".*: warning: useless storage class specifier in empty declaration"]),
+ low('Duplicate declaration specifier',
+ [r".*: warning: duplicate '.+' declaration specifier"]),
+ low('Comparison of self is always false',
+ [r".*: self-comparison always evaluates to false"]),
+ low('Logical op with constant operand',
+ [r".*: use of logical '.+' with constant operand"]),
+ low('Needs a space between literal and string macro',
+ [r".*: warning: invalid suffix on literal.+ requires a space .+Wliteral-suffix"]),
+ low('Warnings from #warning',
+ [r".*: warning: .+-W#warnings"]),
+ low('Using float/int absolute value function with int/float argument',
+ [r".*: warning: using .+ absolute value function .+ when argument is .+ type .+Wabsolute-value",
+ r".*: warning: absolute value function '.+' given .+ which may cause truncation .+Wabsolute-value"]),
+ low('Using C++11 extensions',
+ [r".*: warning: 'auto' type specifier is a C\+\+11 extension"]),
+ low('Refers to implicitly defined namespace',
+ [r".*: warning: using directive refers to implicitly-defined namespace .+"]),
+ low('Invalid pp token',
+ [r".*: warning: missing .+Winvalid-pp-token"]),
+ low('need glibc to link',
+ [r".*: warning: .* requires at runtime .* glibc .* for linking"]),
+ medium('Operator new returns NULL',
+ [r".*: warning: 'operator new' must not return NULL unless it is declared 'throw\(\)' .+"]),
+ medium('NULL used in arithmetic',
+ [r".*: warning: NULL used in arithmetic",
+ r".*: warning: comparison between NULL and non-pointer"]),
+ medium('Misspelled header guard',
+ [r".*: warning: '.+' is used as a header guard .+ followed by .+ different macro"]),
+ medium('Empty loop body',
+ [r".*: warning: .+ loop has empty body"]),
+ medium('Implicit conversion from enumeration type',
+ [r".*: warning: implicit conversion from enumeration type '.+'"]),
+ medium('case value not in enumerated type',
+ [r".*: warning: case value not in enumerated type '.+'"]),
+ medium('Use of deprecated method',
+ [r".*: warning: '.+' is deprecated .+"]),
+ medium('Use of garbage or uninitialized value',
+ [r".*: warning: .+ uninitialized .+\[-Wsometimes-uninitialized\]"]),
+ medium('Sizeof on array argument',
+ [r".*: warning: sizeof on array function parameter will return"]),
+ medium('Bad argument size of memory access functions',
+ [r".*: warning: .+\[-Wsizeof-pointer-memaccess\]"]),
+ medium('Return value not checked',
+ [r".*: warning: The return value from .+ is not checked"]),
+ medium('Possible heap pollution',
+ [r".*: warning: .*Possible heap pollution from .+ type .+"]),
+ medium('Variable used in loop condition not modified in loop body',
+ [r".*: warning: variable '.+' used in loop condition.*Wfor-loop-analysis"]),
+ medium('Closing a previously closed file',
+ [r".*: warning: Closing a previously closed file"]),
+ medium('Unnamed template type argument',
+ [r".*: warning: template argument.+Wunnamed-type-template-args"]),
+ medium('Unannotated fall-through between switch labels',
+ [r".*: warning: unannotated fall-through between switch labels.+Wimplicit-fallthrough"]),
+ harmless('Discarded qualifier from pointer target type',
+ [r".*: warning: .+ discards '.+' qualifier from pointer target type"]),
+ harmless('Use snprintf instead of sprintf',
+ [r".*: warning: .*sprintf is often misused; please use snprintf"]),
+ harmless('Unsupported optimizaton flag',
+ [r".*: warning: optimization flag '.+' is not supported"]),
+ harmless('Extra or missing parentheses',
+ [r".*: warning: equality comparison with extraneous parentheses",
+ r".*: warning: .+ within .+Wlogical-op-parentheses"]),
+ harmless('Mismatched class vs struct tags',
+ [r".*: warning: '.+' defined as a .+ here but previously declared as a .+mismatched-tags",
+ r".*: warning: .+ was previously declared as a .+mismatched-tags"]),
]
+
+
+def compile_patterns(patterns):
+ """Precompiling every pattern speeds up parsing by about 30x."""
+ for i in patterns:
+ i['compiled_patterns'] = []
+ for pat in i['patterns']:
+ i['compiled_patterns'].append(re.compile(pat))
+
+
+compile_patterns(warn_patterns)
diff --git a/tools/warn/java_warn_patterns.py b/tools/warn/java_warn_patterns.py
index 696ce9a..3a3a676 100644
--- a/tools/warn/java_warn_patterns.py
+++ b/tools/warn/java_warn_patterns.py
@@ -1,4 +1,4 @@
-#
+# python3
# Copyright (C) 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,7 +15,10 @@
"""Warning patterns for Java compiler tools."""
-from severity import Severity
+# pylint:disable=relative-beyond-top-level
+from .cpp_warn_patterns import compile_patterns
+# pylint:disable=g-importing-member
+from .severity import Severity
def java_warn(severity, description, pattern_list):
@@ -39,11 +42,12 @@
return java_warn(Severity.LOW, description, pattern_list)
-patterns = [
+warn_patterns = [
# pylint:disable=line-too-long,g-inconsistent-quotes
# Warnings from Javac
- java_medium('Use of deprecated member',
- [r'.*: warning: \[deprecation\] .+']),
+ java_medium('Use of deprecated',
+ [r'.*: warning: \[deprecation\] .+',
+ r'.*: warning: \[removal\] .+ has been deprecated and marked for removal$']),
java_medium('Unchecked conversion',
[r'.*: warning: \[unchecked\] .+']),
# Warnings generated by Error Prone
@@ -125,6 +129,8 @@
[r".*: warning: \[UseBinds\] .+"]),
java_low('Wildcard imports, static or otherwise, should not be used',
[r".*: warning: \[WildcardImport\] .+"]),
+ java_medium('AcronymName',
+ [r".*\.java:.*: warning: .+ \[AcronymName\]$"]),
java_medium('Method reference is ambiguous',
[r".*: warning: \[AmbiguousMethodReference\] .+"]),
java_medium('This method passes a pair of parameters through to String.format, but the enclosing method wasn\'t annotated @FormatMethod. Doing so gives compile-time rather than run-time protection against malformed format strings.',
@@ -265,6 +271,8 @@
[r".*: warning: \[InstanceOfAndCastMatchWrongType\] .+"]),
java_medium('Expression of type int may overflow before being assigned to a long',
[r".*: warning: \[IntLongMath\] .+"]),
+ java_medium('IntentBuilderName',
+ [r".*\.java:.*: warning: .+ \[IntentBuilderName\]$"]),
java_medium('This @param tag doesn\'t refer to a parameter of the method.',
[r".*: warning: \[InvalidParam\] .+"]),
java_medium('This tag is invalid.',
@@ -319,6 +327,8 @@
[r".*: warning: \[NonCanonicalStaticMemberImport\] .+"]),
java_medium('equals method doesn\'t override Object.equals',
[r".*: warning: \[NonOverridingEquals\] .+"]),
+ java_medium('Not closeable',
+ [r".*\.java:.*: warning: .+ \[NotCloseable\]$"]),
java_medium('Constructors should not be annotated with @Nullable since they cannot return null',
[r".*: warning: \[NullableConstructor\] .+"]),
java_medium('Dereference of possibly-null value',
@@ -369,6 +379,8 @@
[r".*: warning: \[RequiredModifiers\] .+"]),
java_medium('Void methods should not have a @return tag.',
[r".*: warning: \[ReturnFromVoid\] .+"]),
+ java_medium('SAM-compatible parameters should be last',
+ [r".*\.java:.*: warning: .+ \[SamShouldBeLast\]$"]),
java_medium(u'Prefer the short-circuiting boolean operators \u0026\u0026 and || to \u0026 and |.',
[r".*: warning: \[ShortCircuitBoolean\] .+"]),
java_medium('Writes to static fields should not be guarded by instance locks',
@@ -431,6 +443,10 @@
[r".*: warning: \[UnusedException\] .+"]),
java_medium('Java assert is used in test. For testing purposes Assert.* matchers should be used.',
[r".*: warning: \[UseCorrectAssertInTests\] .+"]),
+ java_medium('UserHandle',
+ [r".*\.java:.*: warning: .+ \[UserHandle\]$"]),
+ java_medium('UserHandleName',
+ [r".*\.java:.*: warning: .+ \[UserHandleName\]$"]),
java_medium('Non-constant variable missing @Var annotation',
[r".*: warning: \[Var\] .+"]),
java_medium('variableName and type with the same name would refer to the static field instead of the class',
@@ -449,6 +465,8 @@
[r".*: warning: \[ArrayFillIncompatibleType\] .+"]),
java_high('hashcode method on array does not hash array contents',
[r".*: warning: \[ArrayHashCode\] .+"]),
+ java_high('ArrayReturn',
+ [r".*\.java:.*: warning: .+ \[ArrayReturn\]$"]),
java_high('Calling toString on an array does not provide useful information',
[r".*: warning: \[ArrayToString\] .+"]),
java_high('Arrays.asList does not autobox primitive arrays, as one might expect.',
@@ -500,7 +518,7 @@
java_high('Thread created but not started',
[r".*: warning: \[DeadThread\] .+"]),
java_high('Deprecated item is not annotated with @Deprecated',
- [r".*: warning: \[DepAnn\] .+"]),
+ [r".*\.java:.*: warning: \[.*\] .+ is not annotated with @Deprecated$"]),
java_high('Division by integer literal zero',
[r".*: warning: \[DivZero\] .+"]),
java_high('This method should not be called.',
@@ -721,4 +739,11 @@
[r".*: warning: \[UnusedCollectionModifiedInPlace\] .+"]),
java_high('`var` should not be used as a type name.',
[r".*: warning: \[VarTypeName\] .+"]),
+ # Other javac tool warnings
+ java_medium('addNdkApiCoverage failed to getPackage',
+ [r".*: warning: addNdkApiCoverage failed to getPackage"]),
+ java_medium('Supported version from annotation processor',
+ [r".*: warning: Supported source version .+ from annotation processor"]),
]
+
+compile_patterns(warn_patterns)
diff --git a/tools/warn/make_warn_patterns.py b/tools/warn/make_warn_patterns.py
index ac3c508..327fce4 100644
--- a/tools/warn/make_warn_patterns.py
+++ b/tools/warn/make_warn_patterns.py
@@ -1,4 +1,4 @@
-#
+# python3
# Copyright (C) 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,9 +15,12 @@
"""Warning patterns for build make tools."""
-from severity import Severity
+# pylint:disable=relative-beyond-top-level
+from .cpp_warn_patterns import compile_patterns
+# pylint:disable=g-importing-member
+from .severity import Severity
-patterns = [
+warn_patterns = [
# pylint:disable=line-too-long,g-inconsistent-quotes
{'category': 'make', 'severity': Severity.MEDIUM,
'description': 'make: overriding commands/ignoring old commands',
@@ -51,3 +54,6 @@
'description': 'make: please convert to soong',
'patterns': [r".*: warning: .* has been deprecated. Please convert to Soong."]},
]
+
+
+compile_patterns(warn_patterns)
diff --git a/tools/warn/other_warn_patterns.py b/tools/warn/other_warn_patterns.py
index 45d14dc..1331bc6 100644
--- a/tools/warn/other_warn_patterns.py
+++ b/tools/warn/other_warn_patterns.py
@@ -1,4 +1,4 @@
-#
+# python3
# Copyright (C) 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,7 +15,10 @@
"""Warning patterns from other tools."""
-from severity import Severity
+# pylint:disable=relative-beyond-top-level
+from .cpp_warn_patterns import compile_patterns
+# pylint:disable=g-importing-member
+from .severity import Severity
def warn(name, severity, description, pattern_list):
@@ -39,9 +42,15 @@
return warn('asm', Severity.MEDIUM, description, pattern_list)
-patterns = [
+def kotlin(description, pattern_list):
+ return warn('Kotlin', Severity.MEDIUM, description, pattern_list)
+
+
+warn_patterns = [
# pylint:disable=line-too-long,g-inconsistent-quotes
# aapt warnings
+ aapt('No comment for public symbol',
+ [r".*: warning: No comment for public symbol .+"]),
aapt('No default translation',
[r".*: warning: string '.+' has no default translation in .*"]),
aapt('Missing default or required localization',
@@ -90,22 +99,22 @@
'patterns': [r".*: warning: .* generate guard with empty availability: obsoleted ="]},
# Protoc warnings
{'category': 'Protoc', 'severity': Severity.MEDIUM,
- 'description': 'Proto: Enum name colision after strip',
+ 'description': 'Proto: Enum name collision after strip',
'patterns': [r".*: warning: Enum .* has the same name .* ignore case and strip"]},
{'category': 'Protoc', 'severity': Severity.MEDIUM,
'description': 'Proto: Import not used',
'patterns': [r".*: warning: Import .*/.*\.proto but not used.$"]},
# Kotlin warnings
- {'category': 'Kotlin', 'severity': Severity.MEDIUM,
- 'description': 'Kotlin: never used parameter or variable',
- 'patterns': [r".*: warning: (parameter|variable) '.*' is never used$"]},
- {'category': 'Kotlin', 'severity': Severity.MEDIUM,
- 'description': 'Kotlin: Deprecated in Java',
- 'patterns': [r".*: warning: '.*' is deprecated. Deprecated in Java"]},
- {'category': 'Kotlin', 'severity': Severity.MEDIUM,
- 'description': 'Kotlin: library has Kotlin runtime',
- 'patterns': [r".*: warning: library has Kotlin runtime bundled into it",
- r".*: warning: some JAR files .* have the Kotlin Runtime library"]},
+ kotlin('never used parameter or variable',
+ [r".*\.kt:.*: warning: (parameter|variable) '.*' is never used$",
+ r".*\.kt:.*: warning: (parameter|variable) '.*' is never used, could be renamed to _$"]),
+ kotlin('unchecked cast',
+ [r".*\.kt:.*: warning: unchecked cast: .* to .*$"]),
+ kotlin('Deprecated in Java',
+ [r".*\.kt:.*: warning: '.*' is deprecated. Deprecated in Java"]),
+ kotlin('library has Kotlin runtime',
+ [r".*: warning: library has Kotlin runtime bundled into it",
+ r".*: warning: some JAR files .* have the Kotlin Runtime library"]),
# Rust warnings
{'category': 'Rust', 'severity': Severity.HIGH,
'description': 'Rust: Does not derive Copy',
@@ -124,7 +133,10 @@
'description': 'skip, In file included from ...',
'patterns': [r".*: warning: In file included from .+,"]},
# catch-all for warnings this script doesn't know about yet
- {'category': 'C/C++', 'severity': Severity.UNKNOWN,
+ {'category': 'C/C++', 'severity': Severity.UNMATCHED,
'description': 'Unclassified/unrecognized warnings',
'patterns': [r".*: warning: .+"]},
]
+
+
+compile_patterns(warn_patterns)
diff --git a/tools/warn/severity.py b/tools/warn/severity.py
index bb23f2c..b1c38e4 100644
--- a/tools/warn/severity.py
+++ b/tools/warn/severity.py
@@ -1,4 +1,4 @@
-#
+# python3
# Copyright (C) 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,35 +13,45 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""Severity levels and attributes."""
+"""Clang_Tidy_Warn Severity class definition.
+
+This file stores definition for class Severity that is used in warn_patterns.
+"""
-class Severity(object):
- """Severity levels and attributes."""
- # numbered by dump order
- FIXMENOW = 0
- HIGH = 1
- MEDIUM = 2
- LOW = 3
- ANALYZER = 4
- TIDY = 5
- HARMLESS = 6
- UNKNOWN = 7
- SKIP = 8
- range = range(SKIP + 1)
- attributes = [
- # pylint:disable=bad-whitespace
- ['fuchsia', 'FixNow', 'Critical warnings, fix me now'],
- ['red', 'High', 'High severity warnings'],
- ['orange', 'Medium', 'Medium severity warnings'],
- ['yellow', 'Low', 'Low severity warnings'],
- ['hotpink', 'Analyzer', 'Clang-Analyzer warnings'],
- ['peachpuff', 'Tidy', 'Clang-Tidy warnings'],
- ['limegreen', 'Harmless', 'Harmless warnings'],
- ['lightblue', 'Unknown', 'Unknown warnings'],
- ['grey', 'Unhandled', 'Unhandled warnings']
+# pylint:disable=old-style-class
+class Severity:
+ """Class of Severity levels where each level is a SeverityInfo."""
+
+ class SeverityInfo:
+
+ def __init__(self, value, color, column_header, header):
+ self.value = value
+ self.color = color
+ self.column_header = column_header
+ self.header = header
+
+ # SEVERITY_UNKNOWN should never occur since every warn_pattern listed has
+ # a specified severity. It exists for protobuf, the other values must
+ # map to non-zero values (since 0 is reserved for a default UNKNOWN), but
+ # logic in clang_tidy_warn.py assumes severity level values are consecutive
+ # ints starting with 0.
+ SEVERITY_UNKNOWN = SeverityInfo(0, 'blueviolet', 'Errors of unknown severity',
+ 'Unknown severity (should not occur)')
+ FIXMENOW = SeverityInfo(1, 'fuschia', 'FixNow',
+ 'Critical warnings, fix me now')
+ HIGH = SeverityInfo(2, 'red', 'High', 'High severity warnings')
+ MEDIUM = SeverityInfo(3, 'orange', 'Medium', 'Medium severity warnings')
+ LOW = SeverityInfo(4, 'yellow', 'Low', 'Low severity warnings')
+ ANALYZER = SeverityInfo(5, 'hotpink', 'Analyzer', 'Clang-Analyzer warnings')
+ TIDY = SeverityInfo(6, 'peachpuff', 'Tidy', 'Clang-Tidy warnings')
+ HARMLESS = SeverityInfo(7, 'limegreen', 'Harmless', 'Harmless warnings')
+ UNMATCHED = SeverityInfo(8, 'lightblue', 'Unmatched', 'Unmatched warnings')
+ SKIP = SeverityInfo(9, 'grey', 'Unhandled', 'Unhandled warnings')
+
+ levels = [
+ SEVERITY_UNKNOWN, FIXMENOW, HIGH, MEDIUM, LOW, ANALYZER, TIDY, HARMLESS,
+ UNMATCHED, SKIP
]
- colors = [a[0] for a in attributes]
- column_headers = [a[1] for a in attributes]
- headers = [a[2] for a in attributes]
-
+ # HTML relies on ordering by value. Sort here to ensure that this is proper
+ levels = sorted(levels, key=lambda severity: severity.value)
diff --git a/tools/warn/tidy_warn_patterns.py b/tools/warn/tidy_warn_patterns.py
index a26b388..2c5ab79 100644
--- a/tools/warn/tidy_warn_patterns.py
+++ b/tools/warn/tidy_warn_patterns.py
@@ -1,4 +1,4 @@
-#
+# python3
# Copyright (C) 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,7 +15,10 @@
"""Warning patterns for clang-tidy."""
-from severity import Severity
+# pylint:disable=relative-beyond-top-level
+from .cpp_warn_patterns import compile_patterns
+# pylint:disable=g-importing-member
+from .severity import Severity
def tidy_warn_pattern(description, pattern):
@@ -35,13 +38,13 @@
return tidy_warn_pattern(description, description + r'-.+')
-def analyzer_high(description, pattern_list):
+def analyzer_high(description, patterns):
# Important clang analyzer warnings to be fixed ASAP.
return {
'category': 'C/C++',
'severity': Severity.HIGH,
'description': description,
- 'patterns': pattern_list
+ 'patterns': patterns
}
@@ -53,12 +56,12 @@
return analyzer_high(check, [r'.*: .+\[' + check + r'.+\]$'])
-def analyzer_warn(description, pattern_list):
+def analyzer_warn(description, patterns):
return {
'category': 'C/C++',
'severity': Severity.ANALYZER,
'description': description,
- 'patterns': pattern_list
+ 'patterns': patterns
}
@@ -70,7 +73,7 @@
return analyzer_warn(check, [r'.*: .+\[' + check + r'.+\]$'])
-patterns = [
+warn_patterns = [
# pylint:disable=line-too-long,g-inconsistent-quotes
group_tidy_warn_pattern('android'),
simple_tidy_warn_pattern('abseil-string-find-startswith'),
@@ -136,6 +139,13 @@
simple_tidy_warn_pattern('portability-simd-intrinsics'),
group_tidy_warn_pattern('performance'),
group_tidy_warn_pattern('readability'),
+ simple_tidy_warn_pattern('abseil-string-find-startwith'),
+ simple_tidy_warn_pattern('abseil-faster-strsplit-delimiter'),
+ simple_tidy_warn_pattern('abseil-no-namespace'),
+ simple_tidy_warn_pattern('abseil-no-internal-dependencies'),
+ group_tidy_warn_pattern('abseil'),
+ simple_tidy_warn_pattern('portability-simd-intrinsics'),
+ group_tidy_warn_pattern('portability'),
# warnings from clang-tidy's clang-analyzer checks
analyzer_high('clang-analyzer-core, null pointer',
@@ -189,5 +199,8 @@
analyzer_high_check('clang-analyzer-cplusplus.NewDeleteLeaks'),
analyzer_high_check('clang-analyzer-cplusplus.NewDelete'),
analyzer_group_check('clang-analyzer-unix'),
- analyzer_group_check('clang-analyzer'), # catch al
+ analyzer_group_check('clang-analyzer'), # catch all
]
+
+
+compile_patterns(warn_patterns)
diff --git a/tools/warn/warn.py b/tools/warn/warn.py
index 252f073..bdfd489 100755
--- a/tools/warn/warn.py
+++ b/tools/warn/warn.py
@@ -19,6 +19,7 @@
import multiprocessing
# pylint:disable=relative-beyond-top-level
+# pylint:disable=g-importing-member
from .warn_common import common_main
diff --git a/tools/warn/warn_common.py b/tools/warn/warn_common.py
index de4b805..b885ad2 100755
--- a/tools/warn/warn_common.py
+++ b/tools/warn/warn_common.py
@@ -1,4 +1,4 @@
-#
+# python3
# Copyright (C) 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,18 +24,13 @@
#
# To parse and keep warning message in the input file:
# severity: classification of message severity
-# severity.range [0, 1, ... last_severity_level]
-# severity.colors for header background
-# severity.column_headers for the warning count table
-# severity.headers for warning message tables
# warn_patterns:
# warn_patterns[w]['category'] tool that issued the warning, not used now
# warn_patterns[w]['description'] table heading
# warn_patterns[w]['members'] matched warnings from input
-# warn_patterns[w]['option'] compiler flag to control the warning
# warn_patterns[w]['patterns'] regular expressions to match warnings
# warn_patterns[w]['projects'][p] number of warnings of pattern w in p
-# warn_patterns[w]['severity'] severity level
+# warn_patterns[w]['severity'] severity tuple
# project_list[p][0] project name
# project_list[p][1] regular expression to match a project path
# project_patterns[p] re.compile(project_list[p][1])
@@ -48,7 +43,7 @@
# platform_version
# target_product
# target_variant
-# compile_patterns, parse_input_file
+# parse_input_file
#
# To emit html page of warning messages:
# flags: --byproject, --url, --separator
@@ -68,13 +63,12 @@
# Some data are copied from Python to JavaScript, to generate HTML elements.
# FlagURL args.url
# FlagSeparator args.separator
-# SeverityColors: severity.colors
-# SeverityHeaders: severity.headers
-# SeverityColumnHeaders: severity.column_headers
+# SeverityColors: list of colors for all severity levels
+# SeverityHeaders: list of headers for all severity levels
+# SeverityColumnHeaders: list of column_headers for all severity levels
# ProjectNames: project_names, or project_list[*][0]
# WarnPatternsSeverity: warn_patterns[*]['severity']
# WarnPatternsDescription: warn_patterns[*]['description']
-# WarnPatternsOption: warn_patterns[*]['option']
# WarningMessages: warning_messages
# Warnings: warning_records
# StatsHeader: warning count table header row
@@ -103,6 +97,7 @@
from . import make_warn_patterns
from . import other_warn_patterns
from . import tidy_warn_patterns
+# pylint:disable=g-importing-member
from .android_project_list import project_list
from .severity import Severity
@@ -132,11 +127,11 @@
help='Path to build.log file')
args = parser.parse_args()
-warn_patterns = make_warn_patterns.patterns
-warn_patterns.extend(cpp_warn_patterns.patterns)
-warn_patterns.extend(java_warn_patterns.patterns)
-warn_patterns.extend(tidy_warn_patterns.patterns)
-warn_patterns.extend(other_warn_patterns.patterns)
+warn_patterns = make_warn_patterns.warn_patterns
+warn_patterns.extend(cpp_warn_patterns.warn_patterns)
+warn_patterns.extend(java_warn_patterns.warn_patterns)
+warn_patterns.extend(tidy_warn_patterns.warn_patterns)
+warn_patterns.extend(other_warn_patterns.warn_patterns)
project_patterns = []
project_names = []
@@ -151,8 +146,6 @@
project_patterns = [re.compile(p[1]) for p in project_list]
for w in warn_patterns:
w['members'] = []
- if 'option' not in w:
- w['option'] = ''
# Each warning pattern has a 'projects' dictionary, that
# maps a project name to number of warnings in that project.
w['projects'] = {}
@@ -233,27 +226,33 @@
"""Dump a google chart table of warnings per project and severity."""
# warnings[p][s] is number of warnings in project p of severity s.
# pylint:disable=g-complex-comprehension
- warnings = {p: {s: 0 for s in Severity.range} for p in project_names}
+ warnings = {p: {s.value: 0 for s in Severity.levels} for p in project_names}
for i in warn_patterns:
- s = i['severity']
+ # pytype: disable=attribute-error
+ s = i['severity'].value
+ # pytype: enable=attribute-error
for p in i['projects']:
warnings[p][s] += i['projects'][p]
# total_by_project[p] is number of warnings in project p.
- total_by_project = {p: sum(warnings[p][s] for s in Severity.range)
- for p in project_names}
+ total_by_project = {
+ p: sum(warnings[p][s.value] for s in Severity.levels)
+ for p in project_names
+ }
# total_by_severity[s] is number of warnings of severity s.
- total_by_severity = {s: sum(warnings[p][s] for p in project_names)
- for s in Severity.range}
+ total_by_severity = {
+ s.value: sum(warnings[p][s.value] for p in project_names)
+ for s in Severity.levels
+ }
# emit table header
stats_header = ['Project']
- for s in Severity.range:
- if total_by_severity[s]:
- stats_header.append("<span style='background-color:{}'>{}</span>".
- format(Severity.colors[s],
- Severity.column_headers[s]))
+ for s in Severity.levels:
+ if total_by_severity[s.value]:
+ stats_header.append(
+ '<span style=\'background-color:{}\'>{}</span>'.format(
+ s.color, s.column_header))
stats_header.append('TOTAL')
# emit a row of warning counts per project, skip no-warning projects
@@ -262,9 +261,9 @@
for p in project_names:
if total_by_project[p]:
one_row = [p]
- for s in Severity.range:
- if total_by_severity[s]:
- one_row.append(warnings[p][s])
+ for s in Severity.levels:
+ if total_by_severity[s.value]:
+ one_row.append(warnings[p][s.value])
one_row.append(total_by_project[p])
stats_rows.append(one_row)
total_all_projects += total_by_project[p]
@@ -272,10 +271,10 @@
# emit a row of warning counts per severity
total_all_severities = 0
one_row = ['<b>TOTAL</b>']
- for s in Severity.range:
- if total_by_severity[s]:
- one_row.append(total_by_severity[s])
- total_all_severities += total_by_severity[s]
+ for s in Severity.levels:
+ if total_by_severity[s.value]:
+ one_row.append(total_by_severity[s.value])
+ total_all_severities += total_by_severity[s.value]
one_row.append(total_all_projects)
stats_rows.append(one_row)
print('<script>')
@@ -292,7 +291,7 @@
unknown = 0
sort_warnings()
for i in warn_patterns:
- if i['severity'] == Severity.UNKNOWN:
+ if i['severity'] == Severity.UNMATCHED:
unknown += len(i['members'])
elif i['severity'] == Severity.SKIP:
skipped += len(i['members'])
@@ -354,8 +353,6 @@
if not i['members']:
fixed_patterns.append(i['description'] + ' (' +
all_patterns(i) + ')')
- if i['option']:
- fixed_patterns.append(' ' + i['option'])
fixed_patterns = sorted(fixed_patterns)
print('<div id="' + anchor + '" style="display:none;"><table>')
cur_row_class = 0
@@ -380,6 +377,7 @@
for i in range(len(warn_patterns)):
w = warn_patterns[i]
for cpat in w['compiled_patterns']:
+ # pytype: disable=attribute-error
if cpat.match(line):
p = find_project_index(line)
results.append([line, i, p])
@@ -389,6 +387,7 @@
# probably caused by 'make -j' mixing the output from
# 2 or more concurrent compiles
pass
+ # pytype: enable=attribute-error
def classify_warnings(lines):
@@ -404,7 +403,6 @@
def parallel_classify_warnings(warning_lines, parallel_process):
"""Classify all warning lines with num_cpu parallel processes."""
- compile_patterns()
num_cpu = args.processes
if num_cpu > 1:
groups = [[] for x in range(num_cpu)]
@@ -431,14 +429,6 @@
pattern['projects'][pname] = 1
-def compile_patterns():
- """Precompiling every pattern speeds up parsing by about 30x."""
- for i in warn_patterns:
- i['compiled_patterns'] = []
- for pat in i['patterns']:
- i['compiled_patterns'].append(re.compile(pat))
-
-
def find_warn_py_and_android_root(path):
"""Set and return android_root path if it is found."""
global android_root
@@ -475,7 +465,9 @@
return
# Do not use common prefix of a small number of paths.
if count > 10:
+ # pytype: disable=wrong-arg-types
root_path = os.path.commonprefix(warning_lines)
+ # pytype: enable=wrong-arg-types
if len(root_path) > 2 and root_path[len(root_path) - 1] == '/':
android_root = root_path[:-1]
@@ -575,7 +567,9 @@
# Return s with escaped backslash and quotation characters.
def escape_string(s):
+ # pytype: disable=attribute-error
return s.replace('\\', '\\\\').replace('"', '\\"')
+ # pytype: enable=attribute-error
# Return s without trailing '\n' and escape the quotation characters.
@@ -777,16 +771,18 @@
"""Dump dynamic HTML page's static JavaScript data."""
emit_const_string('FlagURL', args.url if args.url else '')
emit_const_string('FlagSeparator', args.separator if args.separator else '')
- emit_const_string_array('SeverityColors', Severity.colors)
- emit_const_string_array('SeverityHeaders', Severity.headers)
- emit_const_string_array('SeverityColumnHeaders', Severity.column_headers)
+ emit_const_string_array('SeverityColors', [s.color for s in Severity.levels])
+ emit_const_string_array('SeverityHeaders',
+ [s.header for s in Severity.levels])
+ emit_const_string_array('SeverityColumnHeaders',
+ [s.column_header for s in Severity.levels])
emit_const_string_array('ProjectNames', project_names)
+ # pytype: disable=attribute-error
emit_const_int_array('WarnPatternsSeverity',
- [w['severity'] for w in warn_patterns])
+ [w['severity'].value for w in warn_patterns])
+ # pytype: enable=attribute-error
emit_const_html_string_array('WarnPatternsDescription',
[w['description'] for w in warn_patterns])
- emit_const_html_string_array('WarnPatternsOption',
- [w['option'] for w in warn_patterns])
emit_const_html_string_array('WarningMessages', warning_messages)
emit_const_object_array('Warnings', warning_records)
@@ -851,7 +847,9 @@
warning = kind + ': ' + description_for_csv(i)
writer.writerow([n, '', warning])
# print number of warnings for each project, ordered by project name.
+ # pytype: disable=attribute-error
projects = sorted(i['projects'].keys())
+ # pytype: enable=attribute-error
for p in projects:
writer.writerow([i['projects'][p], p, warning])
writer.writerow([total, '', kind + ' warnings'])
@@ -864,8 +862,9 @@
"""Dump number of warnings in csv format to stdout."""
sort_warnings()
total = 0
- for s in Severity.range:
- total += count_severity(writer, s, Severity.column_headers[s])
+ for s in Severity.levels:
+ if s != Severity.SEVERITY_UNKNOWN:
+ total += count_severity(writer, s, s.column_header)
writer.writerow([total, '', 'All warnings'])