mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
A few fixups in error handling: mark pg_re_throw() as noreturn for gcc,
and for other compilers, insert a dummy exit() call so that they understand PG_RE_THROW() doesn't return. Insert fflush(stderr) in ExceptionalCondition, per recent buildfarm evidence that that might not happen automatically on some platforms. And const-ify ExceptionalCondition's declaration while at it.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/error/assert.c,v 1.33 2007/01/05 22:19:43 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/error/assert.c,v 1.34 2007/05/04 02:01:02 tgl Exp $
|
||||
*
|
||||
* NOTE
|
||||
* This should eventually work with elog()
|
||||
@ -21,11 +21,14 @@
|
||||
|
||||
/*
|
||||
* ExceptionalCondition - Handles the failure of an Assert()
|
||||
*
|
||||
* Note: this can't actually return, but we declare it as returning int
|
||||
* because the TrapMacro() macro might get wonky otherwise.
|
||||
*/
|
||||
int
|
||||
ExceptionalCondition(char *conditionName,
|
||||
char *errorType,
|
||||
char *fileName,
|
||||
ExceptionalCondition(const char *conditionName,
|
||||
const char *errorType,
|
||||
const char *fileName,
|
||||
int lineNumber)
|
||||
{
|
||||
if (!PointerIsValid(conditionName)
|
||||
@ -39,6 +42,9 @@ ExceptionalCondition(char *conditionName,
|
||||
fileName, lineNumber);
|
||||
}
|
||||
|
||||
/* Usually this shouldn't be needed, but make sure the msg went out */
|
||||
fflush(stderr);
|
||||
|
||||
#ifdef SLEEP_ON_ASSERT
|
||||
|
||||
/*
|
||||
|
@ -42,7 +42,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.184 2007/05/02 15:32:41 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.185 2007/05/04 02:01:02 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1151,6 +1151,16 @@ pg_re_throw(void)
|
||||
|
||||
errfinish(0);
|
||||
}
|
||||
|
||||
/* We mustn't return... */
|
||||
ExceptionalCondition("pg_re_throw tried to return", "FailedAssertion",
|
||||
__FILE__, __LINE__);
|
||||
|
||||
/*
|
||||
* Since ExceptionalCondition isn't declared noreturn because of
|
||||
* TrapMacro(), we need this to keep gcc from complaining.
|
||||
*/
|
||||
abort();
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user