Merge "Clarify the defines documentation further." am: 1441748956 am: 17b5bb88c1 am: 99be5217a3
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2595593
Change-Id: I10f2116538b0eb77344cd03eb819afba2fe63407
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/docs/defines.md b/docs/defines.md
index 65a715e..65cc873 100644
--- a/docs/defines.md
+++ b/docs/defines.md
@@ -54,13 +54,19 @@
work around issues with some of them, use these macros to detect the versinon of
the NDK you're being built with. Usually only `__NDK_MAJOR__` will be necessary.
-## `__arm__`, `__aarch64__`, `__i386__`, `__x86_64__`, `__riscv`
+## `__arm__`/`__aarch64__`, `__i386__`/`__x86_64__`, `__riscv`
-If your code is specific to a particular processor architecture, use these
-macros to conditionally compile. Note that the ABI usually called `arm64` uses
-the macro `__aarch64__` and the ABI usually called `x86` uses `__i386__`.
+If your code is specific to a particular processor architecture, use
+these macros to conditionally compile. Note that the ABI usually called
+`arm64` uses the macro `__aarch64__` and the ABI usually called `x86` uses
+`__i386__`. Android only supports riscv64, so `__riscv` is a sufficient
+check for Android-only code. If you need to write code portable to other
+operating systems that do support riscv32, you'll also need to check
+whether `__riscv_xlen` is 32 or 64.
-## `__LP32__` and `__LP64__`
+## `__ILP32__` and `__LP64__`
-If your code depends on "bitness" -- whether `long` and pointers are 32- or
-64-bit -- use these macros to conditionally compile.
+If your code depends on "bitness" -- whether `long` and pointers are 32-
+or 64-bit -- use these macros to conditionally compile. Note the extra
+"I" in the 32-bit macro (since `int`, `long`, and pointers are all 32-bit
+on such systems, with `long long` being needed for a 64-bit type).