am 9318e4d9: Merge "liblog: set -Werror"
* commit '9318e4d9f88f99ead5ed039952ef68bdaf9a1b8e': liblog: set -Werror
This commit is contained in:
commit
d4bb311062
|
@ -57,7 +57,7 @@ endif
|
|||
# ========================================================
|
||||
LOCAL_MODULE := liblog
|
||||
LOCAL_SRC_FILES := $(liblog_host_sources)
|
||||
LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1
|
||||
LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1 -Werror
|
||||
include $(BUILD_HOST_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
@ -74,7 +74,7 @@ include $(BUILD_HOST_SHARED_LIBRARY)
|
|||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := lib64log
|
||||
LOCAL_SRC_FILES := $(liblog_host_sources)
|
||||
LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1 -m64
|
||||
LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1 -m64 -Werror
|
||||
include $(BUILD_HOST_STATIC_LIBRARY)
|
||||
|
||||
# Shared and static library for target
|
||||
|
@ -82,13 +82,13 @@ include $(BUILD_HOST_STATIC_LIBRARY)
|
|||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := liblog
|
||||
LOCAL_SRC_FILES := $(liblog_target_sources)
|
||||
LOCAL_CFLAGS := $(liblog_cflags)
|
||||
LOCAL_CFLAGS := -Werror
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := liblog
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := liblog
|
||||
LOCAL_CFLAGS := $(liblog_cflags)
|
||||
LOCAL_CFLAGS := -Werror
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
include $(call first-makefiles-under,$(LOCAL_PATH))
|
||||
|
|
|
@ -13,15 +13,16 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include <log/event_tag_map.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <log/event_tag_map.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#define OUT_TAG "EventTagMap"
|
||||
|
||||
|
@ -52,7 +53,6 @@ static int countMapLines(const EventTagMap* map);
|
|||
static int parseMapLines(EventTagMap* map);
|
||||
static int scanTagLine(char** pData, EventTag* tag, int lineNum);
|
||||
static int sortTags(EventTagMap* map);
|
||||
static void dumpTags(const EventTagMap* map);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -185,8 +185,6 @@ static inline int isCharDigit(char c)
|
|||
*/
|
||||
static int processFile(EventTagMap* map)
|
||||
{
|
||||
EventTag* tagArray = NULL;
|
||||
|
||||
/* get a tag count */
|
||||
map->numTags = countMapLines(map);
|
||||
if (map->numTags < 0)
|
||||
|
@ -422,17 +420,3 @@ static int sortTags(EventTagMap* map)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Dump the tag array for debugging.
|
||||
*/
|
||||
static void dumpTags(const EventTagMap* map)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < map->numTags; i++) {
|
||||
const EventTag* tag = &map->tagArray[i];
|
||||
printf(" %3d: %6d '%s'\n", i, tag->tagIndex, tag->tagStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,18 +21,22 @@
|
|||
*/
|
||||
#include "fake_log_device.h"
|
||||
|
||||
#include <log/logd.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <log/logd.h>
|
||||
|
||||
#ifdef HAVE_PTHREADS
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#ifndef __unused
|
||||
#define __unused __attribute__((__unused__))
|
||||
#endif
|
||||
|
||||
#define kMaxTagLen 16 /* from the long-dead utils/Log.cpp */
|
||||
|
||||
#define kTagSetSize 16 /* arbitrary */
|
||||
|
@ -613,7 +617,7 @@ static int logClose(int fd)
|
|||
/*
|
||||
* Open a log output device and return a fake fd.
|
||||
*/
|
||||
static int logOpen(const char* pathName, int flags)
|
||||
static int logOpen(const char* pathName, int flags __unused)
|
||||
{
|
||||
LogState *logState;
|
||||
int fd = -1;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#define NOMINMAX /* for windows to suppress definition of min in stdlib.h */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cutils/list.h>
|
||||
|
@ -34,7 +35,9 @@
|
|||
#define min(x,y) ((y) ^ (((x) ^ (y)) & -((x) < (y))))
|
||||
|
||||
#define WEAK __attribute__((weak))
|
||||
#define UNUSED __attribute__((unused))
|
||||
#ifndef __unused
|
||||
#define __unused __attribute__((unused))
|
||||
#endif
|
||||
|
||||
/* Private copy of ../libcutils/socket_local_client.c prevent library loops */
|
||||
|
||||
|
@ -142,11 +145,10 @@ error:
|
|||
* Used by AndroidSocketImpl
|
||||
*/
|
||||
int WEAK socket_local_client_connect(int fd, const char *name, int namespaceId,
|
||||
int type UNUSED)
|
||||
int type __unused)
|
||||
{
|
||||
struct sockaddr_un addr;
|
||||
socklen_t alen;
|
||||
size_t namelen;
|
||||
int err;
|
||||
|
||||
err = socket_make_sockaddr_un(name, namespaceId, &addr, &alen);
|
||||
|
@ -409,7 +411,7 @@ long android_logger_get_log_readable_size(struct logger *logger)
|
|||
/*
|
||||
* returns the logger version
|
||||
*/
|
||||
int android_logger_get_log_version(struct logger *logger UNUSED)
|
||||
int android_logger_get_log_version(struct logger *logger __unused)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
@ -420,7 +422,6 @@ int android_logger_get_log_version(struct logger *logger UNUSED)
|
|||
ssize_t android_logger_get_statistics(struct logger_list *logger_list,
|
||||
char *buf, size_t len)
|
||||
{
|
||||
struct listnode *node;
|
||||
struct logger *logger;
|
||||
char *cp = buf;
|
||||
size_t remaining = len;
|
||||
|
@ -440,13 +441,13 @@ ssize_t android_logger_get_statistics(struct logger_list *logger_list,
|
|||
return send_log_msg(NULL, NULL, buf, len);
|
||||
}
|
||||
|
||||
ssize_t android_logger_get_prune_list(struct logger_list *logger_list UNUSED,
|
||||
ssize_t android_logger_get_prune_list(struct logger_list *logger_list __unused,
|
||||
char *buf, size_t len)
|
||||
{
|
||||
return send_log_msg(NULL, "getPruneList", buf, len);
|
||||
}
|
||||
|
||||
int android_logger_set_prune_list(struct logger_list *logger_list UNUSED,
|
||||
int android_logger_set_prune_list(struct logger_list *logger_list __unused,
|
||||
char *buf, size_t len)
|
||||
{
|
||||
const char cmd[] = "setPruneList ";
|
||||
|
@ -512,9 +513,7 @@ struct logger_list *android_logger_list_alloc_time(int mode,
|
|||
struct logger *android_logger_open(struct logger_list *logger_list,
|
||||
log_id_t id)
|
||||
{
|
||||
struct listnode *node;
|
||||
struct logger *logger;
|
||||
char *n;
|
||||
|
||||
if (!logger_list || (id >= LOG_ID_MAX)) {
|
||||
goto err;
|
||||
|
@ -561,7 +560,7 @@ struct logger_list *android_logger_list_open(log_id_t id,
|
|||
return logger_list;
|
||||
}
|
||||
|
||||
static void caught_signal(int signum UNUSED)
|
||||
static void caught_signal(int signum __unused)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -21,12 +21,13 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <cutils/list.h>
|
||||
#include <log/log.h>
|
||||
#include <log/logger.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#define __LOGGERIO 0xAE
|
||||
|
||||
#define LOGGER_GET_LOG_BUF_SIZE _IO(__LOGGERIO, 1) /* size of log */
|
||||
|
@ -51,7 +52,9 @@ typedef char bool;
|
|||
logger != node_to_item(&(logger_list)->node, struct logger, node); \
|
||||
logger = node_to_item((logger)->node.next, struct logger, node))
|
||||
|
||||
#define UNUSED __attribute__((unused))
|
||||
#ifndef __unused
|
||||
#define __unused __attribute__((unused))
|
||||
#endif
|
||||
|
||||
/* In the future, we would like to make this list extensible */
|
||||
static const char *LOG_NAME[LOG_ID_MAX] = {
|
||||
|
@ -233,8 +236,8 @@ long android_logger_get_log_size(struct logger *logger)
|
|||
return logger_ioctl(logger, LOGGER_GET_LOG_BUF_SIZE, O_RDWR);
|
||||
}
|
||||
|
||||
int android_logger_set_log_size(struct logger *logger UNUSED,
|
||||
unsigned long size UNUSED)
|
||||
int android_logger_set_log_size(struct logger *logger __unused,
|
||||
unsigned long size __unused)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
@ -262,21 +265,21 @@ int android_logger_get_log_version(struct logger *logger)
|
|||
*/
|
||||
static const char unsupported[] = "18\nNot Supported\n\f";
|
||||
|
||||
ssize_t android_logger_get_statistics(struct logger_list *logger_list UNUSED,
|
||||
ssize_t android_logger_get_statistics(struct logger_list *logger_list __unused,
|
||||
char *buf, size_t len)
|
||||
{
|
||||
strncpy(buf, unsupported, len);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
ssize_t android_logger_get_prune_list(struct logger_list *logger_list UNUSED,
|
||||
ssize_t android_logger_get_prune_list(struct logger_list *logger_list __unused,
|
||||
char *buf, size_t len)
|
||||
{
|
||||
strncpy(buf, unsupported, len);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
int android_logger_set_prune_list(struct logger_list *logger_list UNUSED,
|
||||
int android_logger_set_prune_list(struct logger_list *logger_list __unused,
|
||||
char *buf, size_t len)
|
||||
{
|
||||
static const char unsupported_error[] = "Unsupported";
|
||||
|
@ -302,7 +305,7 @@ struct logger_list *android_logger_list_alloc(int mode,
|
|||
}
|
||||
|
||||
struct logger_list *android_logger_list_alloc_time(int mode,
|
||||
log_time start UNUSED,
|
||||
log_time start __unused,
|
||||
pid_t pid)
|
||||
{
|
||||
return android_logger_list_alloc(mode, 0, pid);
|
||||
|
|
|
@ -49,12 +49,15 @@ static int (*write_to_log)(log_id_t, struct iovec *vec, size_t nr) = __write_to_
|
|||
static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
#endif
|
||||
|
||||
#define UNUSED __attribute__((__unused__))
|
||||
#ifndef __unused
|
||||
#define __unused __attribute__((__unused__))
|
||||
#endif
|
||||
|
||||
static int logd_fd = -1;
|
||||
#if FAKE_LOG_DEVICE
|
||||
#define WEAK __attribute__((weak))
|
||||
static int log_fds[(int)LOG_ID_MAX] = { -1, -1, -1, -1, -1 };
|
||||
#else
|
||||
static int logd_fd = -1;
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -77,12 +80,14 @@ int __android_log_dev_available(void)
|
|||
return (g_log_status == kLogAvailable);
|
||||
}
|
||||
|
||||
#if !FAKE_LOG_DEVICE
|
||||
/* give up, resources too limited */
|
||||
static int __write_to_log_null(log_id_t log_fd UNUSED, struct iovec *vec UNUSED,
|
||||
size_t nr UNUSED)
|
||||
static int __write_to_log_null(log_id_t log_fd __unused, struct iovec *vec __unused,
|
||||
size_t nr __unused)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* log_init_lock assumed */
|
||||
static int __write_to_log_initialize()
|
||||
|
|
|
@ -57,7 +57,9 @@ static int (*write_to_log)(log_id_t, struct iovec *vec, size_t nr) = __write_to_
|
|||
static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
#endif
|
||||
|
||||
#define UNUSED __attribute__((__unused__))
|
||||
#ifndef __unused
|
||||
#define __unused __attribute__((__unused__))
|
||||
#endif
|
||||
|
||||
static int log_fds[(int)LOG_ID_MAX] = { -1, -1, -1, -1 };
|
||||
|
||||
|
@ -81,8 +83,8 @@ int __android_log_dev_available(void)
|
|||
return (g_log_status == kLogAvailable);
|
||||
}
|
||||
|
||||
static int __write_to_log_null(log_id_t log_fd UNUSED, struct iovec *vec UNUSED,
|
||||
size_t nr UNUSED)
|
||||
static int __write_to_log_null(log_id_t log_fd __unused, struct iovec *vec __unused,
|
||||
size_t nr __unused)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -17,14 +17,14 @@
|
|||
|
||||
#define _GNU_SOURCE /* for asprintf */
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <log/logd.h>
|
||||
#include <log/logprint.h>
|
||||
|
@ -52,15 +52,7 @@ static FilterInfo * filterinfo_new(const char * tag, android_LogPriority pri)
|
|||
return p_ret;
|
||||
}
|
||||
|
||||
static void filterinfo_free(FilterInfo *p_info)
|
||||
{
|
||||
if (p_info == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
free(p_info->mTag);
|
||||
p_info->mTag = NULL;
|
||||
}
|
||||
/* balance to above, filterinfo_free left unimplemented */
|
||||
|
||||
/*
|
||||
* Note: also accepts 0-9 priorities
|
||||
|
@ -139,23 +131,6 @@ static android_LogPriority filterPriForTag(
|
|||
return p_format->global_pri;
|
||||
}
|
||||
|
||||
/** for debugging */
|
||||
static void dumpFilters(AndroidLogFormat *p_format)
|
||||
{
|
||||
FilterInfo *p_fi;
|
||||
|
||||
for (p_fi = p_format->filters ; p_fi != NULL ; p_fi = p_fi->p_next) {
|
||||
char cPri = filterPriToChar(p_fi->mPri);
|
||||
if (p_fi->mPri == ANDROID_LOG_DEFAULT) {
|
||||
cPri = filterPriToChar(p_format->global_pri);
|
||||
}
|
||||
fprintf(stderr,"%s:%c\n", p_fi->mTag, cPri);
|
||||
}
|
||||
|
||||
fprintf(stderr,"*:%c\n", filterPriToChar(p_format->global_pri));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* returns 1 if this log line should be printed based on its priority
|
||||
* and tag, and 0 if it should not
|
||||
|
@ -234,7 +209,6 @@ AndroidLogPrintFormat android_log_formatFromString(const char * formatString)
|
|||
int android_log_addFilterRule(AndroidLogFormat *p_format,
|
||||
const char *filterExpression)
|
||||
{
|
||||
size_t i=0;
|
||||
size_t tagNameLength;
|
||||
android_LogPriority pri = ANDROID_LOG_DEFAULT;
|
||||
|
||||
|
@ -718,7 +692,6 @@ char *android_log_formatLogLine (
|
|||
#endif
|
||||
struct tm* ptm;
|
||||
char timeBuf[32];
|
||||
char headerBuf[128];
|
||||
char prefixBuf[128], suffixBuf[128];
|
||||
char priChar;
|
||||
int prefixSuffixIsHeaderFooter = 0;
|
||||
|
@ -817,7 +790,6 @@ char *android_log_formatLogLine (
|
|||
/* the following code is tragically unreadable */
|
||||
|
||||
size_t numLines;
|
||||
size_t i;
|
||||
char *p;
|
||||
size_t bufferSize;
|
||||
const char *pm;
|
||||
|
|
|
@ -99,7 +99,7 @@ static void BM_log_overhead(int iters) {
|
|||
}
|
||||
BENCHMARK(BM_log_overhead);
|
||||
|
||||
static void caught_latency(int signum)
|
||||
static void caught_latency(int /*signum*/)
|
||||
{
|
||||
unsigned long long v = 0xDEADBEEFA55A5AA5ULL;
|
||||
|
||||
|
@ -193,7 +193,7 @@ static void BM_log_latency(int iters) {
|
|||
}
|
||||
BENCHMARK(BM_log_latency);
|
||||
|
||||
static void caught_delay(int signum)
|
||||
static void caught_delay(int /*signum*/)
|
||||
{
|
||||
unsigned long long v = 0xDEADBEEFA55A5AA6ULL;
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ TEST(liblog, __android_log_btwrite__android_logger_list_read) {
|
|||
static unsigned signaled;
|
||||
log_time signal_time;
|
||||
|
||||
static void caught_blocking(int signum)
|
||||
static void caught_blocking(int /*signum*/)
|
||||
{
|
||||
unsigned long long v = 0xDEADBEEFA55A0000ULL;
|
||||
|
||||
|
|
Loading…
Reference in New Issue