From 1e1b9155f4feee5295b79616363ef76d3d07d35f Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Tue, 15 Jan 2019 17:25:35 -0800 Subject: [PATCH] Remove __ANDROID_USE_LIBLOG_* guards These headers are platforms headers, so by definition they'll never be compiled for a platform less than the current one. Test: build Change-Id: Ic1c1535b935929d713806faf17fbf9cd82275329 --- liblog/include/log/log.h | 44 ------------------------ liblog/include/log/log_event_list.h | 14 -------- liblog/include/log/log_main.h | 42 ++-------------------- liblog/include/log/log_properties.h | 12 ------- liblog/include/log/log_read.h | 24 ------------- liblog/include/log/log_safetynet.h | 14 -------- liblog/include_vndk/log/log_event_list.h | 2 -- 7 files changed, 3 insertions(+), 149 deletions(-) diff --git a/liblog/include/log/log.h b/liblog/include/log/log.h index 3813e6e32..544b3a640 100644 --- a/liblog/include/log/log.h +++ b/liblog/include/log/log.h @@ -152,35 +152,12 @@ typedef enum { #ifdef __linux__ -#ifndef __ANDROID_USE_LIBLOG_CLOCK_INTERFACE -#ifndef __ANDROID_API__ -#define __ANDROID_USE_LIBLOG_CLOCK_INTERFACE 1 -#elif __ANDROID_API__ > 22 /* > Lollipop */ -#define __ANDROID_USE_LIBLOG_CLOCK_INTERFACE 1 -#else -#define __ANDROID_USE_LIBLOG_CLOCK_INTERFACE 0 -#endif -#endif - -#if __ANDROID_USE_LIBLOG_CLOCK_INTERFACE clockid_t android_log_clockid(void); -#endif #endif /* __linux__ */ /* --------------------------------------------------------------------- */ -#ifndef __ANDROID_USE_LIBLOG_CLOSE_INTERFACE -#ifndef __ANDROID_API__ -#define __ANDROID_USE_LIBLOG_CLOSE_INTERFACE 1 -#elif __ANDROID_API__ > 18 /* > JellyBean */ -#define __ANDROID_USE_LIBLOG_CLOSE_INTERFACE 1 -#else -#define __ANDROID_USE_LIBLOG_CLOSE_INTERFACE 0 -#endif -#endif - -#if __ANDROID_USE_LIBLOG_CLOSE_INTERFACE /* * Release any logger resources (a new log write will immediately re-acquire) * @@ -188,19 +165,6 @@ clockid_t android_log_clockid(void); * all O_CLOEXEC so wil self clean on exec(). */ void __android_log_close(void); -#endif - -#ifndef __ANDROID_USE_LIBLOG_RATELIMIT_INTERFACE -#ifndef __ANDROID_API__ -#define __ANDROID_USE_LIBLOG_RATELIMIT_INTERFACE 1 -#elif __ANDROID_API__ > 25 /* > OC */ -#define __ANDROID_USE_LIBLOG_RATELIMIT_INTERFACE 1 -#else -#define __ANDROID_USE_LIBLOG_RATELIMIT_INTERFACE 0 -#endif -#endif - -#if __ANDROID_USE_LIBLOG_RATELIMIT_INTERFACE /* * if last is NULL, caller _must_ provide a consistent value for seconds. @@ -229,14 +193,6 @@ int __android_log_ratelimit(time_t seconds, time_t* last); #define IF_ALOG_RATELIMIT_LOCAL(seconds, state) \ if (__android_log_ratelimit(seconds, state) > 0) -#else - -/* No ratelimiting as API unsupported */ -#define IF_ALOG_RATELIMIT() if (1) -#define IF_ALOG_RATELIMIT_LOCAL(...) if (1) - -#endif - #if defined(__clang__) #pragma clang diagnostic pop #endif diff --git a/liblog/include/log/log_event_list.h b/liblog/include/log/log_event_list.h index 1b7c37717..4dd3de34c 100644 --- a/liblog/include/log/log_event_list.h +++ b/liblog/include/log/log_event_list.h @@ -32,18 +32,6 @@ extern "C++" { extern "C" { #endif -#ifndef __ANDROID_USE_LIBLOG_EVENT_INTERFACE -#ifndef __ANDROID_API__ -#define __ANDROID_USE_LIBLOG_EVENT_INTERFACE 1 -#elif __ANDROID_API__ > 23 /* > Marshmallow */ -#define __ANDROID_USE_LIBLOG_EVENT_INTERFACE 1 -#else -#define __ANDROID_USE_LIBLOG_EVENT_INTERFACE 0 -#endif -#endif - -#if __ANDROID_USE_LIBLOG_EVENT_INTERFACE - /* For manipulating lists of events. */ #define ANDROID_MAX_LIST_NEST_DEPTH 8 @@ -314,8 +302,6 @@ class android_log_event_list { #endif #endif -#endif /* __ANDROID_USE_LIBLOG_EVENT_INTERFACE */ - #ifdef __cplusplus } #endif diff --git a/liblog/include/log/log_main.h b/liblog/include/log/log_main.h index 53653dec6..a94a2836d 100644 --- a/liblog/include/log/log_main.h +++ b/liblog/include/log/log_main.h @@ -18,9 +18,10 @@ #define _LIBS_LOG_LOG_MAIN_H #include +#include +#include #include -#include __BEGIN_DECLS @@ -349,20 +350,6 @@ extern int __fake_use_va_args(int, ...); * over Android. */ -#ifndef __ANDROID_USE_LIBLOG_LOGGABLE_INTERFACE -#ifndef __ANDROID_API__ -#define __ANDROID_USE_LIBLOG_LOGGABLE_INTERFACE 2 -#elif __ANDROID_API__ > 24 /* > Nougat */ -#define __ANDROID_USE_LIBLOG_LOGGABLE_INTERFACE 2 -#elif __ANDROID_API__ > 22 /* > Lollipop */ -#define __ANDROID_USE_LIBLOG_LOGGABLE_INTERFACE 1 -#else -#define __ANDROID_USE_LIBLOG_LOGGABLE_INTERFACE 0 -#endif -#endif - -#if __ANDROID_USE_LIBLOG_LOGGABLE_INTERFACE - /* * Use the per-tag properties "log.tag." to generate a runtime * result of non-zero to expose a log. prio is ANDROID_LOG_VERBOSE to @@ -370,12 +357,7 @@ extern int __fake_use_va_args(int, ...); * any other value. */ int __android_log_is_loggable(int prio, const char* tag, int default_prio); - -#if __ANDROID_USE_LIBLOG_LOGGABLE_INTERFACE > 1 -#include - -int __android_log_is_loggable_len(int prio, const char* tag, size_t len, - int default_prio); +int __android_log_is_loggable_len(int prio, const char* tag, size_t len, int default_prio); #if LOG_NDEBUG /* Production */ #define android_testLog(prio, tag) \ @@ -387,24 +369,6 @@ int __android_log_is_loggable_len(int prio, const char* tag, size_t len, ANDROID_LOG_VERBOSE) != 0) #endif -#else - -#if LOG_NDEBUG /* Production */ -#define android_testLog(prio, tag) \ - (__android_log_is_loggable(prio, tag, ANDROID_LOG_DEBUG) != 0) -#else -#define android_testLog(prio, tag) \ - (__android_log_is_loggable(prio, tag, ANDROID_LOG_VERBOSE) != 0) -#endif - -#endif - -#else /* __ANDROID_USE_LIBLOG_LOGGABLE_INTERFACE */ - -#define android_testLog(prio, tag) (1) - -#endif /* !__ANDROID_USE_LIBLOG_LOGGABLE_INTERFACE */ - #if defined(__clang__) #pragma clang diagnostic pop #endif diff --git a/liblog/include/log/log_properties.h b/liblog/include/log/log_properties.h index 7d398a6b4..94da242ef 100644 --- a/liblog/include/log/log_properties.h +++ b/liblog/include/log/log_properties.h @@ -14,19 +14,7 @@ extern "C" { #endif -#ifndef __ANDROID_USE_LIBLOG_IS_DEBUGGABLE_INTERFACE -#ifndef __ANDROID_API__ -#define __ANDROID_USE_LIBLOG_IS_DEBUGGABLE_INTERFACE 1 -#elif __ANDROID_API__ > 24 /* > Nougat */ -#define __ANDROID_USE_LIBLOG_IS_DEBUGGABLE_INTERFACE 1 -#else -#define __ANDROID_USE_LIBLOG_IS_DEBUGGABLE_INTERFACE 0 -#endif -#endif - -#if __ANDROID_USE_LIBLOG_IS_DEBUGGABLE_INTERFACE int __android_log_is_debuggable(); -#endif #ifdef __cplusplus } diff --git a/liblog/include/log/log_read.h b/liblog/include/log/log_read.h index 93b9d4e93..15ee23da6 100644 --- a/liblog/include/log/log_read.h +++ b/liblog/include/log/log_read.h @@ -197,22 +197,6 @@ struct log_msg { }; #endif -#ifndef __ANDROID_USE_LIBLOG_READER_INTERFACE -#ifndef __ANDROID_API__ -#define __ANDROID_USE_LIBLOG_READER_INTERFACE 3 -#elif __ANDROID_API__ > 23 /* > Marshmallow */ -#define __ANDROID_USE_LIBLOG_READER_INTERFACE 3 -#elif __ANDROID_API__ > 22 /* > Lollipop */ -#define __ANDROID_USE_LIBLOG_READER_INTERFACE 2 -#elif __ANDROID_API__ > 19 /* > KitKat */ -#define __ANDROID_USE_LIBLOG_READER_INTERFACE 1 -#else -#define __ANDROID_USE_LIBLOG_READER_INTERFACE 0 -#endif -#endif - -#if __ANDROID_USE_LIBLOG_READER_INTERFACE - struct logger; log_id_t android_logger_get_id(struct logger* logger); @@ -225,14 +209,12 @@ int android_logger_get_log_version(struct logger* logger); struct logger_list; -#if __ANDROID_USE_LIBLOG_READER_INTERFACE > 1 ssize_t android_logger_get_statistics(struct logger_list* logger_list, char* buf, size_t len); ssize_t android_logger_get_prune_list(struct logger_list* logger_list, char* buf, size_t len); int android_logger_set_prune_list(struct logger_list* logger_list, char* buf, size_t len); -#endif #define ANDROID_LOG_RDONLY O_RDONLY #define ANDROID_LOG_WRONLY O_WRONLY @@ -243,13 +225,9 @@ int android_logger_set_prune_list(struct logger_list* logger_list, char* buf, #else #define ANDROID_LOG_NONBLOCK O_NONBLOCK #endif -#if __ANDROID_USE_LIBLOG_READER_INTERFACE > 2 #define ANDROID_LOG_WRAP 0x40000000 /* Block until buffer about to wrap */ #define ANDROID_LOG_WRAP_DEFAULT_TIMEOUT 7200 /* 2 hour default */ -#endif -#if __ANDROID_USE_LIBLOG_READER_INTERFACE > 1 #define ANDROID_LOG_PSTORE 0x80000000 -#endif struct logger_list* android_logger_list_alloc(int mode, unsigned int tail, pid_t pid); @@ -268,8 +246,6 @@ struct logger_list* android_logger_list_open(log_id_t id, int mode, unsigned int tail, pid_t pid); #define android_logger_list_close android_logger_list_free -#endif /* __ANDROID_USE_LIBLOG_READER_INTERFACE */ - #ifdef __cplusplus } #endif diff --git a/liblog/include/log/log_safetynet.h b/liblog/include/log/log_safetynet.h index 07e8c8ab1..c8a5781cf 100644 --- a/liblog/include/log/log_safetynet.h +++ b/liblog/include/log/log_safetynet.h @@ -16,18 +16,6 @@ extern "C" { #endif -#ifndef _ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE -#ifndef __ANDROID_API__ -#define __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE 1 -#elif __ANDROID_API__ > 22 /* > Lollipop */ -#define __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE 1 -#else -#define __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE 0 -#endif -#endif - -#if __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE - #define android_errorWriteLog(tag, subTag) \ __android_log_error_write(tag, subTag, -1, NULL, 0) @@ -37,8 +25,6 @@ extern "C" { int __android_log_error_write(int tag, const char* subTag, int32_t uid, const char* data, uint32_t dataLen); -#endif /* __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE */ - #ifdef __cplusplus } #endif diff --git a/liblog/include_vndk/log/log_event_list.h b/liblog/include_vndk/log/log_event_list.h index 9f74534be..1f3dd377b 100644 --- a/liblog/include_vndk/log/log_event_list.h +++ b/liblog/include_vndk/log/log_event_list.h @@ -27,8 +27,6 @@ extern "C" { #endif -#define __ANDROID_USE_LIBLOG_EVENT_INTERFACE 1 - /* * The opaque context used to manipulate lists of events. */