diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 85197e957ae317c2e8e30dff36e02216eac0723a..12cd5a164815066c64ed20d5bcb480bdb70ff313 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -37,7 +37,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.244 2001/09/30 20:08:18 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.245 2001/10/03 21:58:28 tgl Exp $
  *
  * NOTES
  *
@@ -251,13 +251,9 @@ static void SignalChildren(int signal);
 static int	CountChildren(void);
 static bool CreateOptsFile(int argc, char *argv[]);
 static pid_t SSDataBase(int xlop);
-#ifdef __GNUC__
-/* This checks the format string for consistency. */
 static void postmaster_error(const char *fmt, ...)
-	__attribute__((format(printf, 1, 2)));
-#else
-static void postmaster_error(const char *fmt, ...);
-#endif
+/* This lets gcc check the format string for consistency. */
+__attribute__((format(printf, 1, 2)));
 
 #define StartupDataBase()		SSDataBase(BS_XLOG_STARTUP)
 #define CheckPointDataBase()	SSDataBase(BS_XLOG_CHECKPOINT)
diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h
index 282738d882d17077ba23e34e5a73bebec9d843b4..b06ff439731b178b1b287568bd402a8789b30378 100644
--- a/src/bin/pg_dump/pg_backup.h
+++ b/src/bin/pg_dump/pg_backup.h
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v 1.14 2001/08/22 20:23:23 petere Exp $
+ *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v 1.15 2001/10/03 21:58:28 tgl Exp $
  *
  * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
  *
@@ -130,7 +130,8 @@ typedef struct _restoreOptions
  * Main archiver interface.
  */
 
-extern void exit_horribly(Archive *AH, const char *modulename, const char *fmt, ...) __attribute__((format(printf,3,4)));
+extern void exit_horribly(Archive *AH, const char *modulename, const char *fmt, ...)
+__attribute__((format(printf,3,4)));
 
 extern char *
 simple_prompt(const char *prompt, int maxlen, bool echo);
@@ -188,6 +189,8 @@ extern void SortTocFromFile(Archive *AH, RestoreOptions *ropt);
 /* Convenience functions used only when writing DATA */
 extern int	archputs(const char *s, Archive *AH);
 extern int	archputc(const char c, Archive *AH);
-extern int	archprintf(Archive *AH, const char *fmt,...);
+extern int	archprintf(Archive *AH, const char *fmt, ...)
+/* This extension allows gcc to check the format string */
+__attribute__((format(printf, 2, 3)));
 
 #endif
diff --git a/src/bin/psql/common.h b/src/bin/psql/common.h
index 04c91fdd66e52c439c909ad5074d940ed2a34c2f..f9604bf90d89c2b5dd2ff860636cafada6db436f 100644
--- a/src/bin/psql/common.h
+++ b/src/bin/psql/common.h
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/common.h,v 1.13 2001/02/10 02:31:28 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/common.h,v 1.14 2001/10/03 21:58:28 tgl Exp $
  */
 #ifndef COMMON_H
 #define COMMON_H
@@ -13,33 +13,28 @@
 #include "pqsignal.h"
 #include "libpq-fe.h"
 
-char	   *xstrdup(const char *string);
+extern char	   *xstrdup(const char *string);
 
-bool		setQFout(const char *fname);
+extern bool		setQFout(const char *fname);
 
-#ifndef __GNUC__
-void		psql_error(const char *fmt,...);
+extern void		psql_error(const char *fmt, ...)
+/* This lets gcc check the format string for consistency. */
+__attribute__((format(printf, 1, 2)));
 
-#else
-/* This checks the format string for consistency. */
-void		psql_error(const char *fmt,...) __attribute__((format(printf, 1, 2)));
+extern void		NoticeProcessor(void *arg, const char *message);
 
-#endif
-
-void		NoticeProcessor(void *arg, const char *message);
-
-char	   *simple_prompt(const char *prompt, int maxlen, bool echo);
+extern char	   *simple_prompt(const char *prompt, int maxlen, bool echo);
 
 extern volatile bool cancel_pressed;
 extern PGconn *cancelConn;
 
 #ifndef WIN32
-void		handle_sigint(SIGNAL_ARGS);
+extern void		handle_sigint(SIGNAL_ARGS);
 
 #endif	 /* not WIN32 */
 
-PGresult   *PSQLexec(const char *query);
+extern PGresult   *PSQLexec(const char *query);
 
-bool		SendQuery(const char *query);
+extern bool		SendQuery(const char *query);
 
 #endif	 /* COMMON_H */
diff --git a/src/include/c.h b/src/include/c.h
index 37d360d941b7d5291e792a0369ee3829c608ebf7..372e548f8af2d1f41aed467c9b29192f0e90d628 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -12,7 +12,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: c.h,v 1.101 2001/08/27 23:02:25 tgl Exp $
+ * $Id: c.h,v 1.102 2001/10/03 21:58:28 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -634,13 +634,13 @@ typedef NameData *Name;
  */
 
 #ifndef HAVE_SNPRINTF_DECL
-extern int	snprintf(char *str, size_t count, const char *fmt,...);
-
+extern int	snprintf(char *str, size_t count, const char *fmt, ...)
+/* This extension allows gcc to check the format string */
+__attribute__((format(printf, 3, 4)));
 #endif
 
 #ifndef HAVE_VSNPRINTF_DECL
 extern int	vsnprintf(char *str, size_t count, const char *fmt, va_list args);
-
 #endif
 
 #if !defined(HAVE_MEMMOVE) && !defined(memmove)
diff --git a/src/include/lib/stringinfo.h b/src/include/lib/stringinfo.h
index 2ddff7053c25a6975a780847d30ff22bd5a3a71c..6f1406ff1610489c5009e81dc2a3f5ad680ceb98 100644
--- a/src/include/lib/stringinfo.h
+++ b/src/include/lib/stringinfo.h
@@ -10,7 +10,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: stringinfo.h,v 1.19 2001/01/24 19:43:24 momjian Exp $
+ * $Id: stringinfo.h,v 1.20 2001/10/03 21:58:28 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -81,7 +81,9 @@ extern void initStringInfo(StringInfo str);
  * to str if necessary.  This is sort of like a combination of sprintf and
  * strcat.
  */
-extern void appendStringInfo(StringInfo str, const char *fmt,...);
+extern void appendStringInfo(StringInfo str, const char *fmt, ...)
+/* This extension allows gcc to check the format string */
+__attribute__((format(printf, 2, 3)));
 
 /*------------------------
  * appendStringInfoChar
diff --git a/src/include/postgres.h b/src/include/postgres.h
index 964f1eaef1f8aabd3f1e43ba4b7fbf667497e818..3ae7bc44f819086520f91e0a450793500d529c68 100644
--- a/src/include/postgres.h
+++ b/src/include/postgres.h
@@ -10,7 +10,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1995, Regents of the University of California
  *
- * $Id: postgres.h,v 1.52 2001/08/24 22:46:28 petere Exp $
+ * $Id: postgres.h,v 1.53 2001/10/03 21:58:28 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -562,7 +562,10 @@ extern DLLIMPORT bool assert_enabled;
 extern int ExceptionalCondition(char *conditionName,
 					 Exception *exceptionP, char *details,
 					 char *fileName, int lineNumber);
-extern char *vararg_format(const char *fmt,...);
+
+extern char *vararg_format(const char *fmt, ...)
+/* This lets gcc check the format string for consistency. */
+__attribute__((format(printf, 1, 2)));
 
 #ifndef USE_ASSERT_CHECKING
 #define LogAssert(condition, printArgs)
diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h
index 580ac0f0698010b7e38c7500a38bebc91bde0740..6b088e94d7f676737ba77810f03a783b6f6cdd30 100644
--- a/src/interfaces/libpq/libpq-int.h
+++ b/src/interfaces/libpq/libpq-int.h
@@ -12,7 +12,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: libpq-int.h,v 1.39 2001/08/17 02:59:20 momjian Exp $
+ * $Id: libpq-int.h,v 1.40 2001/10/03 21:58:28 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -346,10 +346,7 @@ extern int	pqWriteReady(PGconn *conn);
 
 #ifdef ENABLE_NLS
 extern char * libpq_gettext(const char *msgid)
-#ifdef __GNUC__
-__attribute__((format_arg(1)))
-#endif
-;
+__attribute__((format_arg(1)));
 #else
 #define libpq_gettext(x) (x)
 #endif
diff --git a/src/interfaces/libpq/pqexpbuffer.h b/src/interfaces/libpq/pqexpbuffer.h
index 7d5b07f7302480ee3825de00eaa14a3fdc809601..0db0806595a2924793cff6ae30437956aafa0581 100644
--- a/src/interfaces/libpq/pqexpbuffer.h
+++ b/src/interfaces/libpq/pqexpbuffer.h
@@ -18,7 +18,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pqexpbuffer.h,v 1.6 2001/01/24 19:43:31 momjian Exp $
+ * $Id: pqexpbuffer.h,v 1.7 2001/10/03 21:58:28 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -122,7 +122,9 @@ extern int	enlargePQExpBuffer(PQExpBuffer str, size_t needed);
  * This is a convenience routine that does the same thing as
  * resetPQExpBuffer() followed by appendPQExpBuffer().
  */
-extern void printfPQExpBuffer(PQExpBuffer str, const char *fmt,...);
+extern void printfPQExpBuffer(PQExpBuffer str, const char *fmt, ...)
+/* This extension allows gcc to check the format string */
+__attribute__((format(printf, 2, 3)));
 
 /*------------------------
  * appendPQExpBuffer
@@ -131,7 +133,9 @@ extern void printfPQExpBuffer(PQExpBuffer str, const char *fmt,...);
  * to str if necessary.  This is sort of like a combination of sprintf and
  * strcat.
  */
-extern void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...);
+extern void appendPQExpBuffer(PQExpBuffer str, const char *fmt, ...)
+/* This extension allows gcc to check the format string */
+__attribute__((format(printf, 2, 3)));
 
 /*------------------------
  * appendPQExpBufferStr