]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Emit dummy statements for probes.d probes when disabled
authorPeter Eisentraut <peter@eisentraut.org>
Mon, 10 May 2021 09:36:26 +0000 (11:36 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Mon, 10 May 2021 11:56:21 +0000 (13:56 +0200)
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 b94409a02f.

Author: Craig Ringer <craig.ringer@2ndquadrant.com>
Discussion: https://www.postgresql.org/message-id/flat/20210504221531.cfvpmmdfsou6eitb%40alap3.anarazel.de

src/backend/utils/Gen_dummy_probes.pl
src/backend/utils/Gen_dummy_probes.sed

index cb0ad5a75cf5918e408904169a2e05d57b5a760b..073c0a854d2a3814334ebaa4ee0d46d0010ba223 100644 (file)
@@ -135,6 +135,12 @@ sub Run()
                        $CondReg ||= $s;
                }
 
+               # s/$/ do {} while (0)/
+               {
+                       $s = s /$/ do {} while (0)/s;
+                       $CondReg ||= $s;
+               }
+
                # P
                {
                        if (/^(.*)/) { print $1, "\n"; }
index 3c9eac6e4f74c0c87108a907c95a8f7535e7804c..9ded04d98a8c19c4d07cbbf849a17992cf6515fd 100644 (file)
@@ -19,5 +19,6 @@ s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2,
 s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6)/
 s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6, INT7)/
 s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6, INT7, INT8)/
+s/$/ do {} while (0)/
 P
 s/(.*$/_ENABLED() (0)/