Skip to content
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

[FR] improve clang display of API levels for -Wunguarded-availability #1455

Closed
DanAlbert opened this issue Feb 25, 2021 · 4 comments
Closed
Assignees

Comments

@DanAlbert
Copy link
Member

https://android-review.googlesource.com/c/platform/external/jsoncpp/+/1607004/2..3//COMMIT_MSG#b9

Android 16.0.0 meaning "API 16" is damn confusing.

@DanAlbert
Copy link
Member Author

Reproducer:

$ cat foo.cpp
extern void foo() __attribute__((__availability__(android,introduced=31)));

int main() {
  foo();
}
$ android-ndk-r24-canary/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -target aarch64-linux-android21 foo.cpp -Weverything
foo.cpp:4:3: warning: 'foo' is only available on Android 31 or newer [-Wunguarded-availability]
  foo();
  ^~~
foo.cpp:1:13: note: 'foo' has been marked as being introduced in Android 31 here, but the deployment target is Android 21.0.0
extern void foo() __attribute__((__availability__(android,introduced=31)));
            ^
foo.cpp:4:3: note: enclose 'foo' in a __builtin_available check to silence this warning
  foo();
  ^~~
1 warning generated.

@enh-google
Copy link
Collaborator

foo.cpp:1:13: note: 'foo' has been marked as being introduced in Android 31 here, but the deployment target is Android 21.0.0

oh, that's even stranger --- we get "Android 31" in the first part of the message, but "Android 21.0.0" in the second!

@jfgoog
Copy link
Collaborator

jfgoog commented Nov 16, 2021

The reason I was having trouble reproducing it in a test is that // expected-foo doesn't check for an exact match, just a substring. Now I understand what's going on, and I have a fix.

@DanAlbert
Copy link
Member Author

Change is in review: https://reviews.llvm.org/D114163

Not likely to be backported, but should be included whatever LLVM we pick up for r25, so moving buckets.

jfgoog added a commit to llvm/llvm-project that referenced this issue Nov 30, 2021
…le to distinguish between "16" and "16.0" after parsing, which previously was not possible.

See also android/ndk#1455.

Differential Revision: https://reviews.llvm.org/D114163
osspop pushed a commit to osspop/android-ndk that referenced this issue Jan 17, 2023
Bug: android/ndk#1455
Test: None
Change-Id: Ia518490118d449b4e5a14912a323e76c3e1911ea
(cherry picked from commit 7898e44)
Merged-In: Ia518490118d449b4e5a14912a323e76c3e1911ea
osspop pushed a commit to osspop/android-ndk that referenced this issue Jan 17, 2023
Bug: android/ndk#1455
Test: None
Change-Id: Ia518490118d449b4e5a14912a323e76c3e1911ea
osspop pushed a commit to osspop/android-ndk that referenced this issue Jan 17, 2023
Bug: android/ndk#1455
Test: None
Change-Id: Ia518490118d449b4e5a14912a323e76c3e1911ea
(cherry picked from commit 7898e44)
Merged-In: Ia518490118d449b4e5a14912a323e76c3e1911ea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants