File tree 4 files changed +36
-10
lines changed
4 files changed +36
-10
lines changed Original file line number Diff line number Diff line change 8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/utils/error/assert.c,v 1.33 2007/01/05 22:19:43 momjian Exp $
11
+ * $PostgreSQL: pgsql/src/backend/utils/error/assert.c,v 1.34 2007/05/04 02:01:02 tgl Exp $
12
12
*
13
13
* NOTE
14
14
* This should eventually work with elog()
21
21
22
22
/*
23
23
* 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.
24
27
*/
25
28
int
26
- ExceptionalCondition (char * conditionName ,
27
- char * errorType ,
28
- char * fileName ,
29
+ ExceptionalCondition (const char * conditionName ,
30
+ const char * errorType ,
31
+ const char * fileName ,
29
32
int lineNumber )
30
33
{
31
34
if (!PointerIsValid (conditionName )
@@ -39,6 +42,9 @@ ExceptionalCondition(char *conditionName,
39
42
fileName , lineNumber );
40
43
}
41
44
45
+ /* Usually this shouldn't be needed, but make sure the msg went out */
46
+ fflush (stderr );
47
+
42
48
#ifdef SLEEP_ON_ASSERT
43
49
44
50
/*
Original file line number Diff line number Diff line change 42
42
*
43
43
*
44
44
* IDENTIFICATION
45
- * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.184 2007/05/02 15:32:41 tgl Exp $
45
+ * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.185 2007/05/04 02:01:02 tgl Exp $
46
46
*
47
47
*-------------------------------------------------------------------------
48
48
*/
@@ -1151,6 +1151,16 @@ pg_re_throw(void)
1151
1151
1152
1152
errfinish (0 );
1153
1153
}
1154
+
1155
+ /* We mustn't return... */
1156
+ ExceptionalCondition ("pg_re_throw tried to return" , "FailedAssertion" ,
1157
+ __FILE__ , __LINE__ );
1158
+
1159
+ /*
1160
+ * Since ExceptionalCondition isn't declared noreturn because of
1161
+ * TrapMacro(), we need this to keep gcc from complaining.
1162
+ */
1163
+ abort ();
1154
1164
}
1155
1165
1156
1166
Original file line number Diff line number Diff line change 10
10
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
11
11
* Portions Copyright (c) 1995, Regents of the University of California
12
12
*
13
- * $PostgreSQL: pgsql/src/include/postgres.h,v 1.79 2007/04/06 04:21:44 tgl Exp $
13
+ * $PostgreSQL: pgsql/src/include/postgres.h,v 1.80 2007/05/04 02:01:02 tgl Exp $
14
14
*
15
15
*-------------------------------------------------------------------------
16
16
*/
@@ -694,8 +694,9 @@ extern DLLIMPORT bool assert_enabled;
694
694
Trap(!(condition), "BadState")
695
695
#endif /* USE_ASSERT_CHECKING */
696
696
697
- extern int ExceptionalCondition (char * conditionName , char * errorType ,
698
- char * fileName , int lineNumber );
697
+ extern int ExceptionalCondition (const char * conditionName ,
698
+ const char * errorType ,
699
+ const char * fileName , int lineNumber );
699
700
700
701
/* ----------------------------------------------------------------
701
702
* Section 4: genbki macros used by catalog/pg_xxx.h files
Original file line number Diff line number Diff line change 7
7
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
8
8
* Portions Copyright (c) 1994, Regents of the University of California
9
9
*
10
- * $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.85 2007/05/02 15:32:42 tgl Exp $
10
+ * $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.86 2007/05/04 02:01:02 tgl Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -222,8 +222,17 @@ extern DLLIMPORT ErrorContextCallback *error_context_stack;
222
222
error_context_stack = save_context_stack; \
223
223
} while (0)
224
224
225
+ /*
226
+ * gcc understands __attribute__((noreturn)); for other compilers, insert
227
+ * a useless exit() call so that the compiler gets the point.
228
+ */
229
+ #ifdef __GNUC__
225
230
#define PG_RE_THROW () \
226
231
pg_re_throw()
232
+ #else
233
+ #define PG_RE_THROW () \
234
+ (pg_re_throw(), exit(1))
235
+ #endif
227
236
228
237
extern DLLIMPORT sigjmp_buf * PG_exception_stack ;
229
238
@@ -262,7 +271,7 @@ extern ErrorData *CopyErrorData(void);
262
271
extern void FreeErrorData (ErrorData * edata );
263
272
extern void FlushErrorState (void );
264
273
extern void ReThrowError (ErrorData * edata );
265
- extern void pg_re_throw (void );
274
+ extern void pg_re_throw (void ) __attribute__(( noreturn )) ;
266
275
267
276
268
277
/* GUC-configurable parameters */
You can’t perform that action at this time.
0 commit comments