platform_bionic/tools
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
..
versioner Fixes for versioner guard generation 2023-05-18 21:11:43 -07:00
Android.bp Switch to the more common idiom for scripts in genrules. 2022-06-30 23:35:11 +00:00
generate-version-script.py s/riscv/riscv64/ 2022-10-05 20:17:41 +00:00
NOTICE Fix/update notices. 2021-02-16 15:06:50 -08:00
update_notice.sh Fix/update notices. 2021-02-16 15:06:50 -08:00