summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--psycopg/bytes_format.c1
-rw-r--r--psycopg/config.h8
2 files changed, 9 insertions, 0 deletions
diff --git a/psycopg/bytes_format.c b/psycopg/bytes_format.c
index 1e729e4..b22422b 100644
--- a/psycopg/bytes_format.c
+++ b/psycopg/bytes_format.c
@@ -86,6 +86,7 @@
/* Helpers for formatstring */
+CPYCHECKER_RETURNS_BORROWED_REF
Py_LOCAL_INLINE(PyObject *)
getnextarg(PyObject *args, Py_ssize_t arglen, Py_ssize_t *p_argidx)
{
diff --git a/psycopg/config.h b/psycopg/config.h
index 2112043..321587a 100644
--- a/psycopg/config.h
+++ b/psycopg/config.h
@@ -160,4 +160,12 @@ static double round(double num)
#define isinf(x) (!finite((x)) && (x)==(x))
#endif
+/* decorator for the gcc cpychecker plugin */
+#if defined(WITH_CPYCHECKER_RETURNS_BORROWED_REF_ATTRIBUTE)
+ #define CPYCHECKER_RETURNS_BORROWED_REF \
+ __attribute__((cpychecker_returns_borrowed_ref))
+#else
+ #define CPYCHECKER_RETURNS_BORROWED_REF
+#endif
+
#endif /* !defined(PSYCOPG_CONFIG_H) */