This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] locale_bionic.h: skip ndk-version.h on Android platform
ClosedPublic

Authored by ZijunZhao on Mar 28 2022, 9:36 AM.

Details

Reviewers
rprichard
danalbert
pirama
ldionne
Group Reviewers
Restricted Project
Summary

The Android platform does not have ndk-version.h, but it will always
have up-to-date libc headers, so it does not need any compatibility
code intended for past versions of NDK_MAJOR. If ndk-version.h
is missing, assume NDK_MAJOR is (conceptually) infinite.

Diff Detail

Event Timeline

ZijunZhao created this revision.Mar 28 2022, 9:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 28 2022, 9:36 AM
ZijunZhao requested review of this revision.Mar 28 2022, 9:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 28 2022, 9:36 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript

Question: This format is amended by linter automatically. Does it need to be changed back?

ldionne requested changes to this revision.Mar 28 2022, 11:14 AM
ldionne added a subscriber: ldionne.

Question: This format is amended by linter automatically. Does it need to be changed back?

No, you can ignore the linter suggestions. You can actually use arc diff --nolint when uploading patches to avoid these warnings, which are not very relevant in libc++.

libcxx/include/__support/android/locale_bionic.h
34–45

I don't really have a concern with this patch per se because it's self contained in bionic specific headers, however this doesn't really seem to be meant for upstreaming. At least, we should update the comment so that it makes more sense to carry upstream.

This revision now requires changes to proceed.Mar 28 2022, 11:14 AM

Suggested issue title: [libcxx] locale_bionic.h: skip ndk-version.h on Android platform


The CtsDeqpTestCases test failures aren't that closely related to this patch -- to fix them, we needed to upgrade the copy of the NDK libc++ prebuilts in the platform repository (i.e. the "NDK-in-platform use case" in the comment above), and to do that, we had to reapply this header file patch to account for the lack of an ndk-version.h in the platform build.

i.e. We've been reapplying this patch a few times, but it would be better to have it in upstream LLVM.

libcxx/include/__support/android/locale_bionic.h
29

This #include of ndk-version.h should be removed in favor of the one below.

I wonder how useful the api-level.h include here is. Mostly it just defines the various __ANDROID_API_<xxx>__ macros, which we don't use here. It does ensure that __ANDROID_API__ is defined, but normally Clang will have defined that as a built-in macro. Still, I think it's harmless, so I'd leave this api-level.h include alone.

34–38

We could simply remove this comment, because the 3-line comment below (in front of __has_include) already explains what's going on.

34–45

This patch adds support for the Android-platform-but-not-NDK use case, so I think it makes sense to upstream. I agree that the comment (and title) needs fixing.

ZijunZhao updated this revision to Diff 418719.Mar 28 2022, 3:51 PM
ZijunZhao marked 2 inline comments as done.

The link you provided seems to point to a private bug tracker.
Can you update the description of patch so it's clear what this tries to fix.
(I don't mind the private link, but I like to have some public info too.)

ZijunZhao edited the summary of this revision. (Show Details)Mar 29 2022, 10:41 AM

Hi,

Thank you for reminding me! Sorry for the inconvenience! Already updated

to the summary! If you have any questions, please let me know :D
Best,
Zijun

ZijunZhao retitled this revision from Fix CtsDeqpTestCases failures to missing android/ndk-version.h.Mar 29 2022, 2:51 PM
ZijunZhao edited the summary of this revision. (Show Details)
ZijunZhao updated this revision to Diff 419001.Mar 29 2022, 3:35 PM
ZijunZhao marked 2 inline comments as done.Apr 1 2022, 9:39 AM
ZijunZhao updated this revision to Diff 419854.Apr 1 2022, 2:07 PM
ZijunZhao retitled this revision from missing android/ndk-version.h to Add android/ndk-version.h and android/api-level.h.
ZijunZhao edited the summary of this revision. (Show Details)

Add android/ndk-version.h and android/api-level.h

ZijunZhao edited the summary of this revision. (Show Details)Apr 1 2022, 3:15 PM
ZijunZhao edited the summary of this revision. (Show Details)Apr 1 2022, 3:18 PM
ZijunZhao retitled this revision from Add android/ndk-version.h and android/api-level.h to [libcxx] locale_bionic.h: skip ndk-version.h on Android platform.Apr 1 2022, 3:36 PM
ZijunZhao edited the summary of this revision. (Show Details)Apr 4 2022, 4:17 PM
ZijunZhao edited the summary of this revision. (Show Details)Apr 5 2022, 5:00 PM
ZijunZhao updated this revision to Diff 420666.Apr 5 2022, 5:10 PM
rprichard accepted this revision.Apr 5 2022, 5:21 PM
ldionne accepted this revision.Apr 11 2022, 8:18 AM
This revision is now accepted and ready to land.Apr 11 2022, 8:18 AM