liblog: remove unneeded checks and includes from headers
Test: build
Change-Id: Ifa3cffe60120fcc30a37239ceb2db46202a03471
diff --git a/liblog/include/log/event_tag_map.h b/liblog/include/log/event_tag_map.h
index 2687b3a..f7ec208 100644
--- a/liblog/include/log/event_tag_map.h
+++ b/liblog/include/log/event_tag_map.h
@@ -16,6 +16,8 @@
#pragma once
+#include <stddef.h>
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/liblog/include/log/log.h b/liblog/include/log/log.h
index 5928649..90d1e76 100644
--- a/liblog/include/log/log.h
+++ b/liblog/include/log/log.h
@@ -22,7 +22,6 @@
#endif
#include <stdint.h> /* uint16_t, int32_t */
#include <stdio.h>
-#include <sys/types.h>
#include <time.h>
#include <unistd.h>
@@ -65,21 +64,6 @@
#endif
#endif
-/* --------------------------------------------------------------------- */
-
-/*
- * This file uses ", ## __VA_ARGS__" zero-argument token pasting to
- * work around issues with debug-only syntax errors in assertions
- * that are missing format strings. See commit
- * 19299904343daf191267564fe32e6cd5c165cd42
- */
-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
-#endif
-
-/* --------------------------------------------------------------------- */
-
/*
* Event logging.
*/
@@ -164,10 +148,6 @@
*/
void __android_log_close(void);
-#if defined(__clang__)
-#pragma clang diagnostic pop
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/liblog/include/log/log_event_list.h b/liblog/include/log/log_event_list.h
index 636d417..deadf20 100644
--- a/liblog/include/log/log_event_list.h
+++ b/liblog/include/log/log_event_list.h
@@ -36,16 +36,11 @@
/*
* The opaque context used to manipulate lists of events.
*/
-#ifndef __android_log_context_defined
-#define __android_log_context_defined
typedef struct android_log_context_internal* android_log_context;
-#endif
/*
* Elements returned when reading a list of events.
*/
-#ifndef __android_log_list_element_defined
-#define __android_log_list_element_defined
typedef struct {
AndroidEventLogType type;
uint16_t complete;
@@ -57,7 +52,6 @@
float float32;
} data;
} android_log_list_element;
-#endif
/*
* Creates a context associated with an event tag to write elements to
@@ -104,8 +98,6 @@
int android_log_destroy(android_log_context* ctx);
#ifdef __cplusplus
-#ifndef __class_android_log_event_list_defined
-#define __class_android_log_event_list_defined
/* android_log_list C++ helpers */
extern "C++" {
class android_log_event_list {
@@ -280,7 +272,6 @@
};
}
#endif
-#endif
#ifdef __cplusplus
}
diff --git a/liblog/include/log/log_read.h b/liblog/include/log/log_read.h
index fdef306..2079e7a 100644
--- a/liblog/include/log/log_read.h
+++ b/liblog/include/log/log_read.h
@@ -53,8 +53,6 @@
/*
* The userspace structure for version 1 of the logger_entry ABI.
*/
-#ifndef __struct_logger_entry_defined
-#define __struct_logger_entry_defined
struct logger_entry {
uint16_t len; /* length of the payload */
uint16_t __pad; /* no matter what, we get 2 bytes of padding */
@@ -64,13 +62,10 @@
int32_t nsec; /* nanoseconds */
char msg[0]; /* the entry's payload */
};
-#endif
/*
* The userspace structure for version 2 of the logger_entry ABI.
*/
-#ifndef __struct_logger_entry_v2_defined
-#define __struct_logger_entry_v2_defined
struct logger_entry_v2 {
uint16_t len; /* length of the payload */
uint16_t hdr_size; /* sizeof(struct logger_entry_v2) */
@@ -81,13 +76,10 @@
uint32_t euid; /* effective UID of logger */
char msg[0]; /* the entry's payload */
} __attribute__((__packed__));
-#endif
/*
* The userspace structure for version 3 of the logger_entry ABI.
*/
-#ifndef __struct_logger_entry_v3_defined
-#define __struct_logger_entry_v3_defined
struct logger_entry_v3 {
uint16_t len; /* length of the payload */
uint16_t hdr_size; /* sizeof(struct logger_entry_v3) */
@@ -98,13 +90,10 @@
uint32_t lid; /* log id of the payload */
char msg[0]; /* the entry's payload */
} __attribute__((__packed__));
-#endif
/*
* The userspace structure for version 4 of the logger_entry ABI.
*/
-#ifndef __struct_logger_entry_v4_defined
-#define __struct_logger_entry_v4_defined
struct logger_entry_v4 {
uint16_t len; /* length of the payload */
uint16_t hdr_size; /* sizeof(struct logger_entry_v4) */
@@ -116,7 +105,6 @@
uint32_t uid; /* generating process's uid */
char msg[0]; /* the entry's payload */
};
-#endif
#pragma clang diagnostic pop
/*
@@ -133,8 +121,6 @@
*/
#define LOGGER_ENTRY_MAX_LEN (5 * 1024)
-#ifndef __struct_log_msg_defined
-#define __struct_log_msg_defined
struct log_msg {
union {
unsigned char buf[LOGGER_ENTRY_MAX_LEN + 1];
@@ -191,7 +177,6 @@
}
#endif
};
-#endif
struct logger;
diff --git a/liblog/include/log/log_time.h b/liblog/include/log/log_time.h
index 09c9910..1d05c9e 100644
--- a/liblog/include/log/log_time.h
+++ b/liblog/include/log/log_time.h
@@ -24,9 +24,6 @@
#define US_PER_SEC 1000000ULL
#define MS_PER_SEC 1000ULL
-#ifndef __struct_log_time_defined
-#define __struct_log_time_defined
-
#define LOG_TIME_SEC(t) ((t)->tv_sec)
/* next power of two after NS_PER_SEC */
#define LOG_TIME_NSEC(t) ((t)->tv_nsec & (UINT32_MAX >> 2))
@@ -169,5 +166,3 @@
} __attribute__((__packed__)) log_time;
#endif /* __cplusplus */
-
-#endif /* __struct_log_time_defined */
diff --git a/liblog/include/log/logprint.h b/liblog/include/log/logprint.h
index 8f4b187..7dfd914 100644
--- a/liblog/include/log/logprint.h
+++ b/liblog/include/log/logprint.h
@@ -16,7 +16,8 @@
#pragma once
-#include <pthread.h>
+#include <stdint.h>
+#include <sys/types.h>
#include <android/log.h>
#include <log/event_tag_map.h>
diff --git a/liblog/tests/liblog_benchmark.cpp b/liblog/tests/liblog_benchmark.cpp
index 4642b9b..56892a2 100644
--- a/liblog/tests/liblog_benchmark.cpp
+++ b/liblog/tests/liblog_benchmark.cpp
@@ -17,6 +17,7 @@
#include <fcntl.h>
#include <inttypes.h>
#include <poll.h>
+#include <sched.h>
#include <sys/socket.h>
#include <sys/syscall.h>
#include <sys/types.h>