recovery: Switch to clang

And a few trival fixes to suppress warnings.

Change-Id: Id28e3581aaca4bda59826afa80c0c1cdfb0442fc
(cherry picked from commit 80e46e08de)
This commit is contained in:
Tao Bao 2015-06-03 10:49:29 -07:00 committed by Rom Lemarchand
parent cde720797f
commit 7101b2e285
13 changed files with 38 additions and 11 deletions

View file

@ -14,11 +14,10 @@
LOCAL_PATH := $(call my-dir) LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_SRC_FILES := fuse_sideload.c LOCAL_SRC_FILES := fuse_sideload.c
LOCAL_CLANG := true
LOCAL_CFLAGS := -O2 -g -DADB_HOST=0 -Wall -Wno-unused-parameter LOCAL_CFLAGS := -O2 -g -DADB_HOST=0 -Wall -Wno-unused-parameter
LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
@ -55,6 +54,7 @@ RECOVERY_API_VERSION := 3
RECOVERY_FSTAB_VERSION := 2 RECOVERY_FSTAB_VERSION := 2
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION) LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
LOCAL_CFLAGS += -Wno-unused-parameter LOCAL_CFLAGS += -Wno-unused-parameter
LOCAL_CLANG := true
LOCAL_C_INCLUDES += \ LOCAL_C_INCLUDES += \
system/vold \ system/vold \
@ -99,6 +99,7 @@ include $(BUILD_EXECUTABLE)
# All the APIs for testing # All the APIs for testing
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_CLANG := true
LOCAL_MODULE := libverifier LOCAL_MODULE := libverifier
LOCAL_MODULE_TAGS := tests LOCAL_MODULE_TAGS := tests
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
@ -106,6 +107,7 @@ LOCAL_SRC_FILES := \
include $(BUILD_STATIC_LIBRARY) include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_CLANG := true
LOCAL_MODULE := verifier_test LOCAL_MODULE := verifier_test
LOCAL_FORCE_STATIC_EXECUTABLE := true LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_MODULE_TAGS := tests LOCAL_MODULE_TAGS := tests

View file

