]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Add missing guard for __builtin_constant_p
authorJohn Naylor <john.naylor@postgresql.org>
Tue, 5 May 2026 11:51:07 +0000 (18:51 +0700)
committerJohn Naylor <john.naylor@postgresql.org>
Tue, 5 May 2026 11:51:07 +0000 (18:51 +0700)
Oversight in commit e2809e3a1. While at it, use pg_integer_constant_p
in master.

Discussion: https://postgr.es/m/CANWCAZbOha-x5MCreQn3TRA56VdKWNMAKMy3fAV1kJSw9Vp4pw@mail.gmail.com
Backpatch-through: 18

src/include/port/pg_crc32c.h

index e6085ca50d15d9dd40593b7638b2b57fd444c3df..2f22e176a667e0f561a55651dba50c78b0d1f7ab 100644 (file)
@@ -70,7 +70,8 @@ static inline
 pg_crc32c
 pg_comp_crc32c_dispatch(pg_crc32c crc, const void *data, size_t len)
 {
-       if (__builtin_constant_p(len) && len < 32)
+#ifdef HAVE_PG_INTEGER_CONSTANT_P
+       if (pg_integer_constant_p(len) && len < 32)
        {
                const unsigned char *p = (const unsigned char *) data;
 
@@ -91,6 +92,9 @@ pg_comp_crc32c_dispatch(pg_crc32c crc, const void *data, size_t len)
        else
                /* Otherwise, use a runtime check for AVX-512 instructions. */
                return pg_comp_crc32c(crc, data, len);
+#else
+       return pg_comp_crc32c(crc, data, len);
+#endif                                                 /* HAVE_PG_INTEGER_CONSTANT_P */
 }
 
 #elif defined(USE_SSE42_CRC32C_WITH_RUNTIME_CHECK)