diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c index b0305ef431dca7a23272f6a98a6096ff3feae504..b9ccad994a8c000ae9345b3b488e69080b96ebf3 100644 --- a/contrib/cube/cube.c +++ b/contrib/cube/cube.c @@ -26,11 +26,6 @@ PG_MODULE_MAGIC; #define ARRPTR(x) ( (double *) ARR_DATA_PTR(x) ) #define ARRNELEMS(x) ArrayGetNItems( ARR_NDIM(x), ARR_DIMS(x)) -extern int cube_yyparse(NDBOX **result); -extern void cube_yyerror(NDBOX **result, const char *message); -extern void cube_scanner_init(const char *str); -extern void cube_scanner_finish(void); - /* ** Input/Output routines */ diff --git a/contrib/cube/cubedata.h b/contrib/cube/cubedata.h index 719e43d421c4845afba0e0e78d8805ff6426404f..59c23ded6ac6e1368cb3072d5869642746a6d5c0 100644 --- a/contrib/cube/cubedata.h +++ b/contrib/cube/cubedata.h @@ -46,3 +46,12 @@ typedef struct NDBOX #define DatumGetNDBOX(x) ((NDBOX *) PG_DETOAST_DATUM(x)) #define PG_GETARG_NDBOX(x) DatumGetNDBOX(PG_GETARG_DATUM(x)) #define PG_RETURN_NDBOX(x) PG_RETURN_POINTER(x) + +/* in cubescan.l */ +extern int cube_yylex(void); +extern void cube_yyerror(NDBOX **result, const char *message) pg_attribute_noreturn(); +extern void cube_scanner_init(const char *str); +extern void cube_scanner_finish(void); + +/* in cubeparse.y */ +extern int cube_yyparse(NDBOX **result); diff --git a/contrib/cube/cubeparse.y b/contrib/cube/cubeparse.y index 0baee8e13245a930c0b1e6a1285a59eded71aac2..33606c741c5db067bd85071305eb4728a194717a 100644 --- a/contrib/cube/cubeparse.y +++ b/contrib/cube/cubeparse.y @@ -22,14 +22,9 @@ #define YYMALLOC palloc #define YYFREE pfree -extern int cube_yylex(void); - static char *scanbuf; static int scanbuflen; -extern int cube_yyparse(NDBOX **result); -extern void cube_yyerror(NDBOX **result, const char *message); - static int delim_count(char *s, char delim); static NDBOX * write_box(unsigned int dim, char *str1, char *str2); static NDBOX * write_point_as_box(char *s, int dim); diff --git a/contrib/cube/cubescan.l b/contrib/cube/cubescan.l index 1c2522a2398463710ff2a1759e57be87e8d60ad4..4408e28387e5c589d6802ec5766eff0ea62d7680 100644 --- a/contrib/cube/cubescan.l +++ b/contrib/cube/cubescan.l @@ -4,8 +4,6 @@ * contrib/cube/cubescan.l */ -#include "postgres.h" - /* No reason to constrain amount of data slurped */ #define YY_READ_BUF_SIZE 16777216 @@ -24,12 +22,6 @@ static YY_BUFFER_STATE scanbufhandle; /* this is now declared in cubeparse.y: */ /* static char *scanbuf; */ /* static int scanbuflen; */ - -/* flex 2.5.4 doesn't bother with a decl for this */ -int cube_yylex(void); - -void cube_scanner_init(const char *str); -void cube_scanner_finish(void); %} %option 8bit @@ -60,7 +52,7 @@ float ({integer}|{real})([eE]{integer})? %% -void pg_attribute_noreturn +void yyerror(NDBOX **result, const char *message) { if (*yytext == YY_END_OF_BUFFER_CHAR) diff --git a/contrib/pg_upgrade/pg_upgrade.h b/contrib/pg_upgrade/pg_upgrade.h index 9b873adbc089793c4e64989959c6072435fa9595..f6b13c0878601a38d634d76fe0c30ff408b6da45 100644 --- a/contrib/pg_upgrade/pg_upgrade.h +++ b/contrib/pg_upgrade/pg_upgrade.h @@ -356,10 +356,9 @@ void optionally_create_toast_tables(void); /* exec.c */ #define EXEC_PSQL_ARGS "--echo-queries --set ON_ERROR_STOP=on --no-psqlrc --dbname=template1" -bool -exec_prog(const char *log_file, const char *opt_log_file, - bool throw_error, const char *fmt,...) -pg_attribute_printf(4, 5); + +bool exec_prog(const char *log_file, const char *opt_log_file, + bool throw_error, const char *fmt,...) pg_attribute_printf(4, 5); void verify_directories(void); bool pid_lock_file_exists(const char *datadir); @@ -443,9 +442,7 @@ void init_tablespaces(void); /* server.c */ PGconn *connectToServer(ClusterInfo *cluster, const char *db_name); -PGresult * -executeQueryOrDie(PGconn *conn, const char *fmt,...) -pg_attribute_printf(2, 3); +PGresult *executeQueryOrDie(PGconn *conn, const char *fmt,...) pg_attribute_printf(2, 3); char *cluster_conn_opts(ClusterInfo *cluster); @@ -460,19 +457,11 @@ void check_pghost_envvar(void); char *quote_identifier(const char *s); int get_user_info(char **user_name_p); void check_ok(void); -void -report_status(eLogType type, const char *fmt,...) -pg_attribute_printf(2, 3); -void -pg_log(eLogType type, const char *fmt,...) -pg_attribute_printf(2, 3); -void -pg_fatal(const char *fmt,...) -pg_attribute_printf(1, 2) pg_attribute_noreturn; +void report_status(eLogType type, const char *fmt,...) pg_attribute_printf(2, 3); +void pg_log(eLogType type, const char *fmt,...) pg_attribute_printf(2, 3); +void pg_fatal(const char *fmt,...) pg_attribute_printf(1, 2) pg_attribute_noreturn(); void end_progress_output(void); -void -prep_status(const char *fmt,...) -pg_attribute_printf(1, 2); +void prep_status(const char *fmt,...) pg_attribute_printf(1, 2); void check_ok(void); const char *getErrorText(int errNum); unsigned int str2uint(const char *str); @@ -486,10 +475,8 @@ void new_9_0_populate_pg_largeobject_metadata(ClusterInfo *cluster, void old_9_3_check_for_line_data_type_usage(ClusterInfo *cluster); /* parallel.c */ -void -parallel_exec_prog(const char *log_file, const char *opt_log_file, - const char *fmt,...) -pg_attribute_printf(3, 4); +void parallel_exec_prog(const char *log_file, const char *opt_log_file, + const char *fmt,...) pg_attribute_printf(3, 4); void parallel_transfer_all_new_dbs(DbInfoArr *old_db_arr, DbInfoArr *new_db_arr, char *old_pgdata, char *new_pgdata, char *old_tablespace); diff --git a/contrib/pg_upgrade/util.c b/contrib/pg_upgrade/util.c index ce17aa0d47669329aec449cfd5b0c66df1270467..6184ceef933ebf462a7eb0116770d58d1e34361e 100644 --- a/contrib/pg_upgrade/util.c +++ b/contrib/pg_upgrade/util.c @@ -17,6 +17,9 @@ LogOpts log_opts; +static void pg_log_v(eLogType type, const char *fmt, va_list ap) pg_attribute_printf(2, 0); + + /* * report_status() * @@ -81,9 +84,7 @@ prep_status(const char *fmt,...) } -static -pg_attribute_printf(2, 0) -void +static void pg_log_v(eLogType type, const char *fmt, va_list ap) { char message[QUERY_ALLOC]; diff --git a/contrib/pg_xlogdump/pg_xlogdump.c b/contrib/pg_xlogdump/pg_xlogdump.c index 15805be294033d6b32b6dd442b67806bd02659d7..4f297e95720e43c7c2af1f1d65f863669d688a39 100644 --- a/contrib/pg_xlogdump/pg_xlogdump.c +++ b/contrib/pg_xlogdump/pg_xlogdump.c @@ -67,9 +67,7 @@ typedef struct XLogDumpStats Stats record_stats[RM_NEXT_ID][MAX_XLINFO_TYPES]; } XLogDumpStats; -static void -fatal_error(const char *fmt,...) -pg_attribute_printf(1, 2); +static void fatal_error(const char *fmt,...) pg_attribute_printf(1, 2); /* * Big red button to push when things go horribly wrong. diff --git a/contrib/pgcrypto/px.h b/contrib/pgcrypto/px.h index 297747c60a36035808abc4d7a7fc7d9abb75d657..7255ebf04c8ef0a322f8c7f343d016860328defb 100644 --- a/contrib/pgcrypto/px.h +++ b/contrib/pgcrypto/px.h @@ -206,9 +206,7 @@ void px_set_debug_handler(void (*handler) (const char *)); void px_memset(void *ptr, int c, size_t len); #ifdef PX_DEBUG -void -px_debug(const char *fmt,...) -pg_attribute_printf(1, 2); +void px_debug(const char *fmt,...) pg_attribute_printf(1, 2); #else #define px_debug(...) #endif diff --git a/contrib/seg/seg.c b/contrib/seg/seg.c index 0807e238f160eb12fcee33f930e0a855f99f30cb..8e2d5343ae9d28f95942cae5dcbc7dec3418051c 100644 --- a/contrib/seg/seg.c +++ b/contrib/seg/seg.c @@ -23,15 +23,6 @@ PG_MODULE_MAGIC; -extern int seg_yyparse(SEG *result); -extern void seg_yyerror(SEG *result, const char *message); -extern void seg_scanner_init(const char *str); -extern void seg_scanner_finish(void); - -/* -extern int seg_yydebug; -*/ - /* * Auxiliary data structure for picksplit method. */ @@ -103,7 +94,6 @@ bool seg_different(SEG *a, SEG *b); ** Auxiliary funxtions */ static int restore(char *s, float val, int n); -int significant_digits(char *s); /***************************************************************************** diff --git a/contrib/seg/segdata.h b/contrib/seg/segdata.h index 90be6e27aafbe22baf8d74cbc62af3e5f68acdcd..cac68ee2b2ed15b1a063b74c22a8d118279d7e58 100644 --- a/contrib/seg/segdata.h +++ b/contrib/seg/segdata.h @@ -10,3 +10,15 @@ typedef struct SEG char l_ext; char u_ext; } SEG; + +/* in seg.c */ +extern int significant_digits(char *str); + +/* in segscan.l */ +extern int seg_yylex(void); +extern void seg_yyerror(SEG *result, const char *message) pg_attribute_noreturn(); +extern void seg_scanner_init(const char *str); +extern void seg_scanner_finish(void); + +/* in segparse.y */ +extern int seg_yyparse(SEG *result); diff --git a/contrib/seg/segparse.y b/contrib/seg/segparse.y index 3fad9910bd54d382368a352d466ea2c203aa99c8..045ff91f3e7dd2365f4963130108922ccd890308 100644 --- a/contrib/seg/segparse.y +++ b/contrib/seg/segparse.y @@ -7,6 +7,7 @@ #include "fmgr.h" #include "utils/builtins.h" + #include "segdata.h" /* @@ -20,13 +21,6 @@ #define YYMALLOC palloc #define YYFREE pfree -extern int seg_yylex(void); - -extern int significant_digits(char *str); /* defined in seg.c */ - -extern int seg_yyparse(SEG *result); -extern void seg_yyerror(SEG *result, const char *message); - static float seg_atof(char *value); static char strbuf[25] = { diff --git a/contrib/seg/segscan.l b/contrib/seg/segscan.l index 5fe4a2c45378ec9ca4a258c58d359b0de8c124eb..6db24fdd1f79551d6540ee0fd5befbd7a36808e4 100644 --- a/contrib/seg/segscan.l +++ b/contrib/seg/segscan.l @@ -3,8 +3,6 @@ * A scanner for EMP-style numeric ranges */ -#include "postgres.h" - /* No reason to constrain amount of data slurped */ #define YY_READ_BUF_SIZE 16777216 @@ -22,12 +20,6 @@ fprintf_to_ereport(const char *fmt, const char *msg) static YY_BUFFER_STATE scanbufhandle; static char *scanbuf; static int scanbuflen; - -/* flex 2.5.4 doesn't bother with a decl for this */ -int seg_yylex(void); - -void seg_scanner_init(const char *str); -void seg_scanner_finish(void); %} %option 8bit @@ -59,7 +51,7 @@ float ({integer}|{real})([eE]{integer})? %% -void pg_attribute_noreturn +void yyerror(SEG *result, const char *message) { if (*yytext == YY_END_OF_BUFFER_CHAR) diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c index 4a51defc529fb9e6fa0f22cd9d7cc024b626f17c..ba7dfcc0287f7178b13cd1a2713a119b42b3ee71 100644 --- a/src/backend/access/transam/xlogreader.c +++ b/src/backend/access/transam/xlogreader.c @@ -32,11 +32,7 @@ static bool ValidXLogRecord(XLogReaderState *state, XLogRecord *record, XLogRecPtr recptr); static int ReadPageInternal(XLogReaderState *state, XLogRecPtr pageptr, int reqLen); -static void -report_invalid_record(XLogReaderState *state, const char *fmt,...) -/* This extension allows gcc to check the format string for consistency with - the supplied arguments. */ -pg_attribute_printf(2, 3); +static void report_invalid_record(XLogReaderState *state, const char *fmt,...) pg_attribute_printf(2, 3); static void ResetDecoder(XLogReaderState *state); diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 5ccae24b25c9b31f699f70171edac6c26a14c755..c93b412b29785ae29af5e36b503c6116f39bb4c3 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -281,8 +281,8 @@ int AutovacuumLauncherPid = 0; static pid_t avlauncher_forkexec(void); static pid_t avworker_forkexec(void); #endif -NON_EXEC_STATIC void AutoVacWorkerMain(int argc, char *argv[]) pg_attribute_noreturn; -NON_EXEC_STATIC void AutoVacLauncherMain(int argc, char *argv[]) pg_attribute_noreturn; +NON_EXEC_STATIC void AutoVacWorkerMain(int argc, char *argv[]) pg_attribute_noreturn(); +NON_EXEC_STATIC void AutoVacLauncherMain(int argc, char *argv[]) pg_attribute_noreturn(); static Oid do_start_worker(void); static void launcher_determine_sleep(bool canlaunch, bool recursing, diff --git a/src/backend/postmaster/pgarch.c b/src/backend/postmaster/pgarch.c index 800ae9362f8532ee328c2b87e8fdae8a67218909..4df669e14af88acd3daf50893f39ea0fda324c3a 100644 --- a/src/backend/postmaster/pgarch.c +++ b/src/backend/postmaster/pgarch.c @@ -86,7 +86,7 @@ static volatile sig_atomic_t ready_to_stop = false; static pid_t pgarch_forkexec(void); #endif -NON_EXEC_STATIC void PgArchiverMain(int argc, char *argv[]) pg_attribute_noreturn; +NON_EXEC_STATIC void PgArchiverMain(int argc, char *argv[]) pg_attribute_noreturn(); static void pgarch_exit(SIGNAL_ARGS); static void ArchSigHupHandler(SIGNAL_ARGS); static void ArchSigTermHandler(SIGNAL_ARGS); diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index abdfe8947a9460bec59b2325ef7643a6a3ffbf4e..0e7c1544ec0ee75ec2284cd124582e9731c94b96 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -251,7 +251,7 @@ static instr_time total_func_time; static pid_t pgstat_forkexec(void); #endif -NON_EXEC_STATIC void PgstatCollectorMain(int argc, char *argv[]) pg_attribute_noreturn; +NON_EXEC_STATIC void PgstatCollectorMain(int argc, char *argv[]) pg_attribute_noreturn(); static void pgstat_exit(SIGNAL_ARGS); static void pgstat_beshutdown_hook(int code, Datum arg); static void pgstat_sighup_handler(SIGNAL_ARGS); diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 9b2e7f310c9bb42f639c9d47e55028a4b538ce94..a9f20ac1b44915d05bd2b0289b6533c5c956060d 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -380,8 +380,8 @@ static void LogChildExit(int lev, const char *procname, int pid, int exitstatus); static void PostmasterStateMachine(void); static void BackendInitialize(Port *port); -static void BackendRun(Port *port) pg_attribute_noreturn; -static void ExitPostmaster(int status) pg_attribute_noreturn; +static void BackendRun(Port *port) pg_attribute_noreturn(); +static void ExitPostmaster(int status) pg_attribute_noreturn(); static int ServerLoop(void); static int BackendStartup(Port *port); static int ProcessStartupPacket(Port *port, bool SSLdone); diff --git a/src/backend/postmaster/syslogger.c b/src/backend/postmaster/syslogger.c index a27401f37005d509d356642c7f17f2678d798d69..34c7acf6680eddf2b45b85bea0a2f8d559248538 100644 --- a/src/backend/postmaster/syslogger.c +++ b/src/backend/postmaster/syslogger.c @@ -130,7 +130,7 @@ static volatile sig_atomic_t rotation_requested = false; static pid_t syslogger_forkexec(void); static void syslogger_parseArgs(int argc, char *argv[]); #endif -NON_EXEC_STATIC void SysLoggerMain(int argc, char *argv[]) pg_attribute_noreturn; +NON_EXEC_STATIC void SysLoggerMain(int argc, char *argv[]) pg_attribute_noreturn(); static void process_pipe_input(char *logbuffer, int *bytes_in_logbuffer); static void flush_pipe_input(char *logbuffer, int *bytes_in_logbuffer); static void open_csvlogfile(void); diff --git a/src/backend/replication/repl_scanner.l b/src/backend/replication/repl_scanner.l index 9abe47584291d3f52742f672795430282b5bb465..f8acb66552c88dec06d1f7b412d16245b61c9112 100644 --- a/src/backend/replication/repl_scanner.l +++ b/src/backend/replication/repl_scanner.l @@ -205,7 +205,7 @@ addlitchar(unsigned char ychar) appendStringInfoChar(&litbuf, ychar); } -void pg_attribute_noreturn +void yyerror(const char *message) { ereport(ERROR, diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index 295611913aa960c3a75fd43ab20ec236fc900d5e..da9ee7b3d08965eb5c78d4c39b41b3ceff72706b 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -193,7 +193,7 @@ typedef void (*WalSndSendDataCallback) (void); static void WalSndLoop(WalSndSendDataCallback send_data); static void InitWalSenderSlot(void); static void WalSndKill(int code, Datum arg); -static void WalSndShutdown(void) pg_attribute_noreturn; +static void WalSndShutdown(void) pg_attribute_noreturn(); static void XLogSendPhysical(void); static void XLogSendLogical(void); static void WalSndDone(WalSndSendDataCallback send_data); diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b952c7c98ed54635e60abb6ba37a76772dbe54be..dfd102a1fbd74d612317bb3adaa6f5575118e115 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -82,11 +82,7 @@ #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. */ -pg_attribute_format_arg(1); +static const char *err_gettext(const char *str) pg_attribute_format_arg(1); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); /* Global variables */ diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 26275bda1299d9fa9ee01d409c34deb3b154fcd0..b8a0f9f20c7824c9be4bcb1c079eb3faf377b222 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -129,10 +129,7 @@ char *GUC_check_errmsg_string; char *GUC_check_errdetail_string; char *GUC_check_errhint_string; -static void -do_serialize(char **destptr, Size *maxbytes, const char *fmt,...) -/* This lets gcc check the format string for consistency. */ -pg_attribute_printf(3, 4); +static void do_serialize(char **destptr, Size *maxbytes, const char *fmt,...) pg_attribute_printf(3, 4); static void set_config_sourcefile(const char *name, char *sourcefile, int sourceline); diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index 052caffe8db8691aa5848600653d6721e0802e7b..8202633d05602dfedd09936394ffc424004c7411 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -116,11 +116,7 @@ static pid_t postmasterPID = -1; #endif -static 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); +static void write_stderr(const char *fmt,...) pg_attribute_printf(1, 2); static void do_advice(void); static void do_help(void); static void set_mode(char *modeopt); diff --git a/src/bin/pg_dump/parallel.c b/src/bin/pg_dump/parallel.c index f58f96b06363c5d31604518c36c002f85233f4b4..ff823e5ab235477c7c74c4029478e3fa89447802 100644 --- a/src/bin/pg_dump/parallel.c +++ b/src/bin/pg_dump/parallel.c @@ -78,10 +78,8 @@ static ShutdownInformation shutdown_info; static const char *modulename = gettext_noop("parallel archiver"); static ParallelSlot *GetMyPSlot(ParallelState *pstate); -static void -parallel_msg_master(ParallelSlot *slot, const char *modulename, - const char *fmt, va_list ap) -pg_attribute_printf(3, 0); +static void parallel_msg_master(ParallelSlot *slot, const char *modulename, + const char *fmt, va_list ap) pg_attribute_printf(3, 0); static void archive_close_connection(int code, void *arg); static void ShutdownWorkersHard(ParallelState *pstate); static void WaitForTerminatingWorkers(ParallelState *pstate); diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h index d484236c4fe350b0b3833ba8b224c1c17c6f412e..80df8fcefd19011410775385572ce91eecf95784 100644 --- a/src/bin/pg_dump/pg_backup.h +++ b/src/bin/pg_dump/pg_backup.h @@ -277,10 +277,7 @@ extern void SortTocFromFile(Archive *AHX, RestoreOptions *ropt); /* Convenience functions used only when writing DATA */ extern void archputs(const char *s, Archive *AH); -extern int -archprintf(Archive *AH, const char *fmt,...) -/* This extension allows gcc to check the format string */ -pg_attribute_printf(2, 3); +extern int archprintf(Archive *AH, const char *fmt,...) pg_attribute_printf(2, 3); #define appendStringLiteralAH(buf,str,AH) \ appendStringLiteral(buf, str, (AH)->encoding, (AH)->std_strings) diff --git a/src/bin/pg_dump/pg_backup_utils.h b/src/bin/pg_dump/pg_backup_utils.h index 2e9a69a615dbd2aea41b11a64d459104903c2ed4..0df0936c91b577b0fd77368911633972c59c271a 100644 --- a/src/bin/pg_dump/pg_backup_utils.h +++ b/src/bin/pg_dump/pg_backup_utils.h @@ -28,17 +28,11 @@ typedef void (*on_exit_nicely_callback) (int code, void *arg); extern const char *progname; extern void set_dump_section(const char *arg, int *dumpSections); -extern void -write_msg(const char *modulename, const char *fmt,...) -pg_attribute_printf(2, 3); -extern void -vwrite_msg(const char *modulename, const char *fmt, va_list ap) -pg_attribute_printf(2, 0); +extern void write_msg(const char *modulename, const char *fmt,...) pg_attribute_printf(2, 3); +extern void vwrite_msg(const char *modulename, const char *fmt, va_list ap) pg_attribute_printf(2, 0); extern void on_exit_nicely(on_exit_nicely_callback function, void *arg); -extern void exit_nicely(int code) pg_attribute_noreturn; +extern void exit_nicely(int code) pg_attribute_noreturn(); -extern void -exit_horribly(const char *modulename, const char *fmt,...) -pg_attribute_printf(2, 3) pg_attribute_noreturn; +extern void exit_horribly(const char *modulename, const char *fmt,...) pg_attribute_printf(2, 3) pg_attribute_noreturn(); #endif /* PG_BACKUP_UTILS_H */ diff --git a/src/bin/pg_rewind/logging.h b/src/bin/pg_rewind/logging.h index e089ac7803e4b7a362b914dc6bae4fd320facb13..0272a22039de2827cdb3389bb86c17ce1b2d046d 100644 --- a/src/bin/pg_rewind/logging.h +++ b/src/bin/pg_rewind/logging.h @@ -27,10 +27,8 @@ typedef enum PG_FATAL } eLogType; -extern void pg_log(eLogType type, const char *fmt,...) -pg_attribute_printf(2, 3); -extern void pg_fatal(const char *fmt,...) -pg_attribute_printf(1, 2) pg_attribute_noreturn; +extern void pg_log(eLogType type, const char *fmt,...) pg_attribute_printf(2, 3); +extern void pg_fatal(const char *fmt,...) pg_attribute_printf(1, 2) pg_attribute_noreturn(); extern void progress_report(bool force); diff --git a/src/bin/psql/common.h b/src/bin/psql/common.h index 54266c1cb149cb37e4dfc0f830859871c91bafde..cdb0187feb2b3bf1d58a953317c65967dec000d8 100644 --- a/src/bin/psql/common.h +++ b/src/bin/psql/common.h @@ -18,10 +18,7 @@ extern bool setQFout(const char *fname); -extern void -psql_error(const char *fmt,...) -/* This lets gcc check the format string for consistency. */ -pg_attribute_printf(1, 2); +extern void psql_error(const char *fmt,...) pg_attribute_printf(1, 2); extern void NoticeProcessor(void *arg, const char *message); diff --git a/src/bin/psql/large_obj.c b/src/bin/psql/large_obj.c index 48d2d77a5e8ec6a86f51f3280e72c836f416d597..621d6320597d5bb05b0ff080c418089a5e4fa6b7 100644 --- a/src/bin/psql/large_obj.c +++ b/src/bin/psql/large_obj.c @@ -12,9 +12,7 @@ #include "settings.h" #include "common.h" -static void -print_lo_result(const char *fmt,...) -pg_attribute_printf(1, 2); +static void print_lo_result(const char *fmt,...) pg_attribute_printf(1, 2); static void print_lo_result(const char *fmt,...) diff --git a/src/include/bootstrap/bootstrap.h b/src/include/bootstrap/bootstrap.h index 3734afb468a50f3a56c6f70f0b5e4f66e91234d4..af9fc75a7439ba826622d0ea15bb5697bc3627b3 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 e7ee5105a272f60e95393ecf5e87d009064318ad..fd301b6da64697643a55bf2248eff2d92347092e 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 33123cb5044841c8c8baa1ab1a9512040f6926ab..db7cb3e33188e267130ea20ec89a7bf087b5ec29 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 fdb828508ea86a37aed78df259701abf90c1294e..00c25b6edd5a75aa2a35b78701fe2d74d955f8e8 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 0a2234d35ac05485fec1d01fac7d2655c9fcc224..254cf678d6165e20373b55ed49a4c81f06d635a8 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 9dc0d5846b05bc376abf829259c0c0a006c1e558..ce563dea256b94679d1e1b0619c832e83c541026 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 f941977865ae4c9bef86037427915cc19198f2c9..9e38c0d1971f5acb41c66fe2b7a2fa0b16aabd7b 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 64cc8e2e7c8f80a6480c78ad4d5165f3710971b0..f2b2257a115927244ed1e4b602b7141418a3e3c5 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 29854dd752e8887d5e7a513fcc0d792d95657ba2..3787cbfb7614cd318a3885bc59554128fb063502 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 ff30e05bfc844c94313858ca3319d4f12af97077..be37313fa5a8964cfcf0406021f6ba20e615578d 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 0bd50443aeb9a1cd83cae81b391f7f380e384a18..6eaaf4c1c4efe28a8ae67ddd4f11f1b05ec068f5 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 fe7c328afd1b43c52b663222dd20698474e41f40..b0ab4c22ba713d9e7031322097d45f85a77ac722 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 f584d85787215267d57c45be6cea76bca6aa86e8..a49c208dd2a637c05973009d7f5849226bc5e40c 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 60e4f50368d01286d89f9df9d17d0d21748bee1c..9f692eb47fb5718da50479cea9cd791b6ebb7e82 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 d41761fc7a1f01487692822b5666a4d75b858eb9..d16030482fad56361eeec66f488af269e7aec976 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 9a2092e5f283cd64424e6003c463a922fa506e6f..e1fd4b100e07324f6c4b56ba7db9aaa37a6210eb 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 d6a05d5a20903b7ee39964d9d23686e8ddce6bc4..dc9f02cd4243169db94c19a3382784c9d3d1e3a6 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 55de6c73e4a58429e93a93bb9cc9ddd9d5b1ec71..1ab7d3d66e2d3ad6de958492e8faf8e4e445acdf 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 4afdf91a6dc24461bd3bd36ee4118e50ea455394..61255a9f8e90efeb89c23d8fb17c9f4e9a0d4233 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 40351da47fde2d9049ba7d62d3c2fcb2794588f3..6dae480285214c1e08b510d5bd26d88452ea27cd 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 7da434e79870384f8c18f192698964e28c8f1033..c6283c2af341072d2708b8e3e7218b521b80be2a 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 1f0ea7db55242295f93151a229242edd4fba21b3..eb06c794d2b2fadd0e5e94ed4ab959eba422b90b 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 1477a6fe3d1ce66bc8467b66d564a71daa129e7e..dae517f3fe001d7e92a0679e7de3afac488e1666 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 b3c705f97b69ceb7a0b5dbb9cd9e5bb4498f1aef..96c5b8b3d44bbd080f7f97c10fb11db04876812d 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 3a2335523d070b5306e6336050f7b9b5fc0c113c..5b86ca10ef672eb5ac633a901cc01b394dfd544f 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 a82063a57b1b78a8e46a6514716beae0e5a5938a..8e90661195342335a2c8b3b1363ef551ce12b1d3 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 af529964003161df96a963903248b629a5c5f2ee..54e3ec796678622feb9e0380f3ceb372f272f6e7 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 bd8767520e33b882da700fb27b87ff451a62d3be..2cf51298331d18233ac4402e9a2014e516ff999c 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 */ diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h index 5efe59351f12e9a2189e0703767d32db0c6ab272..c32df6c5d58948cce9e89d52970b35e9e3cb7816 100644 --- a/src/interfaces/ecpg/include/ecpglib.h +++ b/src/interfaces/ecpg/include/ecpglib.h @@ -13,9 +13,7 @@ #include <string.h> #ifdef ENABLE_NLS -extern char * -ecpg_gettext(const char *msgid) -pg_attribute_format_arg(1); +extern char *ecpg_gettext(const char *msgid) pg_attribute_format_arg(1); #else #define ecpg_gettext(x) (x) #endif diff --git a/src/interfaces/ecpg/preproc/ecpg.header b/src/interfaces/ecpg/preproc/ecpg.header index e23407ec8d31c26726ed481278172209d62643bb..f41999a86f10eccda98de2ed88e0b79d92b4b93d 100644 --- a/src/interfaces/ecpg/preproc/ecpg.header +++ b/src/interfaces/ecpg/preproc/ecpg.header @@ -61,10 +61,12 @@ struct variable no_indicator = {"no_indicator", &ecpg_no_indicator, 0, NULL}; static struct ECPGtype ecpg_query = {ECPGt_char_variable, NULL, NULL, NULL, {NULL}, 0}; +static void vmmerror(int error_code, enum errortype type, const char *error, va_list ap) pg_attribute_printf(3, 0); + /* * Handle parsing errors and warnings */ -static void pg_attribute_printf(3, 0) +static void vmmerror(int error_code, enum errortype type, const char *error, va_list ap) { /* localize the error message string */ diff --git a/src/interfaces/ecpg/preproc/extern.h b/src/interfaces/ecpg/preproc/extern.h index 1ce25ebe1bb7038153a1f53ad18635df7c629c96..ea8fd8ed98c865335ec9f7228f64c1901294c9bd 100644 --- a/src/interfaces/ecpg/preproc/extern.h +++ b/src/interfaces/ecpg/preproc/extern.h @@ -78,7 +78,7 @@ extern void base_yyerror(const char *); extern void *mm_alloc(size_t), *mm_realloc(void *, size_t); extern char *mm_strdup(const char *); extern void mmerror(int errorcode, enum errortype type, const char *error,...) pg_attribute_printf(3, 4); -extern void mmfatal(int errorcode, const char *error,...) pg_attribute_printf(2, 3) pg_attribute_noreturn; +extern void mmfatal(int errorcode, const char *error,...) pg_attribute_printf(2, 3) pg_attribute_noreturn(); extern void output_get_descr_header(char *); extern void output_get_descr(char *, char *); extern void output_set_descr_header(char *); diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h index b9b630a222ffd09b4f7a85bb87bfc0be616edfdb..21759578f3a39aaa639d7920f58e60c4aefea5df 100644 --- a/src/interfaces/libpq/libpq-int.h +++ b/src/interfaces/libpq/libpq-int.h @@ -545,10 +545,7 @@ extern char *pqResultStrdup(PGresult *res, const char *str); extern void pqClearAsyncResult(PGconn *conn); extern void pqSaveErrorResult(PGconn *conn); extern PGresult *pqPrepareAsyncResult(PGconn *conn); -extern void -pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...) -/* This lets gcc check the format string for consistency. */ -pg_attribute_printf(2, 3); +extern void pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...) pg_attribute_printf(2, 3); extern void pqSaveMessageField(PGresult *res, char code, const char *value); extern void pqSaveParameterStatus(PGconn *conn, const char *name, @@ -651,12 +648,8 @@ extern ssize_t pgtls_write(PGconn *conn, const void *ptr, size_t len); #define pqIsnonblocking(conn) ((conn)->nonblocking) #ifdef ENABLE_NLS -extern char * -libpq_gettext(const char *msgid) -pg_attribute_format_arg(1); -extern char * -libpq_ngettext(const char *msgid, const char *msgid_plural, unsigned long n) -pg_attribute_format_arg(1) pg_attribute_format_arg(2); +extern char *libpq_gettext(const char *msgid) pg_attribute_format_arg(1); +extern char *libpq_ngettext(const char *msgid, const char *msgid_plural, unsigned long n) pg_attribute_format_arg(1) pg_attribute_format_arg(2); #else #define libpq_gettext(x) (x) #define libpq_ngettext(s, p, n) ((n) == 1 ? (s) : (p)) diff --git a/src/interfaces/libpq/pqexpbuffer.c b/src/interfaces/libpq/pqexpbuffer.c index 43df56a1e09de00375f8caa90f9e396eabf8ce69..15a92e626dcb3645fcee5aa763a4eb051688f56c 100644 --- a/src/interfaces/libpq/pqexpbuffer.c +++ b/src/interfaces/libpq/pqexpbuffer.c @@ -37,9 +37,7 @@ /* All "broken" PQExpBuffers point to this string. */ static const char oom_buffer[1] = ""; -static bool -appendPQExpBufferVA(PQExpBuffer str, const char *fmt, va_list args) -pg_attribute_printf(2, 0); +static bool appendPQExpBufferVA(PQExpBuffer str, const char *fmt, va_list args) pg_attribute_printf(2, 0); /* diff --git a/src/interfaces/libpq/pqexpbuffer.h b/src/interfaces/libpq/pqexpbuffer.h index 345d20376b825ef49a52a65900100912fce881bd..0342c9649c598663cbfba0f68cb8c6cc29267ed8 100644 --- a/src/interfaces/libpq/pqexpbuffer.h +++ b/src/interfaces/libpq/pqexpbuffer.h @@ -146,10 +146,7 @@ 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,...) -/* This extension allows gcc to check the format string */ -pg_attribute_printf(2, 3); +extern void printfPQExpBuffer(PQExpBuffer str, const char *fmt,...) pg_attribute_printf(2, 3); /*------------------------ * appendPQExpBuffer @@ -158,10 +155,7 @@ pg_attribute_printf(2, 3); * to str if necessary. This is sort of like a combination of sprintf and * strcat. */ -extern void -appendPQExpBuffer(PQExpBuffer str, const char *fmt,...) -/* This extension allows gcc to check the format string */ -pg_attribute_printf(2, 3); +extern void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...) pg_attribute_printf(2, 3); /*------------------------ * appendPQExpBufferStr diff --git a/src/interfaces/libpq/win32.c b/src/interfaces/libpq/win32.c index 04c5ed4b724d3aaaac8eaab696b908c33f110e4b..ee91f810219c8cd4c5d8f02c4b2794a1470a7401 100644 --- a/src/interfaces/libpq/win32.c +++ b/src/interfaces/libpq/win32.c @@ -34,9 +34,7 @@ /* Declared here to avoid pulling in all includes, which causes name collissions */ #ifdef ENABLE_NLS -extern char * -libpq_gettext(const char *msgid) -pg_attribute_format_arg(1); +extern char *libpq_gettext(const char *msgid) pg_attribute_format_arg(1); #else #define libpq_gettext(x) (x) #endif diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h index aadb888393089b2cb2673c65fe269bb3b5fb1c54..813d4401bbbf7b56bbeab552c273a3346afc5a7b 100644 --- a/src/pl/plperl/plperl.h +++ b/src/pl/plperl/plperl.h @@ -30,7 +30,7 @@ * Supply a value of PERL_UNUSED_DECL that will satisfy gcc - the one * perl itself supplies doesn't seem to. */ -#define PERL_UNUSED_DECL pg_attribute_unused +#define PERL_UNUSED_DECL pg_attribute_unused() /* * Sometimes perl carefully scribbles on our *printf macros. diff --git a/src/pl/plpgsql/src/pl_scanner.c b/src/pl/plpgsql/src/pl_scanner.c index dce56ce55b96b73b5ad22c87e71ccfdb005ce79c..683fdab2b4d95c305a32d2ec65bc0a562f43c060 100644 --- a/src/pl/plpgsql/src/pl_scanner.c +++ b/src/pl/plpgsql/src/pl_scanner.c @@ -608,7 +608,7 @@ plpgsql_scanner_errposition(int location) * Beware of using yyerror for other purposes, as the cursor position might * be misleading! */ -void pg_attribute_noreturn +void plpgsql_yyerror(const char *message) { char *yytext = core_yy.scanbuf + plpgsql_yylloc; diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h index f630ff822fbdc1f85ec99e4b605599709f7bf3c6..bec773a787b2db75a0a78c64ce2aca3a79689e52 100644 --- a/src/pl/plpgsql/src/plpgsql.h +++ b/src/pl/plpgsql/src/plpgsql.h @@ -1023,7 +1023,7 @@ extern int plpgsql_peek(void); extern void plpgsql_peek2(int *tok1_p, int *tok2_p, int *tok1_loc, int *tok2_loc); extern int plpgsql_scanner_errposition(int location); -extern void plpgsql_yyerror(const char *message); +extern void plpgsql_yyerror(const char *message) pg_attribute_noreturn(); extern int plpgsql_location_to_lineno(int location); extern int plpgsql_latest_lineno(void); extern void plpgsql_scanner_init(const char *str); diff --git a/src/pl/plpython/plpy_elog.h b/src/pl/plpython/plpy_elog.h index e4e4dfb695d8a5a94faa8427c310e44cab7503ae..94725c2a2e421239e86af1bf3832bd12bd240230 100644 --- a/src/pl/plpython/plpy_elog.h +++ b/src/pl/plpython/plpy_elog.h @@ -10,18 +10,11 @@ extern PyObject *PLy_exc_error; extern PyObject *PLy_exc_fatal; extern PyObject *PLy_exc_spi_error; -extern void -PLy_elog(int elevel, const char *fmt,...) -pg_attribute_printf(2, 3); +extern void PLy_elog(int elevel, const char *fmt,...) pg_attribute_printf(2, 3); -extern void -PLy_exception_set(PyObject *exc, const char *fmt,...) -pg_attribute_printf(2, 3); +extern void PLy_exception_set(PyObject *exc, const char *fmt,...) pg_attribute_printf(2, 3); -extern void -PLy_exception_set_plural(PyObject *exc, const char *fmt_singular, const char *fmt_plural, - unsigned long n,...) -pg_attribute_printf(2, 5) -pg_attribute_printf(3, 5); +extern void PLy_exception_set_plural(PyObject *exc, const char *fmt_singular, const char *fmt_plural, + unsigned long n,...) pg_attribute_printf(2, 5) pg_attribute_printf(3, 5); #endif /* PLPY_ELOG_H */ diff --git a/src/test/modules/test_shm_mq/test_shm_mq.h b/src/test/modules/test_shm_mq/test_shm_mq.h index 94d28805ff52f48a77545ed499b0b43a89650002..934df73fe628b987b97f2343cc05595a08f50805 100644 --- a/src/test/modules/test_shm_mq/test_shm_mq.h +++ b/src/test/modules/test_shm_mq/test_shm_mq.h @@ -40,6 +40,6 @@ extern void test_shm_mq_setup(int64 queue_size, int32 nworkers, shm_mq_handle **input); /* Main entrypoint for a worker. */ -extern void test_shm_mq_main(Datum) pg_attribute_noreturn; +extern void test_shm_mq_main(Datum) pg_attribute_noreturn(); #endif diff --git a/src/test/modules/worker_spi/worker_spi.c b/src/test/modules/worker_spi/worker_spi.c index 4149c94d30274a1f25cce61e28acd8e610e18756..fcb34ca1983d9931fe746e460862c5c0393cffa6 100644 --- a/src/test/modules/worker_spi/worker_spi.c +++ b/src/test/modules/worker_spi/worker_spi.c @@ -46,7 +46,7 @@ PG_MODULE_MAGIC; PG_FUNCTION_INFO_V1(worker_spi_launch); void _PG_init(void); -void worker_spi_main(Datum) pg_attribute_noreturn; +void worker_spi_main(Datum) pg_attribute_noreturn(); /* flags set by signal handlers */ static volatile sig_atomic_t got_sighup = false; diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index 9d4fb9a5a58812534176710ed91f5583c3fcedad..3de479023ad139a65a2ff33063970715a4b69814 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -131,21 +131,9 @@ static int fail_ignore_count = 0; static bool directory_exists(const char *dir); static void make_directory(const char *dir); -static void -header(const char *fmt,...) -/* This extension allows gcc to check the format string for consistency with - the supplied arguments. */ -pg_attribute_printf(1, 2); -static void -status(const char *fmt,...) -/* This extension allows gcc to check the format string for consistency with - the supplied arguments. */ -pg_attribute_printf(1, 2); -static void -psql_command(const char *database, const char *query,...) -/* This extension allows gcc to check the format string for consistency with - the supplied arguments. */ -pg_attribute_printf(2, 3); +static void header(const char *fmt,...) pg_attribute_printf(1, 2); +static void status(const char *fmt,...) pg_attribute_printf(1, 2); +static void psql_command(const char *database, const char *query,...) pg_attribute_printf(2, 3); #ifdef WIN32 typedef BOOL (WINAPI * __CreateRestrictedToken) (HANDLE, DWORD, DWORD, PSID_AND_ATTRIBUTES, DWORD, PLUID_AND_ATTRIBUTES, DWORD, PSID_AND_ATTRIBUTES, PHANDLE);