8000 Emit dummy statements for probes.d probes when disabled · postgrespro/postgres@0d204a4 · GitHub
[go: up one dir, main page]

Skip to content
  • Commit 0d204a4

    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 <craig.ringer@2ndquadrant.com> Discussion: https://www.postgresql.org/message-id/flat/20210504221531.cfvpmmdfsou6eitb%40alap3.anarazel.de
    1 parent 55fe672 commit 0d204a4

    File tree

    2 files changed

    +7
    -0
    lines changed

    2 files changed

    +7
    -0
    lines changed

    src/backend/utils/Gen_dummy_probes.pl

    Lines changed: 6 additions & 0 deletions
    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

    Lines changed: 1 addition & 0 deletions
    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)
    0