summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2016-02-03 02:25:12 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-02-03 02:25:12 +0000
commit4eb09a62f2fc5f29747afd199dd1072d949b4892 (patch)
tree53c9f2456a600403f9cbea126c0c3690b68982c8
parentdd681db9a7978abeb783af206406cfcae0b8514d (diff)
parent879785074ca93e13896ce364a45eb5cc17081c4a (diff)
downloadextras-4eb09a62f2fc5f29747afd199dd1072d949b4892.tar.gz
Merge "Fix warnings in system/extras."
-rw-r--r--boot_control_copy/Android.mk2
-rw-r--r--boot_control_copy/bootinfo.c1
-rw-r--r--ext4_utils/make_ext4fs.c13
-rw-r--r--f2fs_utils/Android.mk3
-rw-r--r--f2fs_utils/f2fs_ioutils.c13
-rw-r--r--f2fs_utils/make_f2fs_main.c5
-rw-r--r--ksmutils/ksminfo.c3
-rw-r--r--latencytop/Android.mk2
-rw-r--r--libpagemap/Android.mk1
-rw-r--r--memtrack/memtrack.cpp2
-rw-r--r--sane_schedstat/Android.mk1
-rw-r--r--showslab/showslab.c2
-rw-r--r--sound/Android.mk2
-rw-r--r--tests/audio/alsa/pcmtest.cpp14
-rw-r--r--tests/cpueater/Android.mk1
-rw-r--r--tests/crypto/Android.mk2
-rw-r--r--tests/framebuffer/Android.mk4
-rw-r--r--tests/fstest/recovery_test.cpp13
-rw-r--r--tests/pagingtest/thrashing_test.c13
-rw-r--r--tests/schedtest/Android.mk1
-rw-r--r--tests/uevents/Android.mk2
21 files changed, 64 insertions, 36 deletions
diff --git a/boot_control_copy/Android.mk b/boot_control_copy/Android.mk
index 6e55d05d..3125d6e6 100644
--- a/boot_control_copy/Android.mk
+++ b/boot_control_copy/Android.mk
@@ -4,7 +4,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := boot_control_copy.c bootinfo.c
-LOCAL_CFLAGS := -Wall -Wno-missing-field-initializers
+LOCAL_CFLAGS := -Wall -Wno-missing-field-initializers -Wno-unused-parameter
LOCAL_C_INCLUDES := system/core/mkbootimg bootable/recovery
LOCAL_SHARED_LIBRARIES := libcutils
LOCAL_STATIC_LIBRARIES := libfs_mgr
diff --git a/boot_control_copy/bootinfo.c b/boot_control_copy/bootinfo.c
index e3c24127..396dd815 100644
--- a/boot_control_copy/bootinfo.c
+++ b/boot_control_copy/bootinfo.c
@@ -180,7 +180,6 @@ bool boot_info_validate(BrilloBootInfo* info)
void boot_info_reset(BrilloBootInfo* info)
{
- size_t n;
memset(info, '\0', sizeof(BrilloBootInfo));
info->magic[0] = 'B';
info->magic[1] = 'C';
diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c
index b4ebbce9..1ba415bd 100644
--- a/ext4_utils/make_ext4fs.c
+++ b/ext4_utils/make_ext4fs.c
@@ -41,6 +41,19 @@
/* These match the Linux definitions of these flags.
L_xx is defined to avoid conflicting with the win32 versions.
*/
+#undef S_IRWXU
+#undef S_IRGRP
+#undef S_IWGRP
+#undef S_IXGRP
+#undef S_IRWXG
+#undef S_IROTH
+#undef S_IWOTH
+#undef S_IXOTH
+#undef S_IRWXO
+#undef S_ISUID
+#undef S_ISGID
+#undef S_ISVTX
+
#define L_S_IRUSR 00400
#define L_S_IWUSR 00200
#define L_S_IXUSR 00100
diff --git a/f2fs_utils/Android.mk b/f2fs_utils/Android.mk
index 2bc190f3..647c390b 100644
--- a/f2fs_utils/Android.mk
+++ b/f2fs_utils/Android.mk
@@ -11,11 +11,13 @@ LOCAL_STATIC_LIBRARIES := \
libsparse_host \
libz
LOCAL_C_INCLUDES := external/f2fs-tools/include external/f2fs-tools/mkfs
+LOCAL_CFLAGS := -Wno-unused-parameter
include $(BUILD_HOST_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := f2fs_ioutils.c
LOCAL_C_INCLUDES := external/f2fs-tools/include external/f2fs-tools/mkfs
+LOCAL_CFLAGS := -Wno-unused-parameter
LOCAL_STATIC_LIBRARIES := \
libselinux \
libsparse_host \
@@ -64,6 +66,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libf2fs_utils_static
LOCAL_SRC_FILES := f2fs_utils.c
LOCAL_C_INCLUDES := external/f2fs-tools/include external/f2fs-tools/mkfs
+LOCAL_CFLAGS := -Wno-unused-parameter
LOCAL_STATIC_LIBRARIES := \
libsparse_static
include $(BUILD_STATIC_LIBRARY)
diff --git a/f2fs_utils/f2fs_ioutils.c b/f2fs_utils/f2fs_ioutils.c
index a050cf8f..01efd53f 100644
--- a/f2fs_utils/f2fs_ioutils.c
+++ b/f2fs_utils/f2fs_ioutils.c
@@ -28,8 +28,11 @@
#define _LARGEFILE64_SOURCE
+#include <assert.h>
#include <asm/types.h>
+#include <dlfcn.h>
#include <errno.h>
+#include <fcntl.h>
#include <linux/fs.h>
#include <stdio.h>
#include <stdlib.h>
@@ -37,10 +40,7 @@
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <fcntl.h>
-#include <dlfcn.h>
-
-#include <assert.h>
+#include <unistd.h>
#include <f2fs_fs.h>
#include <f2fs_format_utils.h>
@@ -98,7 +98,10 @@ static int dev_write_fd(void *buf, __u64 offset, size_t len)
{
if (lseek64(config.fd, (off64_t)offset, SEEK_SET) < 0)
return -1;
- if (write(config.fd, buf, len) != len)
+ ssize_t written = write(config.fd, buf, len);
+ if (written == -1)
+ return -1;
+ if ((size_t)written != len)
return -1;
return 0;
}
diff --git a/f2fs_utils/make_f2fs_main.c b/f2fs_utils/make_f2fs_main.c
index 84042660..1e0dd876 100644
--- a/f2fs_utils/make_f2fs_main.c
+++ b/f2fs_utils/make_f2fs_main.c
@@ -17,8 +17,9 @@
#include <fcntl.h>
#include <libgen.h>
#include <stdio.h>
-#include <unistd.h>
#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#if defined(__linux__)
#include <linux/fs.h>
@@ -26,6 +27,8 @@
#include <sys/disk.h>
#endif
+#include "make_f2fs.h"
+
#ifndef USE_MINGW /* O_BINARY is windows-specific flag */
#define O_BINARY 0
#endif
diff --git a/ksmutils/ksminfo.c b/ksmutils/ksminfo.c
index 4ac39bc7..278692f4 100644
--- a/ksmutils/ksminfo.c
+++ b/ksmutils/ksminfo.c
@@ -189,7 +189,6 @@ exit:
static int read_pages(struct ksm_pages *kp, pm_map_t **maps, size_t num_maps, uint8_t pr_flags) {
size_t i, j, k;
- size_t len;
uint64_t *pagemap;
size_t map_len;
uint64_t flags;
@@ -251,7 +250,7 @@ static int read_pages(struct ksm_pages *kp, pm_map_t **maps, size_t num_maps, ui
fprintf(stderr, "warning: could not lseek to 0x%08lx\n", vaddr);
continue;
}
- len = read(fd, data, pm_kernel_pagesize(ker));
+ ssize_t len = read(fd, data, pm_kernel_pagesize(ker));
if (len != pm_kernel_pagesize(ker)) {
fprintf(stderr, "warning: could not read page at 0x%08lx\n", vaddr);
continue;
diff --git a/latencytop/Android.mk b/latencytop/Android.mk
index 2c966724..220f4e36 100644
--- a/latencytop/Android.mk
+++ b/latencytop/Android.mk
@@ -23,4 +23,6 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
+LOCAL_CFLAGS := -Wno-unused-parameter
+
include $(BUILD_EXECUTABLE)
diff --git a/libpagemap/Android.mk b/libpagemap/Android.mk
index 05e6f012..65d466c6 100644
--- a/libpagemap/Android.mk
+++ b/libpagemap/Android.mk
@@ -25,6 +25,7 @@ LOCAL_MODULE := libpagemap
LOCAL_MODULE_TAGS := debug
LOCAL_SRC_FILES := $(pagemap_src_files)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
+LOCAL_CFLAGS := -Wno-unused-parameter
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
include $(BUILD_SHARED_LIBRARY)
diff --git a/memtrack/memtrack.cpp b/memtrack/memtrack.cpp
index a451d5c0..2c4d7c08 100644
--- a/memtrack/memtrack.cpp
+++ b/memtrack/memtrack.cpp
@@ -248,7 +248,7 @@ void ProcessInfo::dumpToLog() {
for (std::vector<const process_info_t *>::const_iterator it = list_.begin();
it != list_.end(); ++it) {
ALOGI(" Name: %s", (*it)->name.c_str());
- ALOGI(" Max running processes: %d", (*it)->max_num_pids);
+ ALOGI(" Max running processes: %zu", (*it)->max_num_pids);
if ((*it)->pids.size() > 0) {
ALOGI(" Currently running pids:");
for (std::vector<int>::const_iterator pid_it = (*it)->pids.begin();
diff --git a/sane_schedstat/Android.mk b/sane_schedstat/Android.mk
index 5843c43f..c984b9f2 100644
--- a/sane_schedstat/Android.mk
+++ b/sane_schedstat/Android.mk
@@ -7,5 +7,6 @@ LOCAL_SRC_FILES := sane_schedstat.c
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE := sane_schedstat
+LOCAL_CFLAGS := -Wno-unused-parameter
include $(BUILD_EXECUTABLE)
diff --git a/showslab/showslab.c b/showslab/showslab.c
index 9c9e60eb..08acbf81 100644
--- a/showslab/showslab.c
+++ b/showslab/showslab.c
@@ -243,7 +243,7 @@ BUILD_SORT_FUNC(nr_pages)
* set_sort_func - return the slab_sort_func that matches the given key.
* On unrecognizable key, the call returns NULL.
*/
-static void * set_sort_func(char key)
+static sort_t set_sort_func(char key)
{
switch (tolower(key)) {
case 'a':
diff --git a/sound/Android.mk b/sound/Android.mk
index 62174ccf..a08c4371 100644
--- a/sound/Android.mk
+++ b/sound/Android.mk
@@ -3,6 +3,6 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := sound
LOCAL_SRC_FILES := playwav.c
-LOCAL_MODULE_TAGS := optional
+LOCAL_CFLAGS := -Wno-unused-parameter
include $(BUILD_EXECUTABLE)
diff --git a/tests/audio/alsa/pcmtest.cpp b/tests/audio/alsa/pcmtest.cpp
index b8bc5f28..7233e104 100644
--- a/tests/audio/alsa/pcmtest.cpp
+++ b/tests/audio/alsa/pcmtest.cpp
@@ -53,7 +53,7 @@ static unsigned int cards;
static unsigned int mixers;
static unsigned int timers;
-int getPcmNodes(void)
+unsigned int getPcmNodes(void)
{
DIR *d;
struct dirent *de;
@@ -165,7 +165,7 @@ int getPcmParams(unsigned int i)
TEST(pcmtest, CheckAudioDir) {
pcms = getPcmNodes();
- ASSERT_GT(pcms, 0);
+ ASSERT_GT(pcms, 0U);
}
TEST(pcmtest, GetSoundDevs) {
@@ -176,24 +176,24 @@ TEST(pcmtest, GetSoundDevs) {
}
TEST(pcmtest, CheckPcmSanity0) {
- ASSERT_NE(0, pcms);
+ ASSERT_NE(0U, pcms);
}
TEST(pcmtest, CheckPcmSanity1) {
- EXPECT_NE(1, pcms % 2);
+ EXPECT_NE(1U, pcms % 2);
}
TEST(pcmtests, CheckMixerSanity) {
- ASSERT_NE(0, mixers);
+ ASSERT_NE(0U, mixers);
ASSERT_EQ(mixers, cards);
}
TEST(pcmtest, CheckTimesSanity0) {
- ASSERT_NE(0, timers);
+ ASSERT_NE(0U, timers);
}
TEST(pcmtest, CheckTimesSanity1) {
- EXPECT_EQ(1, timers);
+ EXPECT_EQ(1U, timers);
}
TEST(pcmtest, CheckPcmDevices) {
diff --git a/tests/cpueater/Android.mk b/tests/cpueater/Android.mk
index 733c67ad..0bb08d9d 100644
--- a/tests/cpueater/Android.mk
+++ b/tests/cpueater/Android.mk
@@ -20,6 +20,7 @@ LOCAL_MODULE := cpueater
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := cpueater.c
+LOCAL_CFLAGS := -Wno-unused-parameter
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
diff --git a/tests/crypto/Android.mk b/tests/crypto/Android.mk
index 737e0003..e118e5d0 100644
--- a/tests/crypto/Android.mk
+++ b/tests/crypto/Android.mk
@@ -7,5 +7,5 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES:= get_dm_versions.c
LOCAL_MODULE:= get_dm_versions
LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS :=
+LOCAL_CFLAGS := -Wno-unused-parameter
include $(BUILD_EXECUTABLE)
diff --git a/tests/framebuffer/Android.mk b/tests/framebuffer/Android.mk
index 75a9f75d..7f4c7125 100644
--- a/tests/framebuffer/Android.mk
+++ b/tests/framebuffer/Android.mk
@@ -9,7 +9,7 @@ LOCAL_SHARED_LIBRARIES := \
LOCAL_MODULE:= test-fb-refresh
-LOCAL_MODULE_TAGS := optional
+LOCAL_CFLAGS := -Wno-unused-parameter
include $(BUILD_EXECUTABLE)
@@ -18,7 +18,7 @@ include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := fb_test.c
LOCAL_MODULE = test-fb-simple
-LOCAL_MODULE_TAGS := optional
LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_STATIC_LIBRARIES := libc
+LOCAL_CFLAGS := -Wno-unused-parameter
include $(BUILD_EXECUTABLE)
diff --git a/tests/fstest/recovery_test.cpp b/tests/fstest/recovery_test.cpp
index f8d41c31..b93de83e 100644
--- a/tests/fstest/recovery_test.cpp
+++ b/tests/fstest/recovery_test.cpp
@@ -39,8 +39,8 @@
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#define FSTAB_PREFIX "/fstab."
#define SB_OFFSET 1024
-#define UMOUNT_BIN "/system/bin/umount"
-#define VDC_BIN "/system/bin/vdc"
+static char UMOUNT_BIN[] = "/system/bin/umount";
+static char VDC_BIN[] = "/system/bin/vdc";
enum Fs_Type { FS_UNKNOWN, FS_EXT4, FS_F2FS };
@@ -216,9 +216,10 @@ class FsRecoveryTest : public ::testing::Test {
}
bool unmountCache() {
+ char cache_str[] = "/cache";
char *umount_argv[] = {
UMOUNT_BIN,
- "/cache"
+ cache_str,
};
int status;
return android_fork_execvp_ext(ARRAY_SIZE(umount_argv), umount_argv,
@@ -227,10 +228,12 @@ class FsRecoveryTest : public ::testing::Test {
}
bool mountAll() {
+ char storage_str[] = "storage";
+ char mountall_str[] = "mountall";
char *mountall_argv[] = {
VDC_BIN,
- "storage",
- "mountall"
+ storage_str,
+ mountall_str,
};
int status;
return android_fork_execvp_ext(ARRAY_SIZE(mountall_argv), mountall_argv,
diff --git a/tests/pagingtest/thrashing_test.c b/tests/pagingtest/thrashing_test.c
index 165cd991..7ecd3ade 100644
--- a/tests/pagingtest/thrashing_test.c
+++ b/tests/pagingtest/thrashing_test.c
@@ -14,7 +14,6 @@ int thrashing_test(int test_runs) {
int fds[4] = {-1, -1, -1, -1};
char tmpnames[4][17] = { "thrashing1XXXXXX", "thrashing2XXXXXX", "thrashing3XXXXXX", "thrashing4XXXXXX" };
volatile char *bufs[4] = {0};
- unsigned i, j;
long long k;
int ret = -1;
struct timeval begin_time, end_time, elapsed_time, total_time;
@@ -33,14 +32,14 @@ int thrashing_test(int test_runs) {
filesize = num_pages * pagesize / (ARRAY_SIZE(fds) - 1);
- for (i = 0; i < ARRAY_SIZE(fds); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(fds); i++) {
fds[i] = create_tmp_file(tmpnames[i], filesize);
if (fds[i] < 0) {
goto err_fd;
}
}
- for (i = 0; i < ARRAY_SIZE(fds); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(fds); i++) {
bufs[i] = mmap(NULL, filesize, PROT_READ, MAP_PRIVATE, fds[i], 0);
if (bufs[i] == ((void *)-1)) {
fprintf(stderr, "Failed to mmap file: %s\n", strerror(errno));
@@ -48,8 +47,8 @@ int thrashing_test(int test_runs) {
}
}
- for (i = 0; i < test_runs; i++) {
- for (j = 0; j < ARRAY_SIZE(fds); j++) {
+ for (int i = 0; i < test_runs; i++) {
+ for (size_t j = 0; j < ARRAY_SIZE(fds); j++) {
gettimeofday(&begin_time, NULL);
//Unfortunately when under memory pressure, fadvise and madvise stop working...
//Read backwards to prevent mmap prefetching
@@ -69,11 +68,11 @@ int thrashing_test(int test_runs) {
ret = 0;
err:
- for (i = 0; i < ARRAY_SIZE(bufs) && bufs[i] != NULL; i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(bufs) && bufs[i] != NULL; i++) {
munmap((void *)bufs[i], filesize);
}
err_fd:
- for (i = 0; i < ARRAY_SIZE(fds) && fds[i] >= 0; i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(fds) && fds[i] >= 0; i++) {
close(fds[i]);
}
return ret;
diff --git a/tests/schedtest/Android.mk b/tests/schedtest/Android.mk
index 58e8d62b..036c9fec 100644
--- a/tests/schedtest/Android.mk
+++ b/tests/schedtest/Android.mk
@@ -6,5 +6,6 @@ LOCAL_SRC_FILES := \
schedtest.c
LOCAL_MODULE := schedtest
+LOCAL_CFLAGS := -Wno-unused-parameter
include $(BUILD_EXECUTABLE)
diff --git a/tests/uevents/Android.mk b/tests/uevents/Android.mk
index f04b211c..fb8a8518 100644
--- a/tests/uevents/Android.mk
+++ b/tests/uevents/Android.mk
@@ -6,6 +6,6 @@ LOCAL_SRC_FILES := uevents.c
LOCAL_SHARED_LIBRARIES += libcutils
LOCAL_MODULE:= uevents
-LOCAL_MODULE_TAGS := optional
+LOCAL_CFLAGS := -Wno-unused-parameter
include $(BUILD_EXECUTABLE)