summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Wasilczyk <twasilczyk@google.com>2023-11-29 21:39:29 -0800
committerTomasz Wasilczyk <twasilczyk@google.com>2023-12-05 14:25:30 -0800
commit8378013d7981e802787d25c25d7408363894c786 (patch)
treef472a29a21a7ee632cb8052f2cd6bb4ad64e0b43
parentdec4e24b42232d50ce9701a73c8e3e1bc78108b6 (diff)
downloadnative-8378013d7981e802787d25c25d7408363894c786.tar.gz
Minor build-outside-android fixes
- add missing includes - fix maybe_unused warning - use LOG_ALWAYS_FATAL instead of __assert (behind flag) Bug: 302723053 Test: mma in binder folder Change-Id: I4e90ff7c7f37e6736bc38abaa11744ccf7155a17
-rw-r--r--libs/binder/Android.bp21
-rw-r--r--libs/binder/Parcel.cpp2
-rw-r--r--libs/binder/file.cpp2
-rw-r--r--libs/binder/include/binder/Delegate.h5
-rw-r--r--libs/binder/ndk/include_ndk/android/binder_status.h5
-rw-r--r--libs/binder/trusty/include/log/log.h6
-rw-r--r--libs/binder/trusty/kernel/rules.mk1
-rw-r--r--libs/binder/trusty/rules.mk1
8 files changed, 27 insertions, 16 deletions
diff --git a/libs/binder/Android.bp b/libs/binder/Android.bp
index d73c3a4e8c..6895d3586f 100644
--- a/libs/binder/Android.bp
+++ b/libs/binder/Android.bp
@@ -106,6 +106,17 @@ cc_defaults {
header_libs: [
"libbinder_headers",
],
+
+ cflags: [
+ "-Wextra",
+ "-Wextra-semi",
+ "-Werror",
+ "-Wzero-as-null-pointer-constant",
+ "-Wreorder-init-list",
+ "-Wunused-const-variable",
+ "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
+ "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
+ ],
}
cc_defaults {
@@ -135,15 +146,6 @@ cc_defaults {
export_aidl_headers: true,
},
- cflags: [
- "-Wextra",
- "-Wextra-semi",
- "-Werror",
- "-Wzero-as-null-pointer-constant",
- "-Wreorder-init-list",
- "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
- "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
- ],
product_variables: {
debuggable: {
cflags: [
@@ -220,6 +222,7 @@ cc_defaults {
cflags: [
"-DBINDER_RPC_SINGLE_THREADED",
+ "-DBINDER_ENABLE_LIBLOG_ASSERT",
// Trusty libbinder uses vendor stability for its binders
"-D__ANDROID_VNDK__",
"-U__ANDROID__",
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 47e3f91ac2..0b94fa4be4 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -110,7 +110,7 @@ static std::atomic<size_t> gParcelGlobalAllocSize;
constexpr size_t kMaxFds = 1024;
// Maximum size of a blob to transfer in-place.
-static const size_t BLOB_INPLACE_LIMIT = 16 * 1024;
+[[maybe_unused]] static const size_t BLOB_INPLACE_LIMIT = 16 * 1024;
enum {
BLOB_INPLACE = 0,
diff --git a/libs/binder/file.cpp b/libs/binder/file.cpp
index bac667e4e5..6e450b90b7 100644
--- a/libs/binder/file.cpp
+++ b/libs/binder/file.cpp
@@ -18,6 +18,8 @@
#ifdef BINDER_NO_LIBBASE
+#include "Utils.h"
+
#include <stdint.h>
// clang-format off
diff --git a/libs/binder/include/binder/Delegate.h b/libs/binder/include/binder/Delegate.h
index 8b3fc1cc10..ad5a6a3e88 100644
--- a/libs/binder/include/binder/Delegate.h
+++ b/libs/binder/include/binder/Delegate.h
@@ -18,6 +18,11 @@
#include <binder/IBinder.h>
+#if !defined(__BIONIC__) && defined(BINDER_ENABLE_LIBLOG_ASSERT)
+#include <log/log.h>
+#define __assert(file, line, message) LOG_ALWAYS_FATAL(file ":" #line ": " message)
+#endif
+
#ifndef __BIONIC__
#ifndef __assert
diff --git a/libs/binder/ndk/include_ndk/android/binder_status.h b/libs/binder/ndk/include_ndk/android/binder_status.h
index 4786c89c89..14edf2bfb6 100644
--- a/libs/binder/ndk/include_ndk/android/binder_status.h
+++ b/libs/binder/ndk/include_ndk/android/binder_status.h
@@ -31,6 +31,11 @@
#include <stdint.h>
#include <sys/cdefs.h>
+#if !defined(__BIONIC__) && defined(BINDER_ENABLE_LIBLOG_ASSERT)
+#include <log/log.h>
+#define __assert(file, line, message) LOG_ALWAYS_FATAL(file ":" #line ": " message)
+#endif
+
__BEGIN_DECLS
#ifndef __BIONIC__
diff --git a/libs/binder/trusty/include/log/log.h b/libs/binder/trusty/include/log/log.h
index de84617343..bf877a3179 100644
--- a/libs/binder/trusty/include/log/log.h
+++ b/libs/binder/trusty/include/log/log.h
@@ -120,9 +120,3 @@ static inline void __ignore_va_args__(...) {}
do { \
TLOGE("android_errorWriteLog: tag:%x subTag:%s\n", tag, subTag); \
} while (0)
-
-// Override the definition of __assert from binder_status.h
-#ifndef __BIONIC__
-#undef __assert
-#define __assert(file, line, str) LOG_ALWAYS_FATAL("%s:%d: %s", file, line, str)
-#endif // __BIONIC__
diff --git a/libs/binder/trusty/kernel/rules.mk b/libs/binder/trusty/kernel/rules.mk
index 69737fa102..65fe6f5829 100644
--- a/libs/binder/trusty/kernel/rules.mk
+++ b/libs/binder/trusty/kernel/rules.mk
@@ -67,6 +67,7 @@ GLOBAL_COMPILEFLAGS += \
-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION \
-DBINDER_NO_KERNEL_IPC \
-DBINDER_RPC_SINGLE_THREADED \
+ -DBINDER_ENABLE_LIBLOG_ASSERT \
-D__ANDROID_VNDK__ \
MODULE_DEPS += \
diff --git a/libs/binder/trusty/rules.mk b/libs/binder/trusty/rules.mk
index 96c66a8be4..b05464f28b 100644
--- a/libs/binder/trusty/rules.mk
+++ b/libs/binder/trusty/rules.mk
@@ -70,6 +70,7 @@ MODULE_EXPORT_INCLUDES += \
MODULE_EXPORT_COMPILEFLAGS += \
-DBINDER_RPC_SINGLE_THREADED \
+ -DBINDER_ENABLE_LIBLOG_ASSERT \
-D__ANDROID_VNDK__ \
# libbinder has some deprecated declarations that we want to produce warnings