Add __attribute__((format_arg(1))) to the declaration of err_gettext(),
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 25 Jun 2009 23:07:15 +0000 (23:07 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 25 Jun 2009 23:07:15 +0000 (23:07 +0000)
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

index ba529002f014bc95743c347e6bad4c0c7e75473f..db334824347b781c5cb764d43e9220e29bca4fdb 100644 (file)
@@ -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 $
  *
  *-------------------------------------------------------------------------
  */
 #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;