From 0cb1fac3b19f01025b63d2cdceabb8767185da28 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 12 Feb 2013 07:13:22 -0500 Subject: [PATCH] Add noreturn attributes to some error reporting functions --- contrib/cube/cubescan.l | 2 +- contrib/seg/segscan.l | 2 +- src/backend/replication/repl_scanner.l | 2 +- src/include/mb/pg_wchar.h | 4 ++-- src/include/parser/parse_relation.h | 4 ++-- src/include/storage/lock.h | 2 +- src/include/tcop/tcopprot.h | 2 +- src/pl/plpgsql/src/pl_scanner.c | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/contrib/cube/cubescan.l b/contrib/cube/cubescan.l index a74eb4ba37e..8f917cd33ad 100644 --- a/contrib/cube/cubescan.l +++ b/contrib/cube/cubescan.l @@ -60,7 +60,7 @@ float ({integer}|{real})([eE]{integer})? %% -void +void __attribute__((noreturn)) yyerror(const char *message) { if (*yytext == YY_END_OF_BUFFER_CHAR) diff --git a/contrib/seg/segscan.l b/contrib/seg/segscan.l index ce5ff31e47c..95139f46318 100644 --- a/contrib/seg/segscan.l +++ b/contrib/seg/segscan.l @@ -59,7 +59,7 @@ float ({integer}|{real})([eE]{integer})? %% -void +void __attribute__((noreturn)) yyerror(const char *message) { if (*yytext == YY_END_OF_BUFFER_CHAR) diff --git a/src/backend/replication/repl_scanner.l b/src/backend/replication/repl_scanner.l index a1244983060..b4743e6357d 100644 --- a/src/backend/replication/repl_scanner.l +++ b/src/backend/replication/repl_scanner.l @@ -152,7 +152,7 @@ addlitchar(unsigned char ychar) appendStringInfoChar(&litbuf, ychar); } -void +void __attribute__((noreturn)) yyerror(const char *message) { ereport(ERROR, diff --git a/src/include/mb/pg_wchar.h b/src/include/mb/pg_wchar.h index 907950dda47..78ddaf92e33 100644 --- a/src/include/mb/pg_wchar.h +++ b/src/include/mb/pg_wchar.h @@ -516,9 +516,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); +extern void report_invalid_encoding(int encoding, const char *mbstr, int len) __attribute__((noreturn)); extern void report_untranslatable_char(int src_encoding, int dest_encoding, - const char *mbstr, int len); + const char *mbstr, int len) __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 561536f790a..c9e4eafda93 100644 --- a/src/include/parser/parse_relation.h +++ b/src/include/parser/parse_relation.h @@ -84,9 +84,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); +extern void errorMissingRTE(ParseState *pstate, RangeVar *relation) __attribute__((noreturn)); extern void errorMissingColumn(ParseState *pstate, - char *relname, char *colname, int location); + char *relname, char *colname, int location) __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/storage/lock.h b/src/include/storage/lock.h index f10c8f194fa..9642a19821e 100644 --- a/src/include/storage/lock.h +++ b/src/include/storage/lock.h @@ -533,7 +533,7 @@ extern void lock_twophase_standby_recover(TransactionId xid, uint16 info, extern DeadLockState DeadLockCheck(PGPROC *proc); extern PGPROC *GetBlockingAutoVacuumPgproc(void); -extern void DeadLockReport(void); +extern void DeadLockReport(void) __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 726fb74af23..e6f0afbedfe 100644 --- a/src/include/tcop/tcopprot.h +++ b/src/include/tcop/tcopprot.h @@ -64,7 +64,7 @@ extern void assign_max_stack_depth(int newval, void *extra); extern void die(SIGNAL_ARGS); extern void quickdie(SIGNAL_ARGS) __attribute__((noreturn)); extern void StatementCancelHandler(SIGNAL_ARGS); -extern void FloatExceptionHandler(SIGNAL_ARGS); +extern void FloatExceptionHandler(SIGNAL_ARGS) __attribute__((noreturn)); extern void RecoveryConflictInterrupt(ProcSignalReason reason); /* called from SIGUSR1 * handler */ extern void prepare_for_client_read(void); diff --git a/src/pl/plpgsql/src/pl_scanner.c b/src/pl/plpgsql/src/pl_scanner.c index 6dd63d738d1..ec448cbbc8b 100644 --- a/src/pl/plpgsql/src/pl_scanner.c +++ b/src/pl/plpgsql/src/pl_scanner.c @@ -528,7 +528,7 @@ plpgsql_scanner_errposition(int location) * Beware of using yyerror for other purposes, as the cursor position might * be misleading! */ -void +void __attribute__((noreturn)) plpgsql_yyerror(const char *message) { char *yytext = core_yy.scanbuf + plpgsql_yylloc;