android / android/ndk

better diagnostics for missing functions

Open
#479 1 comment 1 reaction 0 assignees View on GitHub
clang headers
Dominant language
No language data
Stars
2.3k
Forks
310
PR merge metrics
No merged PRs in 30d

Description

As https://github.com/android-ndk/ndk/issues/477 (and others) have shown, our diagnostics for missing functions can be confusing.

`__attribute__((availability))` should mean we get better diagnostics, but since we need to `#ifdef` things out to replace them with inlines for old platform versions, the compiler can't help.

We should add an `__INLINE_BEFORE` tag for the versioner to match `__INTRODUCED_IN` and teach the versioner to only `#ifdef` the former.

When this was first implemented, using a function that was unavailable via `__attribute__((availability))` wasn't actually an error. The function would be a weak reference instead. @jmgao was considering (or perhaps already fixed, idr) adding a flag to that attribute to make it an error.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the versioner's handling of __INTRODUCED_IN and the existing #ifdef logic described in the issue. Read the context from issue 477 and inspect how __attribute__((availability)) currently reports unavailable functions. Done means the versioner recognizes __INLINE_BEFORE without hiding those declarations, producing clearer missing-function diagnostics.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.