platform_bionic/tools/versioner
Ryan Prichard 4690f0756d Fixes for versioner guard generation
* When calculating the required guard, if a per-arch `introduced`
   value is less than the arch min-API, drop the per-arch guard (i.e.
   reset the value to 0). This is needed for RISC-V, where we don't
   parse the headers with Clang, because the highest APIs we compile
   for (e.g. 23, 34) are less than the current RISC-V min API of 10000.
   Resetting it to 0 here means we don't need this optimization while
   generating an arch-set guard. (i.e. We don't need to calculate
   max_min_version. That code should have been calculating a
   "min_min_version" anyway.)

 * Remove the broken all-supported-archs entry from arch_sets. It has a
   few problems:
    * It's redundant with the "global availability" code path above,
      which is used when the declaration has no per-arch annotations.
    * If this code path runs, then we generate two more guard
      expressions, for !LP64 and LP64.
    * Passing "" to generate_guard is broken for a non-zero version,
      and for a zero version, adding an empty string to `expressions`
      breaks if the vector has 2 or more expressions.

   (I think consolidating per-arch info, e.g. using a single check for
   __INTRODUCED_IN_32(40) __INTRODUCED_IN_64(40), is a nice idea, but
   it should happen as a natural consequence of removing the
   arch-independent "global availability" info in favor of always
   tracking it per-arch.)

 * Rewrite the arch-set guard generation. Add an optimization so that
   the (__ANDROID_API__ >= N) guard for __INTRODUCED_IN_64(N) is still
   useful for RISC-V as long as N is small enough. (Currently we're
   checking that N is <= 10000.)

This change fixes the "preprocessor" test that run_tests.py runs. The
"slow_preprocessor_idempotence" test is still broken.

Bug: https://github.com/android/ndk/issues/1888
Test: run_tests.py
Change-Id: I3f94357465dbdb2c23fff442a31fb5083de27a97
2023-05-18 21:11:43 -07:00
..
platforms Clean up mips references in the headers. 2020-02-13 18:00:16 -08:00
src Fixes for versioner guard generation 2023-05-18 21:11:43 -07:00
tests Fixes for versioner guard generation 2023-05-18 21:11:43 -07:00
Android.bp Add LOCAL_LICENSE_KINDS to bionic 2021-02-19 23:38:28 +00:00
current versioner: introduce. 2016-06-02 13:40:36 -07:00
dependencies versioner: add symlink for dependencies. 2017-04-27 17:25:23 -07:00
README.md versioner: Port to clang-r339409b 2018-10-31 14:53:30 +08:00
run_tests.py Force everything to use python3 for consistency. 2021-04-15 13:39:08 -07:00

versioner

Use clang to verify the correctness of bionic's availability attributes against the NDK platform definitions.

Build

Build with LLVM_BUILD_HOST_TOOLS=true mma -j48

Use

versioner -p platforms current dependencies