https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127943

            Bug ID: 127943
           Summary: RFE: dg-lint should diagnose a target/xfail selector
                    passed in the comment argument of
                    dg-error/dg-warning/dg-message
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: dg-lint
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org
  Target Milestone: ---

In a recent new test case I wrote:

  /* { dg-message "freed here" { xfail *-*-* } } */

but I meant:

  /* { dg-message "freed here" "" { xfail *-*-* } } */

Note the missing comment; on forgetting that, the {xfail *-*-*} is consumed as
the *comment*, not the selector, so the selection logic is ignored, and DejaGnu
prints it as the test name.  Hence the .sum line reads

  FAIL: foo.c xfail *-*-*

instead of (test for warnings, line 21).

dg-lint is currently silent about the above mistake.

RFE: for the directives taking [comment [{ selector }] [line]] - dg-error,
dg-warning, dg-bogus, dg-message, dg-note, dg-optimized, dg-missed, dg-locus -
dg-lint should warn when the argument immediately following the regexp is a
brace group whose first word is target or xfail. That can only ever be a
selector written into the comment slot. A fix-it inserting "" before the brace
group would make it self-correcting.

Reply via email to