Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit71450d7

Browse files
committed
Teach compiler that ereport(>=ERROR) does not return
When elevel >= ERROR, we add an abort() call to the ereport() macro togive the compiler a hint that the ereport() expansion will not return,but the abort() isn't actually reached because the longjmp happens inerrfinish().Because the effect of ereport() varies with the elevel, we cannot usestandard compiler attributes such as noreturn for this.
1 parentffdd5a0 commit71450d7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎src/include/utils/elog.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,16 @@
100100
* and have errstart insert the default text domain. Modules can either use
101101
* ereport_domain() directly, or preferably they can override the TEXTDOMAIN
102102
* macro.
103+
*
104+
* When elevel >= ERROR, we add an abort() call to give the compiler a hint
105+
* that the ereport() expansion will not return, but the abort() isn't actually
106+
* reached because the longjmp happens in errfinish().
103107
*----------
104108
*/
105109
#defineereport_domain(elevel,domain,rest)\
106110
(errstart(elevel, __FILE__, __LINE__, PG_FUNCNAME_MACRO, domain) ? \
107-
(errfinish rest) : (void) 0)
111+
(errfinish rest) : (void) 0), \
112+
((elevel) >= ERROR ? abort() : (void) 0)
108113

109114
#defineereport(elevel,rest)\
110115
ereport_domain(elevel, TEXTDOMAIN, rest)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp