]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Make PLy_elog() use pg_integer_constant_p().
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 6 Jul 2026 17:48:42 +0000 (13:48 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 6 Jul 2026 17:48:42 +0000 (13:48 -0400)
This macro is supposed to work like ereport().  But when
59c2f03d1 adjusted ereport() to be more MSVC-friendly,
it missed updating this copy of the logic.

Discussion: https://postgr.es/m/754534.1783264708@sss.pgh.pa.us
Backpatch-through: 19

src/pl/plpython/plpy_elog.h

index 3150f9e72ca62d62e28c3c090a662a319c5fac92..887535d58608008b15740d4a4c3e4307149bd3b7 100644 (file)
@@ -17,14 +17,14 @@ extern PyObject *PLy_exc_spi_error;
  *
  * See comments at elog() about the compiler hinting.
  */
-#ifdef HAVE__BUILTIN_CONSTANT_P
+#ifdef HAVE_PG_INTEGER_CONSTANT_P
 #define PLy_elog(elevel, ...) \
        do { \
                PLy_elog_impl(elevel, __VA_ARGS__); \
-               if (__builtin_constant_p(elevel) && (elevel) >= ERROR) \
+               if (pg_integer_constant_p(elevel) && (elevel) >= ERROR) \
                        pg_unreachable(); \
        } while(0)
-#else                                                  /* !HAVE__BUILTIN_CONSTANT_P */
+#else                                                  /* !HAVE_PG_INTEGER_CONSTANT_P */
 #define PLy_elog(elevel, ...)  \
        do { \
                const int elevel_ = (elevel); \
@@ -32,7 +32,7 @@ extern PyObject *PLy_exc_spi_error;
                if (elevel_ >= ERROR) \
                        pg_unreachable(); \
        } while(0)
-#endif                                                 /* HAVE__BUILTIN_CONSTANT_P */
+#endif                                                 /* HAVE_PG_INTEGER_CONSTANT_P */
 
 extern PGDLLEXPORT void PLy_elog_impl(int elevel, const char *fmt, ...) pg_attribute_printf(2, 3);