postgres.git / summary / log / commit / refs

commit    7a58167ea23c4ce3eb380e2b05fc33a8d08d44d1
Author:   Tom Lane <tgl@sss.pgh.pa.us>
Date:     Thu Jun 25 23:07:15 2009 +0000
First released in: 8.4.0

    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 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index ba529002f01..db334824347 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -42,7 +42,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.215 2009/06/11 14:49:05 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.216 2009/06/25 23:07:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -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; [parent: 7e48b77b1ceb]