diff options
author | Mark Salyzyn | 2014-04-30 10:50:53 -0500 |
---|---|---|
committer | Mark Salyzyn | 2014-05-07 18:56:21 -0500 |
commit | a04464adaf5b95ae953f8577632d3cf8aa2c80a3 (patch) | |
tree | c4310ee12b17d98841e3e7cdd819618f8a95c080 /liblog | |
parent | d150618d8d31ca1b56258902c40ad5c38f1c4e31 (diff) | |
download | platform-system-core-a04464adaf5b95ae953f8577632d3cf8aa2c80a3.tar.gz platform-system-core-a04464adaf5b95ae953f8577632d3cf8aa2c80a3.tar.xz platform-system-core-a04464adaf5b95ae953f8577632d3cf8aa2c80a3.zip |
liblog: set -Werror
- Deal with some -Wunused issues
- Cleanup UNUSED to __unused transition
Change-Id: Icd33808d4c974625f4fd0a126a90a2b4c90c8314
Diffstat (limited to 'liblog')
-rw-r--r-- | liblog/Android.mk | 8 | ||||
-rw-r--r-- | liblog/event_tag_map.c | 28 | ||||
-rw-r--r-- | liblog/fake_log_device.c | 14 | ||||
-rw-r--r-- | liblog/log_read.c | 19 | ||||
-rw-r--r-- | liblog/log_read_kern.c | 21 | ||||
-rw-r--r-- | liblog/logd_write.c | 13 | ||||
-rw-r--r-- | liblog/logd_write_kern.c | 8 | ||||
-rw-r--r-- | liblog/logprint.c | 38 | ||||
-rw-r--r-- | liblog/tests/liblog_benchmark.cpp | 4 | ||||
-rw-r--r-- | liblog/tests/liblog_test.cpp | 2 |
10 files changed, 62 insertions, 93 deletions
diff --git a/liblog/Android.mk b/liblog/Android.mk index 41440ad97..69ca4164f 100644 --- a/liblog/Android.mk +++ b/liblog/Android.mk | |||
@@ -57,7 +57,7 @@ endif | |||
57 | # ======================================================== | 57 | # ======================================================== |
58 | LOCAL_MODULE := liblog | 58 | LOCAL_MODULE := liblog |
59 | LOCAL_SRC_FILES := $(liblog_host_sources) | 59 | LOCAL_SRC_FILES := $(liblog_host_sources) |
60 | LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1 | 60 | LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1 -Werror |
61 | include $(BUILD_HOST_STATIC_LIBRARY) | 61 | include $(BUILD_HOST_STATIC_LIBRARY) |
62 | 62 | ||
63 | include $(CLEAR_VARS) | 63 | include $(CLEAR_VARS) |
@@ -74,7 +74,7 @@ include $(BUILD_HOST_SHARED_LIBRARY) | |||
74 | include $(CLEAR_VARS) | 74 | include $(CLEAR_VARS) |
75 | LOCAL_MODULE := lib64log | 75 | LOCAL_MODULE := lib64log |
76 | LOCAL_SRC_FILES := $(liblog_host_sources) | 76 | LOCAL_SRC_FILES := $(liblog_host_sources) |
77 | LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1 -m64 | 77 | LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1 -m64 -Werror |
78 | include $(BUILD_HOST_STATIC_LIBRARY) | 78 | include $(BUILD_HOST_STATIC_LIBRARY) |
79 | 79 | ||
80 | # Shared and static library for target | 80 | # Shared and static library for target |
@@ -82,13 +82,13 @@ include $(BUILD_HOST_STATIC_LIBRARY) | |||
82 | include $(CLEAR_VARS) | 82 | include $(CLEAR_VARS) |
83 | LOCAL_MODULE := liblog | 83 | LOCAL_MODULE := liblog |
84 | LOCAL_SRC_FILES := $(liblog_target_sources) | 84 | LOCAL_SRC_FILES := $(liblog_target_sources) |
85 | LOCAL_CFLAGS := $(liblog_cflags) | 85 | LOCAL_CFLAGS := -Werror |
86 | include $(BUILD_STATIC_LIBRARY) | 86 | include $(BUILD_STATIC_LIBRARY) |
87 | 87 | ||
88 | include $(CLEAR_VARS) | 88 | include $(CLEAR_VARS) |
89 | LOCAL_MODULE := liblog | 89 | LOCAL_MODULE := liblog |
90 | LOCAL_WHOLE_STATIC_LIBRARIES := liblog | 90 | LOCAL_WHOLE_STATIC_LIBRARIES := liblog |
91 | LOCAL_CFLAGS := $(liblog_cflags) | 91 | LOCAL_CFLAGS := -Werror |
92 | include $(BUILD_SHARED_LIBRARY) | 92 | include $(BUILD_SHARED_LIBRARY) |
93 | 93 | ||
94 | include $(call first-makefiles-under,$(LOCAL_PATH)) | 94 | include $(call first-makefiles-under,$(LOCAL_PATH)) |
diff --git a/liblog/event_tag_map.c b/liblog/event_tag_map.c index f3d1e2fe2..bea99aae7 100644 --- a/liblog/event_tag_map.c +++ b/liblog/event_tag_map.c | |||
@@ -13,15 +13,16 @@ | |||
13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | #include <log/event_tag_map.h> | ||
17 | #include <log/log.h> | ||
18 | 16 | ||
17 | #include <assert.h> | ||
18 | #include <errno.h> | ||
19 | #include <fcntl.h> | ||
19 | #include <stdlib.h> | 20 | #include <stdlib.h> |
20 | #include <string.h> | 21 | #include <string.h> |
21 | #include <fcntl.h> | ||
22 | #include <sys/mman.h> | 22 | #include <sys/mman.h> |
23 | #include <errno.h> | 23 | |
24 | #include <assert.h> | 24 | #include <log/event_tag_map.h> |
25 | #include <log/log.h> | ||
25 | 26 | ||
26 | #define OUT_TAG "EventTagMap" | 27 | #define OUT_TAG "EventTagMap" |
27 | 28 | ||
@@ -52,7 +53,6 @@ static int countMapLines(const EventTagMap* map); | |||
52 | static int parseMapLines(EventTagMap* map); | 53 | static int parseMapLines(EventTagMap* map); |
53 | static int scanTagLine(char** pData, EventTag* tag, int lineNum); | 54 | static int scanTagLine(char** pData, EventTag* tag, int lineNum); |
54 | static int sortTags(EventTagMap* map); | 55 | static int sortTags(EventTagMap* map); |
55 | static void dumpTags(const EventTagMap* map); | ||
56 | 56 | ||
57 | 57 | ||
58 | /* | 58 | /* |
@@ -185,8 +185,6 @@ static inline int isCharDigit(char c) | |||
185 | */ | 185 | */ |
186 | static int processFile(EventTagMap* map) | 186 | static int processFile(EventTagMap* map) |
187 | { | 187 | { |
188 | EventTag* tagArray = NULL; | ||
189 | |||
190 | /* get a tag count */ | 188 | /* get a tag count */ |
191 | map->numTags = countMapLines(map); | 189 | map->numTags = countMapLines(map); |
192 | if (map->numTags < 0) | 190 | if (map->numTags < 0) |
@@ -422,17 +420,3 @@ static int sortTags(EventTagMap* map) | |||
422 | 420 | ||
423 | return 0; | 421 | return 0; |
424 | } | 422 | } |
425 | |||
426 | /* | ||
427 | * Dump the tag array for debugging. | ||
428 | */ | ||
429 | static void dumpTags(const EventTagMap* map) | ||
430 | { | ||
431 | int i; | ||
432 | |||
433 | for (i = 0; i < map->numTags; i++) { | ||
434 | const EventTag* tag = &map->tagArray[i]; | ||
435 | printf(" %3d: %6d '%s'\n", i, tag->tagIndex, tag->tagStr); | ||
436 | } | ||
437 | } | ||
438 | |||
diff --git a/liblog/fake_log_device.c b/liblog/fake_log_device.c index da83a8525..136792ddd 100644 --- a/liblog/fake_log_device.c +++ b/liblog/fake_log_device.c | |||
@@ -21,18 +21,22 @@ | |||
21 | */ | 21 | */ |
22 | #include "fake_log_device.h" | 22 | #include "fake_log_device.h" |
23 | 23 | ||
24 | #include <log/logd.h> | ||
25 | |||
26 | #include <stdlib.h> | ||
27 | #include <string.h> | ||
28 | #include <ctype.h> | 24 | #include <ctype.h> |
29 | #include <errno.h> | 25 | #include <errno.h> |
30 | #include <fcntl.h> | 26 | #include <fcntl.h> |
27 | #include <stdlib.h> | ||
28 | #include <string.h> | ||
29 | |||
30 | #include <log/logd.h> | ||
31 | 31 | ||
32 | #ifdef HAVE_PTHREADS | 32 | #ifdef HAVE_PTHREADS |
33 | #include <pthread.h> | 33 | #include <pthread.h> |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #ifndef __unused | ||
37 | #define __unused __attribute__((__unused__)) | ||
38 | #endif | ||
39 | |||
36 | #define kMaxTagLen 16 /* from the long-dead utils/Log.cpp */ | 40 | #define kMaxTagLen 16 /* from the long-dead utils/Log.cpp */ |
37 | 41 | ||
38 | #define kTagSetSize 16 /* arbitrary */ | 42 | #define kTagSetSize 16 /* arbitrary */ |
@@ -613,7 +617,7 @@ static int logClose(int fd) | |||
613 | /* | 617 | /* |
614 | * Open a log output device and return a fake fd. | 618 | * Open a log output device and return a fake fd. |
615 | */ | 619 | */ |
616 | static int logOpen(const char* pathName, int flags) | 620 | static int logOpen(const char* pathName, int flags __unused) |
617 | { | 621 | { |
618 | LogState *logState; | 622 | LogState *logState; |
619 | int fd = -1; | 623 | int fd = -1; |
diff --git a/liblog/log_read.c b/liblog/log_read.c index 11fe8486b..ca5a1a7fa 100644 --- a/liblog/log_read.c +++ b/liblog/log_read.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #define NOMINMAX /* for windows to suppress definition of min in stdlib.h */ | 23 | #define NOMINMAX /* for windows to suppress definition of min in stdlib.h */ |
24 | #include <stdlib.h> | 24 | #include <stdlib.h> |
25 | #include <string.h> | 25 | #include <string.h> |
26 | #include <sys/cdefs.h> | ||
26 | #include <unistd.h> | 27 | #include <unistd.h> |
27 | 28 | ||
28 | #include <cutils/list.h> | 29 | #include <cutils/list.h> |
@@ -34,7 +35,9 @@ | |||
34 | #define min(x,y) ((y) ^ (((x) ^ (y)) & -((x) < (y)))) | 35 | #define min(x,y) ((y) ^ (((x) ^ (y)) & -((x) < (y)))) |
35 | 36 | ||
36 | #define WEAK __attribute__((weak)) | 37 | #define WEAK __attribute__((weak)) |
37 | #define UNUSED __attribute__((unused)) | 38 | #ifndef __unused |
39 | #define __unused __attribute__((unused)) | ||
40 | #endif | ||
38 | 41 | ||
39 | /* Private copy of ../libcutils/socket_local_client.c prevent library loops */ | 42 | /* Private copy of ../libcutils/socket_local_client.c prevent library loops */ |
40 | 43 | ||
@@ -142,11 +145,10 @@ error: | |||
142 | * Used by AndroidSocketImpl | 145 | * Used by AndroidSocketImpl |
143 | */ | 146 | */ |
144 | int WEAK socket_local_client_connect(int fd, const char *name, int namespaceId, | 147 | int WEAK socket_local_client_connect(int fd, const char *name, int namespaceId, |
145 | int type UNUSED) | 148 | int type __unused) |
146 | { | 149 | { |
147 | struct sockaddr_un addr; | 150 | struct sockaddr_un addr; |
148 | socklen_t alen; | 151 | socklen_t alen; |
149 | size_t namelen; | ||
150 | int err; | 152 | int err; |
151 | 153 | ||
152 | err = socket_make_sockaddr_un(name, namespaceId, &addr, &alen); | 154 | err = socket_make_sockaddr_un(name, namespaceId, &addr, &alen); |
@@ -409,7 +411,7 @@ long android_logger_get_log_readable_size(struct logger *logger) | |||
409 | /* | 411 | /* |
410 | * returns the logger version | 412 | * returns the logger version |
411 | */ | 413 | */ |
412 | int android_logger_get_log_version(struct logger *logger UNUSED) | 414 | int android_logger_get_log_version(struct logger *logger __unused) |
413 | { | 415 | { |
414 | return 3; | 416 | return 3; |
415 | } | 417 | } |
@@ -420,7 +422,6 @@ int android_logger_get_log_version(struct logger *logger UNUSED) | |||
420 | ssize_t android_logger_get_statistics(struct logger_list *logger_list, | 422 | ssize_t android_logger_get_statistics(struct logger_list *logger_list, |
421 | char *buf, size_t len) | 423 | char *buf, size_t len) |
422 | { | 424 | { |
423 | struct listnode *node; | ||
424 | struct logger *logger; | 425 | struct logger *logger; |
425 | char *cp = buf; | 426 | char *cp = buf; |
426 | size_t remaining = len; | 427 | size_t remaining = len; |
@@ -440,13 +441,13 @@ ssize_t android_logger_get_statistics(struct logger_list *logger_list, | |||
440 | return send_log_msg(NULL, NULL, buf, len); | 441 | return send_log_msg(NULL, NULL, buf, len); |
441 | } | 442 | } |
442 | 443 | ||
443 | ssize_t android_logger_get_prune_list(struct logger_list *logger_list UNUSED, | 444 | ssize_t android_logger_get_prune_list(struct logger_list *logger_list __unused, |
444 | char *buf, size_t len) | 445 | char *buf, size_t len) |
445 | { | 446 | { |
446 | return send_log_msg(NULL, "getPruneList", buf, len); | 447 | return send_log_msg(NULL, "getPruneList", buf, len); |
447 | } | 448 | } |
448 | 449 | ||
449 | int android_logger_set_prune_list(struct logger_list *logger_list UNUSED, | 450 | int android_logger_set_prune_list(struct logger_list *logger_list __unused, |
450 | char *buf, size_t len) | 451 | char *buf, size_t len) |
451 | { | 452 | { |
452 | const char cmd[] = "setPruneList "; | 453 | const char cmd[] = "setPruneList "; |
@@ -512,9 +513,7 @@ struct logger_list *android_logger_list_alloc_time(int mode, | |||
512 | struct logger *android_logger_open(struct logger_list *logger_list, | 513 | struct logger *android_logger_open(struct logger_list *logger_list, |
513 | log_id_t id) | 514 | log_id_t id) |
514 | { | 515 | { |
515 | struct listnode *node; | ||
516 | struct logger *logger; | 516 | struct logger *logger; |
517 | char *n; | ||
518 | 517 | ||
519 | if (!logger_list || (id >= LOG_ID_MAX)) { | 518 | if (!logger_list || (id >= LOG_ID_MAX)) { |
520 | goto err; | 519 | goto err; |
@@ -561,7 +560,7 @@ struct logger_list *android_logger_list_open(log_id_t id, | |||
561 | return logger_list; | 560 | return logger_list; |
562 | } | 561 | } |
563 | 562 | ||
564 | static void caught_signal(int signum UNUSED) | 563 | static void caught_signal(int signum __unused) |
565 | { | 564 | { |
566 | } | 565 | } |
567 | 566 | ||
diff --git a/liblog/log_read_kern.c b/liblog/log_read_kern.c index 021fe476e..41b8a51a4 100644 --- a/liblog/log_read_kern.c +++ b/liblog/log_read_kern.c | |||
@@ -21,12 +21,13 @@ | |||
21 | #include <string.h> | 21 | #include <string.h> |
22 | #include <stdio.h> | 22 | #include <stdio.h> |
23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
24 | #include <sys/cdefs.h> | ||
25 | #include <sys/ioctl.h> | ||
26 | |||
24 | #include <cutils/list.h> | 27 | #include <cutils/list.h> |
25 | #include <log/log.h> | 28 | #include <log/log.h> |
26 | #include <log/logger.h> | 29 | #include <log/logger.h> |
27 | 30 | ||
28 | #include <sys/ioctl.h> | ||
29 | |||
30 | #define __LOGGERIO 0xAE | 31 | #define __LOGGERIO 0xAE |
31 | 32 | ||
32 | #define LOGGER_GET_LOG_BUF_SIZE _IO(__LOGGERIO, 1) /* size of log */ | 33 | #define LOGGER_GET_LOG_BUF_SIZE _IO(__LOGGERIO, 1) /* size of log */ |
@@ -51,7 +52,9 @@ typedef char bool; | |||
51 | logger != node_to_item(&(logger_list)->node, struct logger, node); \ | 52 | logger != node_to_item(&(logger_list)->node, struct logger, node); \ |
52 | logger = node_to_item((logger)->node.next, struct logger, node)) | 53 | logger = node_to_item((logger)->node.next, struct logger, node)) |
53 | 54 | ||
54 | #define UNUSED __attribute__((unused)) | 55 | #ifndef __unused |
56 | #define __unused __attribute__((unused)) | ||
57 | #endif | ||
55 | 58 | ||
56 | /* In the future, we would like to make this list extensible */ | 59 | /* In the future, we would like to make this list extensible */ |
57 | static const char *LOG_NAME[LOG_ID_MAX] = { | 60 | static const char *LOG_NAME[LOG_ID_MAX] = { |
@@ -233,8 +236,8 @@ long android_logger_get_log_size(struct logger *logger) | |||
233 | return logger_ioctl(logger, LOGGER_GET_LOG_BUF_SIZE, O_RDWR); | 236 | return logger_ioctl(logger, LOGGER_GET_LOG_BUF_SIZE, O_RDWR); |
234 | } | 237 | } |
235 | 238 | ||
236 | int android_logger_set_log_size(struct logger *logger UNUSED, | 239 | int android_logger_set_log_size(struct logger *logger __unused, |
237 | unsigned long size UNUSED) | 240 | unsigned long size __unused) |
238 | { | 241 | { |
239 | return -ENOTSUP; | 242 | return -ENOTSUP; |
240 | } | 243 | } |
@@ -262,21 +265,21 @@ int android_logger_get_log_version(struct logger *logger) | |||
262 | */ | 265 | */ |
263 | static const char unsupported[] = "18\nNot Supported\n\f"; | 266 | static const char unsupported[] = "18\nNot Supported\n\f"; |
264 | 267 | ||
265 | ssize_t android_logger_get_statistics(struct logger_list *logger_list UNUSED, | 268 | ssize_t android_logger_get_statistics(struct logger_list *logger_list __unused, |
266 | char *buf, size_t len) | 269 | char *buf, size_t len) |
267 | { | 270 | { |
268 | strncpy(buf, unsupported, len); | 271 | strncpy(buf, unsupported, len); |
269 | return -ENOTSUP; | 272 | return -ENOTSUP; |
270 | } | 273 | } |
271 | 274 | ||
272 | ssize_t android_logger_get_prune_list(struct logger_list *logger_list UNUSED, | 275 | ssize_t android_logger_get_prune_list(struct logger_list *logger_list __unused, |
273 | char *buf, size_t len) | 276 | char *buf, size_t len) |
274 | { | 277 | { |
275 | strncpy(buf, unsupported, len); | 278 | strncpy(buf, unsupported, len); |
276 | return -ENOTSUP; | 279 | return -ENOTSUP; |
277 | } | 280 | } |
278 | 281 | ||
279 | int android_logger_set_prune_list(struct logger_list *logger_list UNUSED, | 282 | int android_logger_set_prune_list(struct logger_list *logger_list __unused, |
280 | char *buf, size_t len) | 283 | char *buf, size_t len) |
281 | { | 284 | { |
282 | static const char unsupported_error[] = "Unsupported"; | 285 | static const char unsupported_error[] = "Unsupported"; |
@@ -302,7 +305,7 @@ struct logger_list *android_logger_list_alloc(int mode, | |||
302 | } | 305 | } |
303 | 306 | ||
304 | struct logger_list *android_logger_list_alloc_time(int mode, | 307 | struct logger_list *android_logger_list_alloc_time(int mode, |
305 | log_time start UNUSED, | 308 | log_time start __unused, |
306 | pid_t pid) | 309 | pid_t pid) |
307 | { | 310 | { |
308 | return android_logger_list_alloc(mode, 0, pid); | 311 | return android_logger_list_alloc(mode, 0, pid); |
diff --git a/liblog/logd_write.c b/liblog/logd_write.c index 4c47382e2..121d84dff 100644 --- a/liblog/logd_write.c +++ b/liblog/logd_write.c | |||
@@ -49,12 +49,15 @@ static int (*write_to_log)(log_id_t, struct iovec *vec, size_t nr) = __write_to_ | |||
49 | static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER; | 49 | static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER; |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | #define UNUSED __attribute__((__unused__)) | 52 | #ifndef __unused |
53 | #define __unused __attribute__((__unused__)) | ||
54 | #endif | ||
53 | 55 | ||
54 | static int logd_fd = -1; | ||
55 | #if FAKE_LOG_DEVICE | 56 | #if FAKE_LOG_DEVICE |
56 | #define WEAK __attribute__((weak)) | 57 | #define WEAK __attribute__((weak)) |
57 | static int log_fds[(int)LOG_ID_MAX] = { -1, -1, -1, -1, -1 }; | 58 | static int log_fds[(int)LOG_ID_MAX] = { -1, -1, -1, -1, -1 }; |
59 | #else | ||
60 | static int logd_fd = -1; | ||
58 | #endif | 61 | #endif |
59 | 62 | ||
60 | /* | 63 | /* |
@@ -77,12 +80,14 @@ int __android_log_dev_available(void) | |||
77 | return (g_log_status == kLogAvailable); | 80 | return (g_log_status == kLogAvailable); |
78 | } | 81 | } |
79 | 82 | ||
83 | #if !FAKE_LOG_DEVICE | ||
80 | /* give up, resources too limited */ | 84 | /* give up, resources too limited */ |
81 | static int __write_to_log_null(log_id_t log_fd UNUSED, struct iovec *vec UNUSED, | 85 | static int __write_to_log_null(log_id_t log_fd __unused, struct iovec *vec __unused, |
82 | size_t nr UNUSED) | 86 | size_t nr __unused) |
83 | { | 87 | { |
84 | return -1; | 88 | return -1; |
85 | } | 89 | } |
90 | #endif | ||
86 | 91 | ||
87 | /* log_init_lock assumed */ | 92 | /* log_init_lock assumed */ |
88 | static int __write_to_log_initialize() | 93 | static int __write_to_log_initialize() |
diff --git a/liblog/logd_write_kern.c b/liblog/logd_write_kern.c index 982beaaed..1d107481d 100644 --- a/liblog/logd_write_kern.c +++ b/liblog/logd_write_kern.c | |||
@@ -57,7 +57,9 @@ static int (*write_to_log)(log_id_t, struct iovec *vec, size_t nr) = __write_to_ | |||
57 | static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER; | 57 | static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER; |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #define UNUSED __attribute__((__unused__)) | 60 | #ifndef __unused |
61 | #define __unused __attribute__((__unused__)) | ||
62 | #endif | ||
61 | 63 | ||
62 | static int log_fds[(int)LOG_ID_MAX] = { -1, -1, -1, -1 }; | 64 | static int log_fds[(int)LOG_ID_MAX] = { -1, -1, -1, -1 }; |
63 | 65 | ||
@@ -81,8 +83,8 @@ int __android_log_dev_available(void) | |||
81 | return (g_log_status == kLogAvailable); | 83 | return (g_log_status == kLogAvailable); |
82 | } | 84 | } |
83 | 85 | ||
84 | static int __write_to_log_null(log_id_t log_fd UNUSED, struct iovec *vec UNUSED, | 86 | static int __write_to_log_null(log_id_t log_fd __unused, struct iovec *vec __unused, |
85 | size_t nr UNUSED) | 87 | size_t nr __unused) |
86 | { | 88 | { |
87 | return -1; | 89 | return -1; |
88 | } | 90 | } |
diff --git a/liblog/logprint.c b/liblog/logprint.c index 3bc9f5a67..08e830acc 100644 --- a/liblog/logprint.c +++ b/liblog/logprint.c | |||
@@ -17,14 +17,14 @@ | |||
17 | 17 | ||
18 | #define _GNU_SOURCE /* for asprintf */ | 18 | #define _GNU_SOURCE /* for asprintf */ |
19 | 19 | ||
20 | #include <arpa/inet.h> | ||
21 | #include <assert.h> | ||
20 | #include <ctype.h> | 22 | #include <ctype.h> |
21 | #include <stdio.h> | ||
22 | #include <errno.h> | 23 | #include <errno.h> |
23 | #include <stdlib.h> | ||
24 | #include <stdint.h> | 24 | #include <stdint.h> |
25 | #include <stdio.h> | ||
26 | #include <stdlib.h> | ||
25 | #include <string.h> | 27 | #include <string.h> |
26 | #include <assert.h> | ||
27 | #include <arpa/inet.h> | ||
28 | 28 | ||
29 | #include <log/logd.h> | 29 | #include <log/logd.h> |
30 | #include <log/logprint.h> | 30 | #include <log/logprint.h> |
@@ -52,15 +52,7 @@ static FilterInfo * filterinfo_new(const char * tag, android_LogPriority pri) | |||
52 | return p_ret; | 52 | return p_ret; |
53 | } | 53 | } |
54 | 54 | ||
55 | static void filterinfo_free(FilterInfo *p_info) | 55 | /* balance to above, filterinfo_free left unimplemented */ |
56 | { | ||
57 | if (p_info == NULL) { | ||
58 | return; | ||
59 | } | ||
60 | |||
61 | free(p_info->mTag); | ||
62 | p_info->mTag = NULL; | ||
63 | } | ||
64 | 56 | ||
65 | /* | 57 | /* |
66 | * Note: also accepts 0-9 priorities | 58 | * Note: also accepts 0-9 priorities |
@@ -139,23 +131,6 @@ static android_LogPriority filterPriForTag( | |||
139 | return p_format->global_pri; | 131 | return p_format->global_pri; |
140 | } | 132 | } |
141 | 133 | ||
142 | /** for debugging */ | ||
143 | static void dumpFilters(AndroidLogFormat *p_format) | ||
144 | { | ||
145 | FilterInfo *p_fi; | ||
146 | |||
147 | for (p_fi = p_format->filters ; p_fi != NULL ; p_fi = p_fi->p_next) { | ||
148 | char cPri = filterPriToChar(p_fi->mPri); | ||
149 | if (p_fi->mPri == ANDROID_LOG_DEFAULT) { | ||
150 | cPri = filterPriToChar(p_format->global_pri); | ||
151 | } | ||
152 | fprintf(stderr,"%s:%c\n", p_fi->mTag, cPri); | ||
153 | } | ||
154 | |||
155 | fprintf(stderr,"*:%c\n", filterPriToChar(p_format->global_pri)); | ||
156 | |||
157 | } | ||
158 | |||
159 | /** | 134 | /** |
160 | * returns 1 if this log line should be printed based on its priority | 135 | * returns 1 if this log line should be printed based on its priority |
161 | * and tag, and 0 if it should not | 136 | * and tag, and 0 if it should not |
@@ -234,7 +209,6 @@ AndroidLogPrintFormat android_log_formatFromString(const char * formatString) | |||
234 | int android_log_addFilterRule(AndroidLogFormat *p_format, | 209 | int android_log_addFilterRule(AndroidLogFormat *p_format, |
235 | const char *filterExpression) | 210 | const char *filterExpression) |
236 | { | 211 | { |
237 | size_t i=0; | ||
238 | size_t tagNameLength; | 212 | size_t tagNameLength; |
239 | android_LogPriority pri = ANDROID_LOG_DEFAULT; | 213 | android_LogPriority pri = ANDROID_LOG_DEFAULT; |
240 | 214 | ||
@@ -718,7 +692,6 @@ char *android_log_formatLogLine ( | |||
718 | #endif | 692 | #endif |
719 | struct tm* ptm; | 693 | struct tm* ptm; |
720 | char timeBuf[32]; | 694 | char timeBuf[32]; |
721 | char headerBuf[128]; | ||
722 | char prefixBuf[128], suffixBuf[128]; | 695 | char prefixBuf[128], suffixBuf[128]; |
723 | char priChar; | 696 | char priChar; |
724 | int prefixSuffixIsHeaderFooter = 0; | 697 | int prefixSuffixIsHeaderFooter = 0; |
@@ -817,7 +790,6 @@ char *android_log_formatLogLine ( | |||
817 | /* the following code is tragically unreadable */ | 790 | /* the following code is tragically unreadable */ |
818 | 791 | ||
819 | size_t numLines; | 792 | size_t numLines; |
820 | size_t i; | ||
821 | char *p; | 793 | char *p; |
822 | size_t bufferSize; | 794 | size_t bufferSize; |
823 | const char *pm; | 795 | const char *pm; |
diff --git a/liblog/tests/liblog_benchmark.cpp b/liblog/tests/liblog_benchmark.cpp index 39fe2ad84..549d79eb4 100644 --- a/liblog/tests/liblog_benchmark.cpp +++ b/liblog/tests/liblog_benchmark.cpp | |||
@@ -99,7 +99,7 @@ static void BM_log_overhead(int iters) { | |||
99 | } | 99 | } |
100 | BENCHMARK(BM_log_overhead); | 100 | BENCHMARK(BM_log_overhead); |
101 | 101 | ||
102 | static void caught_latency(int signum) | 102 | static void caught_latency(int /*signum*/) |
103 | { | 103 | { |
104 | unsigned long long v = 0xDEADBEEFA55A5AA5ULL; | 104 | unsigned long long v = 0xDEADBEEFA55A5AA5ULL; |
105 | 105 | ||
@@ -193,7 +193,7 @@ static void BM_log_latency(int iters) { | |||
193 | } | 193 | } |
194 | BENCHMARK(BM_log_latency); | 194 | BENCHMARK(BM_log_latency); |
195 | 195 | ||
196 | static void caught_delay(int signum) | 196 | static void caught_delay(int /*signum*/) |
197 | { | 197 | { |
198 | unsigned long long v = 0xDEADBEEFA55A5AA6ULL; | 198 | unsigned long long v = 0xDEADBEEFA55A5AA6ULL; |
199 | 199 | ||
diff --git a/liblog/tests/liblog_test.cpp b/liblog/tests/liblog_test.cpp index c6f981f58..ec35e4536 100644 --- a/liblog/tests/liblog_test.cpp +++ b/liblog/tests/liblog_test.cpp | |||
@@ -164,7 +164,7 @@ TEST(liblog, __android_log_btwrite__android_logger_list_read) { | |||
164 | static unsigned signaled; | 164 | static unsigned signaled; |
165 | log_time signal_time; | 165 | log_time signal_time; |
166 | 166 | ||
167 | static void caught_blocking(int signum) | 167 | static void caught_blocking(int /*signum*/) |
168 | { | 168 | { |
169 | unsigned long long v = 0xDEADBEEFA55A0000ULL; | 169 | unsigned long long v = 0xDEADBEEFA55A0000ULL; |
170 | 170 | ||