@ -91,7 +91,7 @@ apply_from_adb(RecoveryUI* ui_, bool* wipe_cache, const char* install_file) {
// FUSE_SIDELOAD_HOST_PATHNAME will start to exist once the host // FUSE_SIDELOAD_HOST_PATHNAME will start to exist once the host
// connects and starts serving a package. Poll for its // connects and starts serving a package. Poll for its
// appearance. (Note that inotify doesn't work with FUSE.) // appearance. (Note that inotify doesn't work with FUSE.)
int result; int result = INSTALL_ERROR;
int status; int status;
bool waited = false; bool waited = false;
struct stat st; struct stat st;

View file

@ -13,8 +13,10 @@
# limitations under the License. # limitations under the License.
LOCAL_PATH := $(call my-dir) LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_CLANG := true
LOCAL_SRC_FILES := applypatch.c bspatch.c freecache.c imgpatch.c utils.c LOCAL_SRC_FILES := applypatch.c bspatch.c freecache.c imgpatch.c utils.c
LOCAL_MODULE := libapplypatch LOCAL_MODULE := libapplypatch
LOCAL_MODULE_TAGS := eng LOCAL_MODULE_TAGS := eng
@ -25,6 +27,7 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_CLANG := true
LOCAL_SRC_FILES := main.c LOCAL_SRC_FILES := main.c
LOCAL_MODULE := applypatch LOCAL_MODULE := applypatch
LOCAL_C_INCLUDES += bootable/recovery LOCAL_C_INCLUDES += bootable/recovery
@ -35,6 +38,7 @@ include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_CLANG := true
LOCAL_SRC_FILES := main.c LOCAL_SRC_FILES := main.c
LOCAL_MODULE := applypatch_static LOCAL_MODULE := applypatch_static
LOCAL_FORCE_STATIC_EXECUTABLE := true LOCAL_FORCE_STATIC_EXECUTABLE := true
@ -47,6 +51,7 @@ include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_CLANG := true
LOCAL_SRC_FILES := imgdiff.c utils.c bsdiff.c LOCAL_SRC_FILES := imgdiff.c utils.c bsdiff.c
LOCAL_MODULE := imgdiff LOCAL_MODULE := imgdiff
LOCAL_FORCE_STATIC_EXECUTABLE := true LOCAL_FORCE_STATIC_EXECUTABLE := true

View file

@ -25,6 +25,7 @@ LOCAL_CFLAGS := $(edify_cflags) -g -O0
LOCAL_MODULE := edify LOCAL_MODULE := edify
LOCAL_YACCFLAGS := -v LOCAL_YACCFLAGS := -v
LOCAL_CFLAGS += -Wno-unused-parameter LOCAL_CFLAGS += -Wno-unused-parameter
LOCAL_CLANG := true
include $(BUILD_HOST_EXECUTABLE) include $(BUILD_HOST_EXECUTABLE)
@ -38,5 +39,6 @@ LOCAL_SRC_FILES := $(edify_src_files)
LOCAL_CFLAGS := $(edify_cflags) LOCAL_CFLAGS := $(edify_cflags)
LOCAL_CFLAGS += -Wno-unused-parameter LOCAL_CFLAGS += -Wno-unused-parameter
LOCAL_MODULE := libedify LOCAL_MODULE := libedify
LOCAL_CLANG := true
include $(BUILD_STATIC_LIBRARY) include $(BUILD_STATIC_LIBRARY)

View file

@ -15,6 +15,7 @@ LOCAL_SRC_FILES := \
fuse_adb_provider.cpp \ fuse_adb_provider.cpp \
services.cpp \ services.cpp \
LOCAL_CLANG := true
LOCAL_MODULE := libminadbd LOCAL_MODULE := libminadbd
LOCAL_CFLAGS := $(minadbd_cflags) LOCAL_CFLAGS := $(minadbd_cflags)
LOCAL_CONLY_FLAGS := -Wimplicit-function-declaration LOCAL_CONLY_FLAGS := -Wimplicit-function-declaration

View file

@ -41,6 +41,7 @@ include $(BUILD_STATIC_LIBRARY)
# Used by OEMs for factory test images. # Used by OEMs for factory test images.
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_CLANG := true
LOCAL_MODULE := libminui LOCAL_MODULE := libminui
LOCAL_WHOLE_STATIC_LIBRARIES += libminui LOCAL_WHOLE_STATIC_LIBRARIES += libminui
LOCAL_SHARED_LIBRARIES := libpng LOCAL_SHARED_LIBRARIES := libpng

View file

@ -16,6 +16,8 @@ LOCAL_STATIC_LIBRARIES := libselinux
LOCAL_MODULE := libminzip LOCAL_MODULE := libminzip
LOCAL_CLANG := true
LOCAL_CFLAGS += -Wall LOCAL_CFLAGS += -Wall
include $(BUILD_STATIC_LIBRARY) include $(BUILD_STATIC_LIBRARY)

View file

@ -506,7 +506,6 @@ static bool processDeflatedEntry(const ZipArchive *pArchive,
void *cookie) void *cookie)
{ {
long result = -1; long result = -1;
unsigned char readBuf[32 * 1024];
unsigned char procBuf[32 * 1024]; unsigned char procBuf[32 * 1024];
z_stream zstream; z_stream zstream;
int zerr; int zerr;
@ -603,7 +602,6 @@ bool mzProcessZipEntryContents(const ZipArchive *pArchive,
void *cookie) void *cookie)
{ {
bool ret = false; bool ret = false;
off_t oldOff;
switch (pEntry->compression) { switch (pEntry->compression) {
case STORED: case STORED:

View file

@ -6,10 +6,12 @@ LOCAL_SRC_FILES := \
mounts.c mounts.c
LOCAL_MODULE := libmtdutils LOCAL_MODULE := libmtdutils
LOCAL_CLANG := true
include $(BUILD_STATIC_LIBRARY) include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_CLANG := true
LOCAL_SRC_FILES := flash_image.c LOCAL_SRC_FILES := flash_image.c
LOCAL_MODULE := flash_image LOCAL_MODULE := flash_image
LOCAL_MODULE_TAGS := eng LOCAL_MODULE_TAGS := eng

View file

@ -326,14 +326,18 @@ static void rotate_logs(int max) {
ensure_path_mounted(LAST_KMSG_FILE); ensure_path_mounted(LAST_KMSG_FILE);
for (int i = max-1; i >= 0; --i) { for (int i = max-1; i >= 0; --i) {
std::string old_log = android::base::StringPrintf((i == 0) ? "%s" : "%s.%d", std::string old_log = android::base::StringPrintf("%s", LAST_LOG_FILE);
LAST_LOG_FILE, i); if (i > 0) {
old_log += "." + std::to_string(i);
}
std::string new_log = android::base::StringPrintf("%s.%d", LAST_LOG_FILE, i+1); std::string new_log = android::base::StringPrintf("%s.%d", LAST_LOG_FILE, i+1);
// Ignore errors if old_log doesn't exist. // Ignore errors if old_log doesn't exist.
rename(old_log.c_str(), new_log.c_str()); rename(old_log.c_str(), new_log.c_str());
std::string old_kmsg = android::base::StringPrintf((i == 0) ? "%s" : "%s.%d", std::string old_kmsg = android::base::StringPrintf("%s", LAST_KMSG_FILE);
LAST_KMSG_FILE, i); if (i > 0) {
old_kmsg += "." + std::to_string(i);
}
std::string new_kmsg = android::base::StringPrintf("%s.%d", LAST_KMSG_FILE, i+1); std::string new_kmsg = android::base::StringPrintf("%s.%d", LAST_KMSG_FILE, i+1);
rename(old_kmsg.c_str(), new_kmsg.c_str()); rename(old_kmsg.c_str(), new_kmsg.c_str());
} }
@ -706,7 +710,10 @@ static void choose_recovery_file(Device* device) {
// Add LAST_KMSG_FILE + LAST_KMSG_FILE.x // Add LAST_KMSG_FILE + LAST_KMSG_FILE.x
for (int i = 0; i < KEEP_LOG_COUNT; i++) { for (int i = 0; i < KEEP_LOG_COUNT; i++) {
char* log_file; char* log_file;
if (asprintf(&log_file, (i == 0) ? "%s" : "%s.%d", LAST_LOG_FILE, i) == -1) { int ret;
ret = (i == 0) ? asprintf(&log_file, "%s", LAST_LOG_FILE) :
asprintf(&log_file, "%s.%d", LAST_LOG_FILE, i);
if (ret == -1) {
// memory allocation failure - return early. Should never happen. // memory allocation failure - return early. Should never happen.
return; return;
} }
@ -717,7 +724,9 @@ static void choose_recovery_file(Device* device) {
} }
char* kmsg_file; char* kmsg_file;
if (asprintf(&kmsg_file, (i == 0) ? "%s" : "%s.%d", LAST_KMSG_FILE, i) == -1) { ret = (i == 0) ? asprintf(&kmsg_file, "%s", LAST_KMSG_FILE) :
asprintf(&kmsg_file, "%s.%d", LAST_KMSG_FILE, i);
if (ret == -1) {
// memory allocation failure - return early. Should never happen. // memory allocation failure - return early. Should never happen.
return; return;
} }

View file

@ -17,6 +17,7 @@
LOCAL_PATH := $(call my-dir) LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_CLANG := true
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_STATIC_LIBRARIES := libverifier LOCAL_STATIC_LIBRARIES := libverifier
LOCAL_SRC_FILES := asn1_decoder_test.cpp LOCAL_SRC_FILES := asn1_decoder_test.cpp

View file

@ -16,6 +16,8 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_CLANG := true
LOCAL_SRC_FILES := uncrypt.cpp LOCAL_SRC_FILES := uncrypt.cpp
LOCAL_MODULE := uncrypt LOCAL_MODULE := uncrypt

View file

@ -17,6 +17,8 @@ include $(CLEAR_VARS)
# needed only for OTA packages.) # needed only for OTA packages.)
LOCAL_MODULE_TAGS := eng LOCAL_MODULE_TAGS := eng
LOCAL_CLANG := true
LOCAL_SRC_FILES := $(updater_src_files) LOCAL_SRC_FILES := $(updater_src_files)
ifeq ($(TARGET_USERIMAGES_USE_EXT4), true) ifeq ($(TARGET_USERIMAGES_USE_EXT4), true)