Skip to content

Commit fa8fbad

Browse files
committed
Emit dummy statements for probes.d probes when disabled
When building without --enable-dtrace, emit dummy do {} while (0) statements for the stubbed-out TRACE_POSTGRESQL_foo() macros instead of empty macros that totally elide the original probe statement. This fixes the warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] introduced by b94409a. Author: Craig Ringer <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/20210504221531.cfvpmmdfsou6eitb%40alap3.anarazel.de
1 parent 3c55410 commit fa8fbad

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/backend/utils/Gen_dummy_probes.pl

+6
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ ()
135135
$CondReg ||= $s;
136136
}
137137

138+
# s/$/ do {} while (0)/
139+
{
140+
$s = s /$/ do {} while (0)/s;
141+
$CondReg ||= $s;
142+
}
143+
138144
# P
139145
{
140146
if (/^(.*)/) { print $1, "\n"; }

src/backend/utils/Gen_dummy_probes.sed

+1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2,
1919
s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6)/
2020
s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6, INT7)/
2121
s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6, INT7, INT8)/
22+
s/$/ do {} while (0)/
2223
P
2324
s/(.*$/_ENABLED() (0)/

0 commit comments

Comments
 (0)