Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 423e3787 authored by Jiyong Park's avatar Jiyong Park
Browse files

API availability should be checked using __builtin_available

This change turns -Wunguarded-availability option which enforces calls
to APIs which are introduced after the min_sdk_version of the
compliation unit to be guarded with __builtin_available check. For
example, let's assume that we have foo() which was introduced with API
level 30.

void foo() __INTRODUCED_IN(30);

Then if foo() is called for a module whose min_sdk_version is less than
30, say 26, it should be called as below:

if (__builtin_available(android 30, *)) {
  foo();
} else {
  // fallback impl
}

For modules whose min_sdk_version is >=30, the guard is not required.

Bug: 150860940
Bug: 134795810
Test: m

Change-Id: I084148b9a051350626a37cb394daa4398b7332d5
parent b35a8198
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment