File tree Expand file tree Collapse file tree 3 files changed +6
-17
lines changed Expand file tree Collapse file tree 3 files changed +6
-17
lines changed Original file line number Diff line number Diff line change 2121
2222/*
2323 * ExceptionalCondition - Handles the failure of an Assert()
24- *
25- * Note: this can't actually return, but we declare it as returning int
26- * because the TrapMacro() macro might get wonky otherwise.
2724 */
28- int
25+ void
2926ExceptionalCondition (const char * conditionName ,
3027 const char * errorType ,
3128 const char * fileName ,
@@ -55,6 +52,4 @@ ExceptionalCondition(const char *conditionName,
5552#endif
5653
5754 abort ();
58-
59- return 0 ;
6055}
Original file line number Diff line number Diff line change @@ -1507,15 +1507,9 @@ pg_re_throw(void)
15071507 errfinish (0 );
15081508 }
15091509
1510- /* We mustn 't return... */
1510+ /* Doesn 't return ... */
15111511 ExceptionalCondition ("pg_re_throw tried to return" , "FailedAssertion" ,
15121512 __FILE__ , __LINE__ );
1513-
1514- /*
1515- * Since ExceptionalCondition isn't declared noreturn because of
1516- * TrapMacro(), we need this to keep gcc from complaining.
1517- */
1518- abort ();
15191513}
15201514
15211515
Original file line number Diff line number Diff line change @@ -655,14 +655,14 @@ extern PGDLLIMPORT bool assert_enabled;
655655/*
656656 * TrapMacro is the same as Trap but it's intended for use in macros:
657657 *
658- * #define foo(x) (AssertMacro(x != 0) && bar(x))
658+ * #define foo(x) (AssertMacro(x != 0), bar(x))
659659 *
660660 * Isn't CPP fun?
661661 */
662662#define TrapMacro (condition , errorType ) \
663663 ((bool) ((! assert_enabled) || ! (condition) || \
664664 (ExceptionalCondition(CppAsString(condition), (errorType), \
665- __FILE__, __LINE__))))
665+ __FILE__, __LINE__), 0 )))
666666
667667#ifndef USE_ASSERT_CHECKING
668668#define Assert (condition )
@@ -683,8 +683,8 @@ extern PGDLLIMPORT bool assert_enabled;
683683 Trap(!(condition), "BadState")
684684#endif /* USE_ASSERT_CHECKING */
685685
686- extern int ExceptionalCondition (const char * conditionName ,
686+ extern void ExceptionalCondition (const char * conditionName ,
687687 const char * errorType ,
688- const char * fileName , int lineNumber );
688+ const char * fileName , int lineNumber ) __attribute__(( noreturn )) ;
689689
690690#endif /* POSTGRES_H */
You can’t perform that action at this time.
0 commit comments