From dcd62cd842ca046d0b94b0584a9c84bc6e65b235 Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Wed, 20 Sep 2023 21:48:20 -0700 Subject: binder_status.h: include assert.h for __assert The binder_status.h header is defining __assert as a macro for its own error reporting, which conflicts with glibc's unused __assert function. Android's version of glibc 2.17's assert.h has an _ASSERT_H_DECLS guard macro preventing redeclaration of the __assert function, so if we add an include of assert.h in binder_status.h, the __assert function can be declared before the identifier is shadowed by the macro, and later assert.h inclusions won't redeclare __assert (even though they *do* redefine assert according to the current value of NDEBUG). Without this fix, after upgrading libc++, assert.h is incidentally included somewhere *after* binder_status.h, and binder's __assert macro is applied to the __assert declaration in the glibc header, which is invalid syntax. Bug: 175635923 Test: m art_artd_tests Change-Id: I35c197b8d92ecad417a7e9950f51461375d3861f --- libs/binder/ndk/include_ndk/android/binder_status.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/binder/ndk/include_ndk/android/binder_status.h b/libs/binder/ndk/include_ndk/android/binder_status.h index 76c7aacb7c..4786c89c89 100644 --- a/libs/binder/ndk/include_ndk/android/binder_status.h +++ b/libs/binder/ndk/include_ndk/android/binder_status.h @@ -25,6 +25,7 @@ #pragma once +#include #include #include #include -- cgit v1.2.3-59-g8ed1b