[Android General] ic2y:
My computer use Ubuntu 16.04 X64 LTS, and I compile Android 6.0's source code.And I success compile all code.

Then, CODE_ROOT/build/envsetup.sh is every insteresting.Look this function

# Return driver for "make", if any (eg. static analyzer)
function getdriver()
{
local T="$1"
test "$WITH_STATIC_ANALYZER" = "0" && unset WITH_STATIC_ANALYZER
if [ -n "$WITH_STATIC_ANALYZER" ]; then
echo "\
$T/prebuilts/misc/linux-x86/analyzer/tools/scan-build/scan-build \
--use-analyzer $T/prebuilts/misc/linux-x86/analyzer/bin/analyzer \
--status-bugs \
--top=$T"
fi
}

then,I insert defect code in CODE_ROOT/frameworks/av/media/mediaserver/main_mediaserver.cpp

int main(int argc __unused, char** argv)
{
signal(SIGPIPE, SIG_IGN);
char value[PROPERTY_VALUE_MAX];
bool doLog = (property_get("ro.test_harness", value, "0") > 0) && (atoi(value) == 1);
int b = 3 / 0;
int bb = 3 / 0;
malloc(-1);
pid_t childPid;
// FIXME The advantage of making the process containing media.log service the parent process of
// the process that contains all the other real services, is that it allow

then, run these commands

WITH_STATIC_ANALYZER=1
mmm frameworks/av/media/mediaserver/

but,result is this

scan-build: Emitting reports for this run to '/tmp/scan-build-2016-10-10-214038-24568-1'.
make: Entering directory '/home/cao/code/aosp/6.0'
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=6.0
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.4.0-38-generic-x86_64-with-Ubuntu-16.04-xenial
HOST_BUILD_TYPE=release
BUILD_ID=MRA58K
OUT_DIR=/mnt/big_disk/aosp/out/6.0
============================================
Import includes file: /mnt/big_disk/aosp/out/6.0/target/product/generic/obj/STATIC_LIBRARIES/libregistermsext_intermediates/import_includes
target thumb C++: libregistermsext <= frameworks/av/media/mediaserver/register.cpp
Export includes file: frameworks/av/media/mediaserver/Android.mk -- /mnt/big_disk/aosp/out/6.0/target/product/generic/obj/STATIC_LIBRARIES/libregistermsext_intermediates/export_includes
target StaticLib: libregistermsext (/mnt/big_disk/aosp/out/6.0/target/product/generic/obj/STATIC_LIBRARIES/libregistermsext_intermediates/libregistermsext.a)
Import includes file: /mnt/big_disk/aosp/out/6.0/target/product/generic/obj/EXECUTABLES/mediaserver_intermediates/import_includes
target thumb C++: mediaserver <= frameworks/av/media/mediaserver/main_mediaserver.cpp
frameworks/av/media/mediaserver/main_mediaserver.cpp: In function 'int main(int, char**)':
frameworks/av/media/mediaserver/main_mediaserver.cpp:49:15: warning: division by zero [-Wdiv-by-zero]
int b = 3 / 0;
^
frameworks/av/media/mediaserver/main_mediaserver.cpp:50:16: warning: division by zero [-Wdiv-by-zero]
int bb = 3 / 0;
^
frameworks/av/media/mediaserver/main_mediaserver.cpp:51:15: warning: ignoring return value of 'void* malloc(size_t)', declared with attribute warn_unused_result [-Wunused-result]
malloc(-1);
^
target Executable: mediaserver (/mnt/big_disk/aosp/out/6.0/target/product/generic/obj/EXECUTABLES/mediaserver_intermediates/LINKED/mediaserver)
target Unpacked: mediaserver (/mnt/big_disk/aosp/out/6.0/target/product/generic/obj/EXECUTABLES/mediaserver_intermediates/PACKED/mediaserver)
target Symbolic: mediaserver (/mnt/big_disk/aosp/out/6.0/target/product/generic/symbols/system/bin/mediaserver)
Export includes file: frameworks/av/media/mediaserver/Android.mk -- /mnt/big_disk/aosp/out/6.0/target/product/generic/obj/EXECUTABLES/mediaserver_intermediates/export_includes
target Strip: mediaserver (/mnt/big_disk/aosp/out/6.0/target/product/generic/obj/EXECUTABLES/mediaserver_intermediates/mediaserver)
Notice file: frameworks/av/media/mediaserver/NOTICE -- /mnt/big_disk/aosp/out/6.0/target/product/generic/obj/NOTICE_FILES/src//system/bin/mediaserver.txt
Notice file: frameworks/av/media/mediaserver/NOTICE -- /mnt/big_disk/aosp/out/6.0/target/product/generic/obj/NOTICE_FILES/src//system/lib/libregistermsext.a.txt
Install: /mnt/big_disk/aosp/out/6.0/target/product/generic/system/bin/mediaserver
make: Leaving directory '/home/cao/code/aosp/6.0'
scan-build: Removing directory '/tmp/scan-build-2016-10-10-214038-24568-1' because it contains no reports.
scan-build: No bugs found.

Obviously,clang warning these defects.But ! finally,<scan-build: No bugs found.>

WHY NO BUGS???