From ff504e63ee76b8b44c668d7024181d0b65277aca Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Fri, 29 Apr 2016 11:52:39 -0700 Subject: [PATCH 1/2] Add __INTRODUCED_IN hack to complex test. complex_test.cpp is compiled with both bionic and glibc, so when __INTRODUCED_IN starts being used in , we'll need this to keep it building. Bug: http://b/28178111 Change-Id: I6431111be35288cad72e9c23ca8599f548b6d906 --- tests/complex_test.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/complex_test.cpp b/tests/complex_test.cpp index 3b8e68249..8ddd28bbf 100644 --- a/tests/complex_test.cpp +++ b/tests/complex_test.cpp @@ -16,6 +16,13 @@ #include +// This file is compiled against both glibc and bionic, and our complex.h +// depends on bionic-specific macros, so hack around that. +#include +#if !defined(__INTRODUCED_IN) +#define __INTRODUCED_IN(x) +#endif + // libc++ actively gets in the way of including from C++, so we // have to be naughty. #include <../libc/include/complex.h> From 5a3d5cac642f9e58b2c510eab23789fb4fc3a753 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Fri, 29 Apr 2016 12:15:18 -0700 Subject: [PATCH 2/2] Add __INTRODUCED_IN_{32,64}. Some symbols appeared at different times between 32 and 64 bit. Add a macro to represent this. Bug: http://b/28178111 Change-Id: I0aa46d9da3c7301b60df0416bce252f0f37b7b36 --- libc/include/sys/cdefs.h | 16 +++++++++++----- tests/complex_test.cpp | 2 ++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h index 2bd058eb5..24b341ec7 100644 --- a/libc/include/sys/cdefs.h +++ b/libc/include/sys/cdefs.h @@ -451,15 +451,21 @@ #ifdef __clang__ #define __AVAILABILITY(...) __attribute__((availability(android,__VA_ARGS__))) +#else +#define __AVAILABILITY(...) +#endif // __clang__ + #define __INTRODUCED_IN(api_level) __AVAILABILITY(introduced=api_level) #define __DEPRECATED_IN(api_level) __AVAILABILITY(deprecated=api_level) #define __REMOVED_IN(api_level) __AVAILABILITY(obsoleted=api_level) + +#if __LP64__ +#define __INTRODUCED_IN_32(api_level) +#define __INTRODUCED_IN_64 __INTRODUCED_IN #else -#define __AVAILABILITY(...) -#define __INTRODUCED_IN(api_level) -#define __DEPRECATED_IN(api_level) -#define __REMOVED_IN(api_level) -#endif // __clang__ +#define __INTRODUCED_IN_32 __INTRODUCED_IN +#define __INTRODUCED_IN_64(api_level) +#endif #if __has_builtin(__builtin_umul_overflow) || __GNUC__ >= 5 #if __LP64__ diff --git a/tests/complex_test.cpp b/tests/complex_test.cpp index 8ddd28bbf..746c0bed3 100644 --- a/tests/complex_test.cpp +++ b/tests/complex_test.cpp @@ -21,6 +21,8 @@ #include #if !defined(__INTRODUCED_IN) #define __INTRODUCED_IN(x) +#define __INTRODUCED_IN_32(x) +#define __INTRODUCED_IN_64(x) #endif // libc++ actively gets in the way of including from C++, so we