2 * src/pl/plpython/plpy_elog.h
10 /* global exception classes */
11 extern PyObject
*PLy_exc_error
;
12 extern PyObject
*PLy_exc_fatal
;
13 extern PyObject
*PLy_exc_spi_error
;
18 * See comments at elog() about the compiler hinting.
20 #ifdef HAVE__BUILTIN_CONSTANT_P
21 #define PLy_elog(elevel, ...) \
23 PLy_elog_impl(elevel, __VA_ARGS__); \
24 if (__builtin_constant_p(elevel) && (elevel) >= ERROR) \
27 #else /* !HAVE__BUILTIN_CONSTANT_P */
28 #define PLy_elog(elevel, ...) \
30 const int elevel_ = (elevel); \
31 PLy_elog_impl(elevel_, __VA_ARGS__); \
32 if (elevel_ >= ERROR) \
35 #endif /* HAVE__BUILTIN_CONSTANT_P */
37 extern PGDLLEXPORT
void PLy_elog_impl(int elevel
, const char *fmt
,...) pg_attribute_printf(2, 3);
39 extern PGDLLEXPORT
void PLy_exception_set(PyObject
*exc
, const char *fmt
,...) pg_attribute_printf(2, 3);
41 extern PGDLLEXPORT
void PLy_exception_set_plural(PyObject
*exc
, const char *fmt_singular
, const char *fmt_plural
,
42 unsigned long n
,...) pg_attribute_printf(2, 5) pg_attribute_printf(3, 5);
44 extern PGDLLEXPORT
void PLy_exception_set_with_details(PyObject
*excclass
, ErrorData
*edata
);
46 #endif /* PLPY_ELOG_H */