From 9993e799f1bffc20837eaf4a0260152f58041bae Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 16 Sep 2016 10:12:52 -0700 Subject: [PATCH] Hide warning in cutils/trace.h system/core/include is included in the global include path using -isystem, which hides all warnings. cutils/trace.h has an ignored return value warning, move the implementation to trace-dev.c so it doesn't cause warnings in every module that includes it in preparation for moving from -isystem to -I. Test: m -j native Bug: 31492149 Change-Id: If8b3fe13059c9e59c2d5208294d427d84fa6e588 --- include/cutils/trace.h | 4 ++-- libcutils/trace-dev.c | 6 ++++++ libcutils/trace-host.c | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/cutils/trace.h b/include/cutils/trace.h index c9790ade1..dc3833ffa 100644 --- a/include/cutils/trace.h +++ b/include/cutils/trace.h @@ -188,8 +188,8 @@ static inline void atrace_begin(uint64_t tag, const char* name) static inline void atrace_end(uint64_t tag) { if (CC_UNLIKELY(atrace_is_tag_enabled(tag))) { - char c = 'E'; - write(atrace_marker_fd, &c, 1); + void atrace_end_body(); + atrace_end_body(); } } diff --git a/libcutils/trace-dev.c b/libcutils/trace-dev.c index 778e4f03b..099ab458c 100644 --- a/libcutils/trace-dev.c +++ b/libcutils/trace-dev.c @@ -196,6 +196,12 @@ void atrace_begin_body(const char* name) write(atrace_marker_fd, buf, len); } +void atrace_end_body() +{ + char c = 'E'; + write(atrace_marker_fd, &c, 1); +} + #define WRITE_MSG(format_begin, format_end, pid, name, value) { \ char buf[ATRACE_MESSAGE_LENGTH]; \ int len = snprintf(buf, sizeof(buf), format_begin "%s" format_end, pid, \ diff --git a/libcutils/trace-host.c b/libcutils/trace-host.c index 6478e3e52..05842cd7d 100644 --- a/libcutils/trace-host.c +++ b/libcutils/trace-host.c @@ -29,6 +29,7 @@ void atrace_set_tracing_enabled(bool enabled __unused) { } void atrace_update_tags() { } void atrace_setup() { } void atrace_begin_body(const char* name __unused) { } +void atrace_end_body() { } void atrace_async_begin_body(const char* name __unused, int32_t cookie __unused) { } void atrace_async_end_body(const char* name __unused, int32_t cookie __unused) { } void atrace_int_body(const char* name __unused, int32_t value __unused) { }