From a95ff485a6f79d1fb8a6c8d3fbeb8d609ea543db Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 25 Jun 2009 23:07:15 +0000 Subject: [PATCH] Add __attribute__((format_arg(1))) to the declaration of err_gettext(), to restore gcc's ability to crosscheck format arguments within elog.c. Noted in a test compilation with -Wformat-nonliteral enabled. --- src/backend/utils/error/elog.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index ad6e726d46..1c377e886f 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -75,6 +75,11 @@ #undef _ #define _(x) err_gettext(x) +static const char *err_gettext(const char *str) +/* This extension allows gcc to check the format string for consistency with + the supplied arguments. */ +__attribute__((format_arg(1))); + /* Global variables */ ErrorContextCallback *error_context_stack = NULL; -- 2.39.5