aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/error/assert.c7
-rw-r--r--src/backend/utils/error/elog.c8
-rw-r--r--src/include/postgres.h8
3 files changed, 6 insertions, 17 deletions
diff --git a/src/backend/utils/error/assert.c b/src/backend/utils/error/assert.c
index ad548239f24..2908abe8520 100644
--- a/src/backend/utils/error/assert.c
+++ b/src/backend/utils/error/assert.c
@@ -21,11 +21,8 @@
/*
* 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
+void
ExceptionalCondition(const char *conditionName,
const char *errorType,
const char *fileName,
@@ -55,6 +52,4 @@ ExceptionalCondition(const char *conditionName,
#endif
abort();
-
- return 0;
}
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 239ac19882d..65c28a75080 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -1507,15 +1507,9 @@ pg_re_throw(void)
errfinish(0);
}
- /* We mustn't return... */
+ /* Doesn'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();
}
diff --git a/src/include/postgres.h b/src/include/postgres.h
index c429f291c2f..94c0218cd1b 100644
--- a/src/include/postgres.h
+++ b/src/include/postgres.h
@@ -655,14 +655,14 @@ extern PGDLLIMPORT bool assert_enabled;
/*
* TrapMacro is the same as Trap but it's intended for use in macros:
*
- * #define foo(x) (AssertMacro(x != 0) && bar(x))
+ * #define foo(x) (AssertMacro(x != 0), bar(x))
*
* Isn't CPP fun?
*/
#define TrapMacro(condition, errorType) \
((bool) ((! assert_enabled) || ! (condition) || \
(ExceptionalCondition(CppAsString(condition), (errorType), \
- __FILE__, __LINE__))))
+ __FILE__, __LINE__), 0)))
#ifndef USE_ASSERT_CHECKING
#define Assert(condition)
@@ -683,8 +683,8 @@ extern PGDLLIMPORT bool assert_enabled;
Trap(!(condition), "BadState")
#endif /* USE_ASSERT_CHECKING */
-extern int ExceptionalCondition(const char *conditionName,
+extern void ExceptionalCondition(const char *conditionName,
const char *errorType,
- const char *fileName, int lineNumber);
+ const char *fileName, int lineNumber) __attribute__((noreturn));
#endif /* POSTGRES_H */