From acd23e19f67341e3aada2710f7dd0b57b59b80e9 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Mon, 30 Jan 2023 13:24:29 -0800 Subject: Use extern "C" instead of __BEGIN_DECLS __BEGIN_DECLS is a glibc implementation detail that has been copied into bionic. It is provided by sys/cdefs.h, which is included by most glibc and bionic headers. Musl libc does not define __BEGIN_DECLS, but we have added a local definition in sys/cdefs.h, but not the widespread automatic inclusion of sys/cdefs.h. tipc.h uses __BEGIN_DECLS without including any other headers, so it will fail for bionic and glibc if it is included first. It will always fail for musl unless sys/cdefs.h is manually included. Avoid the problem completely by using extern "C" directly. Test: builds Change-Id: Iaec6a7b03b776ff80dc3997de8828b8220622733 --- libs/binder/trusty/include_mock/lib/tipc/tipc.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/binder/trusty/include_mock/lib/tipc/tipc.h b/libs/binder/trusty/include_mock/lib/tipc/tipc.h index f295be4980..ead9f9cdaf 100644 --- a/libs/binder/trusty/include_mock/lib/tipc/tipc.h +++ b/libs/binder/trusty/include_mock/lib/tipc/tipc.h @@ -15,7 +15,9 @@ */ #pragma once -__BEGIN_DECLS +#if defined(__cplusplus) +extern "C" { +#endif struct tipc_hset; @@ -26,4 +28,6 @@ int tipc_run_event_loop(struct tipc_hset*) { return 0; } -__END_DECLS +#if defined(__cplusplus) +} +#endif -- cgit v1.2.3-59-g8ed1b