Skip to content

[Bug]: clang silently ignores garbage target versions #1728

@DanAlbert

Description

@DanAlbert

Description

Invalid android versions are silently ignored by clang.

$ ~/Library/Android/sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -target aarch64-linux-android31 -dM -E - < /dev/null | grep __ANDROID_MIN_SDK_VERSION__
#define __ANDROID_API__ __ANDROID_MIN_SDK_VERSION__
#define __ANDROID_MIN_SDK_VERSION__ 31
$ ~/Library/Android/sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -target aarch64-linux-androidS -dM -E - < /dev/null | grep __ANDROID_MIN_SDK_VERSION__
# Not set.

In the second case, android/api-level.h (which will be included transitively by any file that includes any libc header) will set __ANDROID_API__ to __ANDROID_API_FUTURE__ (AKA 10000), but won't set __ANDROID_MIN_SDK_VERSION__ at all.

Upstream bug

No response

Commit to cherry-pick

No response

Affected versions

r24, r25, Canary

Canary version

No response

Host OS

Linux, Mac, Windows

Host OS version

all

Affected ABIs

armeabi-v7a, arm64-v8a, x86, x86_64

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Prebuilts submitted

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions