]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix CPU-identification macros for RISC-V.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 1 Jul 2026 14:10:21 +0000 (10:10 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 1 Jul 2026 14:10:28 +0000 (10:10 -0400)
Turns out that RISC-V intentionally doesn't follow the common
naming pattern for CPU-identification macros.  But the point of
2ef57e636 is to have a common pattern, so we're going to override
their opinion.

Discussion: https://postgr.es/m/CA+hUKGL8Hs-phHPugrWM=5dAkcT897rXyazYzLw-Szxnzgx-rA@mail.gmail.com

src/include/c.h

index ef4dc5d1e634aadb7d725c28917348570400d15d..0e4aea5d5a395d19e041938cbec3a452d9ca6f27 100644 (file)
@@ -138,10 +138,13 @@ extern "C++"
 #ifndef __powerpc64__
 #define __powerpc64__ 1
 #endif
-#elif defined(__riscv__)
-/* no work */
-#elif defined(__riscv64__)
-/* no work */
+#elif defined(__riscv)
+/* RISC-V doesn't follow the common naming pattern, so force it */
+#if SIZEOF_VOID_P == 8
+#define __riscv64__ 1
+#else
+#define __riscv__ 1
+#endif
 #elif defined(__s390__)
 /* no work */
 #elif defined(__s390x__)