Add guards for things the versioner can't catch.
The versioner doesn't handle C++ blocks yet, so these guards won't be
added and it will appear as though the functions are always available
in C++, but based on API level in C.
Test: make checkbuild
Bug: https://github.com/android-ndk/ndk/issues/440
Change-Id: I31a20fa1596d836b280ffc6d7feb863afccca6c7
diff --git a/libc/include/string.h b/libc/include/string.h
index 631b3dd..164146d 100644
--- a/libc/include/string.h
+++ b/libc/include/string.h
@@ -58,8 +58,11 @@
char* __strchr_chk(const char*, int, size_t) __INTRODUCED_IN(18);
#if defined(__USE_GNU)
#if defined(__cplusplus)
+/* The versioner doesn't handle C++ blocks yet, so manually guarded. */
+#if __ANDROID_API__ >= 24
extern "C++" char* strchrnul(char*, int) __RENAME(strchrnul) __attribute_pure__ __INTRODUCED_IN(24);
extern "C++" const char* strchrnul(const char*, int) __RENAME(strchrnul) __attribute_pure__ __INTRODUCED_IN(24);
+#endif /* __ANDROID_API__ >= 24 */
#else
char* strchrnul(const char*, int) __attribute_pure__ __INTRODUCED_IN(24);
#endif
@@ -125,8 +128,11 @@
* It doesn't modify its argument, and in C++ it's const-correct.
*/
#if defined(__cplusplus)
+/* The versioner doesn't handle C++ blocks yet, so manually guarded. */
+#if __ANDROID_API__ >= 23
extern "C++" char* basename(char*) __RENAME(__gnu_basename) __INTRODUCED_IN(23);
extern "C++" const char* basename(const char*) __RENAME(__gnu_basename) __INTRODUCED_IN(23);
+#endif /* __ANDROID_API__ >= 23 */
#else
char* basename(const char*) __RENAME(__gnu_basename) __INTRODUCED_IN(23);
#endif