-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unified headers: basename in string.h defined for all versions if defined(__cplusplus) #440
Comments
Likewise with #if defined(__USE_GNU)
#if defined(__cplusplus)
extern "C++" char* strchrnul(char* _Nonnull, int) __RENAME(strchrnul) __attribute_pure__;
extern "C++" const char* strchrnul(const char* _Nonnull, int) __RENAME(strchrnul) __attribute_pure__;
#else
#if __ANDROID_API__ >= 24
char* strchrnul(const char* _Nonnull, int) __attribute_pure__ __INTRODUCED_IN(24);
#endif /* __ANDROID_API__ >= 24 */
#endif
#endif |
See android/ndk#440 Fixes gdb build with unified headers.
Oops, this slipped through because the tool we have to verify correctness only builds the headers in C. Header fix at https://android-review.googlesource.com/428060, but the preprocessor needs to be updated to build with C++ as well to insert guards. |
These still won't get guards added by the preprocessor, because it compiles with C-only. Bug: android/ndk#440 Test: treehugger Change-Id: I893b345e528ed1b761e0db00700037411bbb8b78
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: android/ndk#440 Change-Id: I31a20fa1596d836b280ffc6d7feb863afccca6c7
The user facing part of this is fixed, so taking off r16. @jmgao still needs to fix the versioner to make sure we don't have more mistakes like this one, but not necessary for r16 (aiui we're not going to be adding more like these anyway since libc++ already provides const-correct overloads for most of the C library). |
did we introduce new problems for strcasestr and memrchr with https://android-review.googlesource.com/#/c/platform/bionic/+/455204/? |
Guessing @jmgao won't be able to do any work on the versioner any time soon. |
answering my own question about strcasestr and memrchr: no, they're fine because they're already surrounded by ANDROID_API checks for other reasons, or were there from the beginning anyway. |
Bug: android/ndk#440 Test: python run_tests.py Change-Id: Id893979146bc609a17bd1fa2a6bec6f10dfe4804
Some declarations, like bitfield members, don't need identifiers. Bug: android/ndk#440 Test: ran versioner with -x c++ on a manually reduced <linux/timex.h> Change-Id: Ic7eea780762cff653c54fdde4d10df203d630c25
Attribute the versioning information on `void foo() __asm("bar")` to bar, not foo. The various long double functions in <math.h> run into this. Bug: android/ndk#440 Test: python run_tests.py Test: m Change-Id: Idd3681ddbd006b4705608449935c9cfacfa3556e
Bug: android/ndk#440 Test: python run_tests.py Change-Id: Ib572a8fdcc00f6b88a25003a085b16ce9698d692
extern "C" and "C++" are parsed as a LinkageSpecDecl with the real Decl as a child node. This leads to the preprocessor sticking its guard between the extern specifier and the declaration. Update the AST visitor to add a special-case for calculating the SourceRange on a LinkageSpecDecl, and add a test. Bug: android/ndk#440 Test: python run_tests.py Change-Id: I76445fe366cef46cfd2f16fb93d534d410c5edca
AFAIK, the versioner support needed for this has been done for a while, should this be closed? |
(After scrolling up and rereading the comments, yeah, looks like it.) |
Some declarations, like bitfield members, don't need identifiers. Bug: android/ndk#440 Test: manually reduced <sys/timex.h> Change-Id: Ic7eea780762cff653c54fdde4d10df203d630c25
Bug: android/ndk#440 Test: python run_tests.py Change-Id: Ib572a8fdcc00f6b88a25003a085b16ce9698d692
From
<string.h>
in NDK r15b:Is it really correct that
basename
is declared if C++ is used regardless of__ANDROID_API__
while android-23 is required for the C function?The text was updated successfully, but these errors were encountered: