summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2015-03-26 18:03:19 +0000
committerTom Lane2015-03-26 18:03:25 +0000
commit785941cdc359c6e595201ffb0df9d28f3f7173a4 (patch)
treef1cb5a309c53bf1b9112bc51e99c94bfa55f77c7 /src/include
parentd04c8ed9044eccebce043143a930617e3998c005 (diff)
Tweak __attribute__-wrapping macros for better pgindent results.
This improves on commit bbfd7edae5aa5ad5553d3c7e102f2e450d4380d4 by making two simple changes: * pg_attribute_noreturn now takes parentheses, ie pg_attribute_noreturn(). Likewise pg_attribute_unused(), pg_attribute_packed(). This reduces pgindent's tendency to misformat declarations involving them. * attributes are now always attached to function declarations, not definitions. Previously some places were taking creative shortcuts, which were not merely candidates for bad misformatting by pgindent but often were outright wrong anyway. (It does little good to put a noreturn annotation where callers can't see it.) In any case, if we would like to believe that these macros can be used with non-gcc compilers, we should avoid gratuitous variance in usage patterns. I also went through and manually improved the formatting of a lot of declarations, and got rid of excessively repetitive (and now obsolete anyway) comments informing the reader what pg_attribute_printf is for.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/bootstrap/bootstrap.h4
-rw-r--r--src/include/c.h24
-rw-r--r--src/include/common/fe_memutils.h8
-rw-r--r--src/include/lib/stringinfo.h9
-rw-r--r--src/include/mb/pg_wchar.h4
-rw-r--r--src/include/parser/parse_relation.h4
-rw-r--r--src/include/parser/scanner.h2
-rw-r--r--src/include/pgstat.h2
-rw-r--r--src/include/port.h20
-rw-r--r--src/include/postgres.h2
-rw-r--r--src/include/postmaster/autovacuum.h4
-rw-r--r--src/include/postmaster/bgworker_internals.h2
-rw-r--r--src/include/postmaster/bgwriter.h4
-rw-r--r--src/include/postmaster/pgarch.h2
-rw-r--r--src/include/postmaster/postmaster.h4
-rw-r--r--src/include/postmaster/startup.h2
-rw-r--r--src/include/postmaster/syslogger.h2
-rw-r--r--src/include/postmaster/walwriter.h2
-rw-r--r--src/include/replication/walreceiver.h2
-rw-r--r--src/include/replication/walsender_private.h2
-rw-r--r--src/include/storage/ipc.h2
-rw-r--r--src/include/storage/itemptr.h2
-rw-r--r--src/include/storage/lock.h2
-rw-r--r--src/include/tcop/tcopprot.h6
-rw-r--r--src/include/utils/datetime.h2
-rw-r--r--src/include/utils/elog.h113
-rw-r--r--src/include/utils/help_config.h2
-rw-r--r--src/include/utils/palloc.h8
28 files changed, 80 insertions, 162 deletions
diff --git a/src/include/bootstrap/bootstrap.h b/src/include/bootstrap/bootstrap.h
index 3734afb468a..af9fc75a743 100644
--- a/src/include/bootstrap/bootstrap.h
+++ b/src/include/bootstrap/bootstrap.h
@@ -32,7 +32,7 @@ extern Form_pg_attribute attrtypes[MAXATTR];
extern int numattr;
-extern void AuxiliaryProcessMain(int argc, char *argv[]) pg_attribute_noreturn;
+extern void AuxiliaryProcessMain(int argc, char *argv[]) pg_attribute_noreturn();
extern void err_out(void);
@@ -61,6 +61,6 @@ extern void boot_get_type_io_data(Oid typid,
extern int boot_yyparse(void);
extern int boot_yylex(void);
-extern void boot_yyerror(const char *str) pg_attribute_noreturn;
+extern void boot_yyerror(const char *str) pg_attribute_noreturn();
#endif /* BOOTSTRAP_H */
diff --git a/src/include/c.h b/src/include/c.h
index e7ee5105a27..fd301b6da64 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -621,9 +621,9 @@ typedef NameData *Name;
/* only GCC supports the unused attribute */
#ifdef __GNUC__
-#define pg_attribute_unused __attribute__((unused))
+#define pg_attribute_unused() __attribute__((unused))
#else
-#define pg_attribute_unused
+#define pg_attribute_unused()
#endif
/* GCC and XLC support format attributes */
@@ -638,15 +638,16 @@ typedef NameData *Name;
/* GCC, Sunpro and XLC support aligned, packed and noreturn */
#if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__IBMC__)
#define pg_attribute_aligned(a) __attribute__((aligned(a)))
-#define pg_attribute_noreturn __attribute__((noreturn))
-#define pg_attribute_packed __attribute__((packed))
+#define pg_attribute_noreturn() __attribute__((noreturn))
+#define pg_attribute_packed() __attribute__((packed))
+#define HAVE_PG_ATTRIBUTE_NORETURN 1
#else
/*
- * NB: aligned and packed are not defined as empty as they affect code
- * functionality; they must be implemented by the compiler if they are to be
- * used.
+ * NB: aligned and packed are not given default definitions because they
+ * affect code functionality; they *must* be implemented by the compiler
+ * if they are to be used.
*/
-#define pg_attribute_noreturn
+#define pg_attribute_noreturn()
#endif
/* ----------------------------------------------------------------
@@ -995,7 +996,7 @@ typedef NameData *Name;
#ifdef USE_ASSERT_CHECKING
#define PG_USED_FOR_ASSERTS_ONLY
#else
-#define PG_USED_FOR_ASSERTS_ONLY pg_attribute_unused
+#define PG_USED_FOR_ASSERTS_ONLY pg_attribute_unused()
#endif
@@ -1059,10 +1060,7 @@ typedef NameData *Name;
*/
#if !HAVE_DECL_SNPRINTF
-extern int
-snprintf(char *str, size_t count, const char *fmt,...)
-/* This extension allows gcc to check the format string */
-pg_attribute_printf(3, 4);
+extern int snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3, 4);
#endif
#if !HAVE_DECL_VSNPRINTF
diff --git a/src/include/common/fe_memutils.h b/src/include/common/fe_memutils.h
index 33123cb5044..db7cb3e3318 100644
--- a/src/include/common/fe_memutils.h
+++ b/src/include/common/fe_memutils.h
@@ -24,11 +24,7 @@ extern void *repalloc(void *pointer, Size size);
extern void pfree(void *pointer);
/* sprintf into a palloc'd buffer --- these are in psprintf.c */
-extern char *
-psprintf(const char *fmt,...)
-pg_attribute_printf(1, 2);
-extern size_t
-pvsnprintf(char *buf, size_t len, const char *fmt, va_list args)
-pg_attribute_printf(3, 0);
+extern char *psprintf(const char *fmt,...) pg_attribute_printf(1, 2);
+extern size_t pvsnprintf(char *buf, size_t len, const char *fmt, va_list args) pg_attribute_printf(3, 0);
#endif /* FE_MEMUTILS_H */
diff --git a/src/include/lib/stringinfo.h b/src/include/lib/stringinfo.h
index fdb828508ea..00c25b6edd5 100644
--- a/src/include/lib/stringinfo.h
+++ b/src/include/lib/stringinfo.h
@@ -92,10 +92,7 @@ extern void resetStringInfo(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,...)
-/* This extension allows gcc to check the format string */
-pg_attribute_printf(2, 3);
+extern void appendStringInfo(StringInfo str, const char *fmt,...) pg_attribute_printf(2, 3);
/*------------------------
* appendStringInfoVA
@@ -106,9 +103,7 @@ pg_attribute_printf(2, 3);
* pass the return value to enlargeStringInfo() before trying again; see
* appendStringInfo for standard usage pattern.
*/
-extern int
-appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
-pg_attribute_printf(2, 0);
+extern int appendStringInfoVA(StringInfo str, const char *fmt, va_list args) pg_attribute_printf(2, 0);
/*------------------------
* appendStringInfoString
diff --git a/src/include/mb/pg_wchar.h b/src/include/mb/pg_wchar.h
index 0a2234d35ac..254cf678d61 100644
--- a/src/include/mb/pg_wchar.h
+++ b/src/include/mb/pg_wchar.h
@@ -514,9 +514,9 @@ extern void check_encoding_conversion_args(int src_encoding,
int expected_src_encoding,
int expected_dest_encoding);
-extern void report_invalid_encoding(int encoding, const char *mbstr, int len) pg_attribute_noreturn;
+extern void report_invalid_encoding(int encoding, const char *mbstr, int len) pg_attribute_noreturn();
extern void report_untranslatable_char(int src_encoding, int dest_encoding,
- const char *mbstr, int len) pg_attribute_noreturn;
+ const char *mbstr, int len) pg_attribute_noreturn();
extern void pg_ascii2mic(const unsigned char *l, unsigned char *p, int len);
extern void pg_mic2ascii(const unsigned char *mic, unsigned char *p, int len);
diff --git a/src/include/parser/parse_relation.h b/src/include/parser/parse_relation.h
index 9dc0d5846b0..ce563dea256 100644
--- a/src/include/parser/parse_relation.h
+++ b/src/include/parser/parse_relation.h
@@ -104,9 +104,9 @@ extern bool isLockedRefname(ParseState *pstate, const char *refname);
extern void addRTEtoQuery(ParseState *pstate, RangeTblEntry *rte,
bool addToJoinList,
bool addToRelNameSpace, bool addToVarNameSpace);
-extern void errorMissingRTE(ParseState *pstate, RangeVar *relation) pg_attribute_noreturn;
+extern void errorMissingRTE(ParseState *pstate, RangeVar *relation) pg_attribute_noreturn();
extern void errorMissingColumn(ParseState *pstate,
- char *relname, char *colname, int location) pg_attribute_noreturn;
+ char *relname, char *colname, int location) pg_attribute_noreturn();
extern void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up,
int location, bool include_dropped,
List **colnames, List **colvars);
diff --git a/src/include/parser/scanner.h b/src/include/parser/scanner.h
index f941977865a..9e38c0d1971 100644
--- a/src/include/parser/scanner.h
+++ b/src/include/parser/scanner.h
@@ -125,6 +125,6 @@ extern void scanner_finish(core_yyscan_t yyscanner);
extern int core_yylex(core_YYSTYPE *lvalp, YYLTYPE *llocp,
core_yyscan_t yyscanner);
extern int scanner_errposition(int location, core_yyscan_t yyscanner);
-extern void scanner_yyerror(const char *message, core_yyscan_t yyscanner) pg_attribute_noreturn;
+extern void scanner_yyerror(const char *message, core_yyscan_t yyscanner) pg_attribute_noreturn();
#endif /* SCANNER_H */
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index 64cc8e2e7c8..f2b2257a115 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -875,7 +875,7 @@ extern void pgstat_reset_all(void);
extern void allow_immediate_pgstat_restart(void);
#ifdef EXEC_BACKEND
-extern void PgstatCollectorMain(int argc, char *argv[]) pg_attribute_noreturn;
+extern void PgstatCollectorMain(int argc, char *argv[]) pg_attribute_noreturn();
#endif
diff --git a/src/include/port.h b/src/include/port.h
index 29854dd752e..3787cbfb761 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -153,23 +153,11 @@ extern unsigned char pg_ascii_tolower(unsigned char ch);
#endif
extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
-extern int
-pg_snprintf(char *str, size_t count, const char *fmt,...)
-/* This extension allows gcc to check the format string */
-pg_attribute_printf(3, 4);
-extern int
-pg_sprintf(char *str, const char *fmt,...)
-/* This extension allows gcc to check the format string */
-pg_attribute_printf(2, 3);
+extern int pg_snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3, 4);
+extern int pg_sprintf(char *str, const char *fmt,...) pg_attribute_printf(2, 3);
extern int pg_vfprintf(FILE *stream, const char *fmt, va_list args);
-extern int
-pg_fprintf(FILE *stream, const char *fmt,...)
-/* This extension allows gcc to check the format string */
-pg_attribute_printf(2, 3);
-extern int
-pg_printf(const char *fmt,...)
-/* This extension allows gcc to check the format string */
-pg_attribute_printf(1, 2);
+extern int pg_fprintf(FILE *stream, const char *fmt,...) pg_attribute_printf(2, 3);
+extern int pg_printf(const char *fmt,...) pg_attribute_printf(1, 2);
/*
* The GCC-specific code below prevents the pg_attribute_printf above from
diff --git a/src/include/postgres.h b/src/include/postgres.h
index ff30e05bfc8..be37313fa5a 100644
--- a/src/include/postgres.h
+++ b/src/include/postgres.h
@@ -687,6 +687,6 @@ extern Datum Float8GetDatum(float8 X);
*/
extern void ExceptionalCondition(const char *conditionName,
const char *errorType,
- const char *fileName, int lineNumber) pg_attribute_noreturn;
+ const char *fileName, int lineNumber) pg_attribute_noreturn();
#endif /* POSTGRES_H */
diff --git a/src/include/postmaster/autovacuum.h b/src/include/postmaster/autovacuum.h
index 0bd50443aeb..6eaaf4c1c4e 100644
--- a/src/include/postmaster/autovacuum.h
+++ b/src/include/postmaster/autovacuum.h
@@ -54,8 +54,8 @@ extern void AutoVacWorkerFailed(void);
extern void AutoVacuumUpdateDelay(void);
#ifdef EXEC_BACKEND
-extern void AutoVacLauncherMain(int argc, char *argv[]) pg_attribute_noreturn;
-extern void AutoVacWorkerMain(int argc, char *argv[]) pg_attribute_noreturn;
+extern void AutoVacLauncherMain(int argc, char *argv[]) pg_attribute_noreturn();
+extern void AutoVacWorkerMain(int argc, char *argv[]) pg_attribute_noreturn();
extern void AutovacuumWorkerIAm(void);
extern void AutovacuumLauncherIAm(void);
#endif
diff --git a/src/include/postmaster/bgworker_internals.h b/src/include/postmaster/bgworker_internals.h
index fe7c328afd1..b0ab4c22ba7 100644
--- a/src/include/postmaster/bgworker_internals.h
+++ b/src/include/postmaster/bgworker_internals.h
@@ -46,7 +46,7 @@ extern void BackgroundWorkerStopNotifications(pid_t pid);
extern void ResetBackgroundWorkerCrashTimes(void);
/* Function to start a background worker, called from postmaster.c */
-extern void StartBackgroundWorker(void) pg_attribute_noreturn;
+extern void StartBackgroundWorker(void) pg_attribute_noreturn();
#ifdef EXEC_BACKEND
extern BackgroundWorker *BackgroundWorkerEntry(int slotno);
diff --git a/src/include/postmaster/bgwriter.h b/src/include/postmaster/bgwriter.h
index f584d857872..a49c208dd2a 100644
--- a/src/include/postmaster/bgwriter.h
+++ b/src/include/postmaster/bgwriter.h
@@ -25,8 +25,8 @@ extern int CheckPointTimeout;
extern int CheckPointWarning;
extern double CheckPointCompletionTarget;
-extern void BackgroundWriterMain(void) pg_attribute_noreturn;
-extern void CheckpointerMain(void) pg_attribute_noreturn;
+extern void BackgroundWriterMain(void) pg_attribute_noreturn();
+extern void CheckpointerMain(void) pg_attribute_noreturn();
extern void RequestCheckpoint(int flags);
extern void CheckpointWriteDelay(int flags, double progress);
diff --git a/src/include/postmaster/pgarch.h b/src/include/postmaster/pgarch.h
index 60e4f50368d..9f692eb47fb 100644
--- a/src/include/postmaster/pgarch.h
+++ b/src/include/postmaster/pgarch.h
@@ -33,7 +33,7 @@
extern int pgarch_start(void);
#ifdef EXEC_BACKEND
-extern void PgArchiverMain(int argc, char *argv[]) pg_attribute_noreturn;
+extern void PgArchiverMain(int argc, char *argv[]) pg_attribute_noreturn();
#endif
#endif /* _PGARCH_H */
diff --git a/src/include/postmaster/postmaster.h b/src/include/postmaster/postmaster.h
index d41761fc7a1..d16030482fa 100644
--- a/src/include/postmaster/postmaster.h
+++ b/src/include/postmaster/postmaster.h
@@ -46,7 +46,7 @@ extern int postmaster_alive_fds[2];
extern const char *progname;
-extern void PostmasterMain(int argc, char *argv[]) pg_attribute_noreturn;
+extern void PostmasterMain(int argc, char *argv[]) pg_attribute_noreturn();
extern void ClosePostmasterPorts(bool am_syslogger);
extern int MaxLivePostmasterChildren(void);
@@ -56,7 +56,7 @@ extern bool PostmasterMarkPIDForWorkerNotify(int);
#ifdef EXEC_BACKEND
extern pid_t postmaster_forkexec(int argc, char *argv[]);
-extern void SubPostmasterMain(int argc, char *argv[]) pg_attribute_noreturn;
+extern void SubPostmasterMain(int argc, char *argv[]) pg_attribute_noreturn();
extern Size ShmemBackendArraySize(void);
extern void ShmemBackendArrayAllocation(void);
diff --git a/src/include/postmaster/startup.h b/src/include/postmaster/startup.h
index 9a2092e5f28..e1fd4b100e0 100644
--- a/src/include/postmaster/startup.h
+++ b/src/include/postmaster/startup.h
@@ -13,7 +13,7 @@
#define _STARTUP_H
extern void HandleStartupProcInterrupts(void);
-extern void StartupProcessMain(void) pg_attribute_noreturn;
+extern void StartupProcessMain(void) pg_attribute_noreturn();
extern void PreRestoreCommand(void);
extern void PostRestoreCommand(void);
extern bool IsPromoteTriggered(void);
diff --git a/src/include/postmaster/syslogger.h b/src/include/postmaster/syslogger.h
index d6a05d5a209..dc9f02cd424 100644
--- a/src/include/postmaster/syslogger.h
+++ b/src/include/postmaster/syslogger.h
@@ -84,7 +84,7 @@ extern int SysLogger_Start(void);
extern void write_syslogger_file(const char *buffer, int count, int dest);
#ifdef EXEC_BACKEND
-extern void SysLoggerMain(int argc, char *argv[]) pg_attribute_noreturn;
+extern void SysLoggerMain(int argc, char *argv[]) pg_attribute_noreturn();
#endif
#endif /* _SYSLOGGER_H */
diff --git a/src/include/postmaster/walwriter.h b/src/include/postmaster/walwriter.h
index 55de6c73e4a..1ab7d3d66e2 100644
--- a/src/include/postmaster/walwriter.h
+++ b/src/include/postmaster/walwriter.h
@@ -15,6 +15,6 @@
/* GUC options */
extern int WalWriterDelay;
-extern void WalWriterMain(void) pg_attribute_noreturn;
+extern void WalWriterMain(void) pg_attribute_noreturn();
#endif /* _WALWRITER_H */
diff --git a/src/include/replication/walreceiver.h b/src/include/replication/walreceiver.h
index 4afdf91a6dc..61255a9f8e9 100644
--- a/src/include/replication/walreceiver.h
+++ b/src/include/replication/walreceiver.h
@@ -147,7 +147,7 @@ typedef void (*walrcv_disconnect_type) (void);
extern PGDLLIMPORT walrcv_disconnect_type walrcv_disconnect;
/* prototypes for functions in walreceiver.c */
-extern void WalReceiverMain(void) pg_attribute_noreturn;
+extern void WalReceiverMain(void) pg_attribute_noreturn();
/* prototypes for functions in walreceiverfuncs.c */
extern Size WalRcvShmemSize(void);
diff --git a/src/include/replication/walsender_private.h b/src/include/replication/walsender_private.h
index 40351da47fd..6dae4802852 100644
--- a/src/include/replication/walsender_private.h
+++ b/src/include/replication/walsender_private.h
@@ -102,7 +102,7 @@ extern void WalSndSetState(WalSndState state);
*/
extern int replication_yyparse(void);
extern int replication_yylex(void);
-extern void replication_yyerror(const char *str);
+extern void replication_yyerror(const char *str) pg_attribute_noreturn();
extern void replication_scanner_init(const char *query_string);
extern void replication_scanner_finish(void);
diff --git a/src/include/storage/ipc.h b/src/include/storage/ipc.h
index 7da434e7987..c6283c2af34 100644
--- a/src/include/storage/ipc.h
+++ b/src/include/storage/ipc.h
@@ -64,7 +64,7 @@ typedef void (*shmem_startup_hook_type) (void);
/* ipc.c */
extern PGDLLIMPORT bool proc_exit_inprogress;
-extern void proc_exit(int code) pg_attribute_noreturn;
+extern void proc_exit(int code) pg_attribute_noreturn();
extern void shmem_exit(int code);
extern void on_proc_exit(pg_on_exit_callback function, Datum arg);
extern void on_shmem_exit(pg_on_exit_callback function, Datum arg);
diff --git a/src/include/storage/itemptr.h b/src/include/storage/itemptr.h
index 1f0ea7db552..eb06c794d2b 100644
--- a/src/include/storage/itemptr.h
+++ b/src/include/storage/itemptr.h
@@ -41,7 +41,7 @@ typedef struct ItemPointerData
}
#ifdef __arm__
-pg_attribute_packed /* Appropriate whack upside the head for ARM */
+pg_attribute_packed() /* Appropriate whack upside the head for ARM */
#endif
ItemPointerData;
diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h
index 1477a6fe3d1..dae517f3fe0 100644
--- a/src/include/storage/lock.h
+++ b/src/include/storage/lock.h
@@ -547,7 +547,7 @@ extern void lock_twophase_standby_recover(TransactionId xid, uint16 info,
extern DeadLockState DeadLockCheck(PGPROC *proc);
extern PGPROC *GetBlockingAutoVacuumPgproc(void);
-extern void DeadLockReport(void) pg_attribute_noreturn;
+extern void DeadLockReport(void) pg_attribute_noreturn();
extern void RememberSimpleDeadLock(PGPROC *proc1,
LOCKMODE lockmode,
LOCK *lock,
diff --git a/src/include/tcop/tcopprot.h b/src/include/tcop/tcopprot.h
index b3c705f97b6..96c5b8b3d44 100644
--- a/src/include/tcop/tcopprot.h
+++ b/src/include/tcop/tcopprot.h
@@ -62,9 +62,9 @@ extern bool check_max_stack_depth(int *newval, void **extra, GucSource source);
extern void assign_max_stack_depth(int newval, void *extra);
extern void die(SIGNAL_ARGS);
-extern void quickdie(SIGNAL_ARGS) pg_attribute_noreturn;
+extern void quickdie(SIGNAL_ARGS) pg_attribute_noreturn();
extern void StatementCancelHandler(SIGNAL_ARGS);
-extern void FloatExceptionHandler(SIGNAL_ARGS) pg_attribute_noreturn;
+extern void FloatExceptionHandler(SIGNAL_ARGS) pg_attribute_noreturn();
extern void RecoveryConflictInterrupt(ProcSignalReason reason); /* called from SIGUSR1
* handler */
extern void ProcessClientReadInterrupt(bool blocked);
@@ -74,7 +74,7 @@ extern void process_postgres_switches(int argc, char *argv[],
GucContext ctx, const char **dbname);
extern void PostgresMain(int argc, char *argv[],
const char *dbname,
- const char *username) pg_attribute_noreturn;
+ const char *username) pg_attribute_noreturn();
extern long get_stack_depth_rlimit(void);
extern void ResetUsage(void);
extern void ShowUsage(const char *title);
diff --git a/src/include/utils/datetime.h b/src/include/utils/datetime.h
index 3a2335523d0..5b86ca10ef6 100644
--- a/src/include/utils/datetime.h
+++ b/src/include/utils/datetime.h
@@ -315,7 +315,7 @@ extern int DecodeISO8601Interval(char *str,
int *dtype, struct pg_tm * tm, fsec_t *fsec);
extern void DateTimeParseError(int dterr, const char *str,
- const char *datatype) pg_attribute_noreturn;
+ const char *datatype) pg_attribute_noreturn();
extern int DetermineTimeZoneOffset(struct pg_tm * tm, pg_tz *tzp);
extern int DetermineTimeZoneAbbrevOffset(struct pg_tm * tm, const char *abbr, pg_tz *tzp);
diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h
index a82063a57b1..8e906611953 100644
--- a/src/include/utils/elog.h
+++ b/src/include/utils/elog.h
@@ -143,65 +143,25 @@ extern int errcode(int sqlerrcode);
extern int errcode_for_file_access(void);
extern int errcode_for_socket_access(void);
-extern int
-errmsg(const char *fmt,...)
-/* This extension allows gcc to check the format string for consistency with
- the supplied arguments. */
-pg_attribute_printf(1, 2);
-
-extern int
-errmsg_internal(const char *fmt,...)
-/* This extension allows gcc to check the format string for consistency with
- the supplied arguments. */
-pg_attribute_printf(1, 2);
-
-extern int
-errmsg_plural(const char *fmt_singular, const char *fmt_plural,
- unsigned long n,...)
-/* This extension allows gcc to check the format string for consistency with
- the supplied arguments. */
-pg_attribute_printf(1, 4)
-pg_attribute_printf(2, 4);
-
-extern int
-errdetail(const char *fmt,...)
-/* This extension allows gcc to check the format string for consistency with
- the supplied arguments. */
-pg_attribute_printf(1, 2);
-
-extern int
-errdetail_internal(const char *fmt,...)
-/* This extension allows gcc to check the format string for consistency with
- the supplied arguments. */
-pg_attribute_printf(1, 2);
-
-extern int
-errdetail_log(const char *fmt,...)
-/* This extension allows gcc to check the format string for consistency with
- the supplied arguments. */
-pg_attribute_printf(1, 2);
-
-extern int
-errdetail_log_plural(const char *fmt_singular, const char *fmt_plural,
- unsigned long n,...)
-/* This extension allows gcc to check the format string for consistency with
- the supplied arguments. */
-pg_attribute_printf(1, 4)
-pg_attribute_printf(2, 4);
-
-extern int
-errdetail_plural(const char *fmt_singular, const char *fmt_plural,
- unsigned long n,...)
-/* This extension allows gcc to check the format string for consistency with
- the supplied arguments. */
-pg_attribute_printf(1, 4)
-pg_attribute_printf(2, 4);
-
-extern int
-errhint(const char *fmt,...)
-/* This extension allows gcc to check the format string for consistency with
- the supplied arguments. */
-pg_attribute_printf(1, 2);
+extern int errmsg(const char *fmt,...) pg_attribute_printf(1, 2);
+extern int errmsg_internal(const char *fmt,...) pg_attribute_printf(1, 2);
+
+extern int errmsg_plural(const char *fmt_singular, const char *fmt_plural,
+ unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4);
+
+extern int errdetail(const char *fmt,...) pg_attribute_printf(1, 2);
+extern int errdetail_internal(const char *fmt,...) pg_attribute_printf(1, 2);
+
+extern int errdetail_log(const char *fmt,...) pg_attribute_printf(1, 2);
+
+extern int errdetail_log_plural(const char *fmt_singular,
+ const char *fmt_plural,
+ unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4);
+
+extern int errdetail_plural(const char *fmt_singular, const char *fmt_plural,
+ unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4);
+
+extern int errhint(const char *fmt,...) pg_attribute_printf(1, 2);
/*
* errcontext() is typically called in error context callback functions, not
@@ -214,11 +174,8 @@ pg_attribute_printf(1, 2);
#define errcontext set_errcontext_domain(TEXTDOMAIN), errcontext_msg
extern int set_errcontext_domain(const char *domain);
-extern int
-errcontext_msg(const char *fmt,...)
-/* This extension allows gcc to check the format string for consistency with
- the supplied arguments. */
-pg_attribute_printf(1, 2);
+
+extern int errcontext_msg(const char *fmt,...) pg_attribute_printf(1, 2);
extern int errhidestmt(bool hide_stmt);
extern int errhidecontext(bool hide_ctx);
@@ -274,21 +231,13 @@ extern int getinternalerrposition(void);
#endif /* HAVE__VA_ARGS */
extern void elog_start(const char *filename, int lineno, const char *funcname);
-extern void
-elog_finish(int elevel, const char *fmt,...)
-/* This extension allows gcc to check the format string for consistency with
- the supplied arguments. */
-pg_attribute_printf(2, 3);
+extern void elog_finish(int elevel, const char *fmt,...) pg_attribute_printf(2, 3);
/* Support for constructing error strings separately from ereport() calls */
extern void pre_format_elog_string(int errnumber, const char *domain);
-extern char *
-format_elog_string(const char *fmt,...)
-/* This extension allows gcc to check the format string for consistency with
- the supplied arguments. */
-pg_attribute_printf(1, 2);
+extern char *format_elog_string(const char *fmt,...) pg_attribute_printf(1, 2);
/* Support for attaching context information to error reports */
@@ -364,10 +313,10 @@ extern PGDLLIMPORT ErrorContextCallback *error_context_stack;
} while (0)
/*
- * gcc understands pg_attribute_noreturn; for other compilers, insert
- * pg_unreachable() so that the compiler gets the point.
+ * Some compilers understand pg_attribute_noreturn(); for other compilers,
+ * insert pg_unreachable() so that the compiler gets the point.
*/
-#ifdef __GNUC__
+#ifdef HAVE_PG_ATTRIBUTE_NORETURN
#define PG_RE_THROW() \
pg_re_throw()
#else
@@ -423,9 +372,9 @@ extern void EmitErrorReport(void);
extern ErrorData *CopyErrorData(void);
extern void FreeErrorData(ErrorData *edata);
extern void FlushErrorState(void);
-extern void ReThrowError(ErrorData *edata) pg_attribute_noreturn;
+extern void ReThrowError(ErrorData *edata) pg_attribute_noreturn();
extern void ThrowErrorData(ErrorData *edata);
-extern void pg_re_throw(void) pg_attribute_noreturn;
+extern void pg_re_throw(void) pg_attribute_noreturn();
extern char *GetErrorContextStack(void);
@@ -468,10 +417,6 @@ extern void set_syslog_parameters(const char *ident, int facility);
* not available). Used before ereport/elog can be used
* safely (memory context, GUC load etc)
*/
-extern void
-write_stderr(const char *fmt,...)
-/* This extension allows gcc to check the format string for consistency with
- the supplied arguments. */
-pg_attribute_printf(1, 2);
+extern void write_stderr(const char *fmt,...) pg_attribute_printf(1, 2);
#endif /* ELOG_H */
diff --git a/src/include/utils/help_config.h b/src/include/utils/help_config.h
index af529964003..54e3ec79667 100644
--- a/src/include/utils/help_config.h
+++ b/src/include/utils/help_config.h
@@ -12,6 +12,6 @@
#ifndef HELP_CONFIG_H
#define HELP_CONFIG_H 1
-extern void GucInfoMain(void) pg_attribute_noreturn;
+extern void GucInfoMain(void) pg_attribute_noreturn();
#endif
diff --git a/src/include/utils/palloc.h b/src/include/utils/palloc.h
index bd8767520e3..2cf51298331 100644
--- a/src/include/utils/palloc.h
+++ b/src/include/utils/palloc.h
@@ -136,11 +136,7 @@ extern char *pstrdup(const char *in);
extern char *pnstrdup(const char *in, Size len);
/* sprintf into a palloc'd buffer --- these are in psprintf.c */
-extern char *
-psprintf(const char *fmt,...)
-pg_attribute_printf(1, 2);
-extern size_t
-pvsnprintf(char *buf, size_t len, const char *fmt, va_list args)
-pg_attribute_printf(3, 0);
+extern char *psprintf(const char *fmt,...) pg_attribute_printf(1, 2);
+extern size_t pvsnprintf(char *buf, size_t len, const char *fmt, va_list args) pg_attribute_printf(3, 0);
#endif /* PALLOC_H */