https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80552
Bug ID: 80552 Summary: Make consecutive relative line numbers more maintainable Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: testsuite Assignee: unassigned at gcc dot gnu.org Reporter: vries at gcc dot gnu.org Target Milestone: --- [ Spinoff from PR80221: "Contrib script to rewrite testcase from absolute to relative line numbers" ] We have patterns using relative line numbers in dg directives like this in gcc/testsuite/obj-c++.dg/class-extension-2.mm: ... @implementation MyObject2 @end /* { dg-warning "incomplete implementation of class .MyObject2." } */ /* { dg-warning "method definition for .-test. not found" "" { target *-*-* } .-1 } */ /* { dg-warning "class .MyObject2. does not fully implement the .MyProtocol. protocol" "" { target *-*-* } .-2 } */ /* { dg-warning "method definition for .-test2. not found" "" { target *-*-* } .-3 } */ /* { dg-warning "class .MyObject2. does not fully implement the .MyProtocol2. protocol" "" { target *-*-* } .-4 } */ /* { dg-warning "method definition for .-test3. not found" "" { target *-*-* } .-5 } */ /* { dg-warning "class .MyObject2. does not fully implement the .MyProtocol3. protocol" "" { target *-*-* } .-6 } */ ... A few ideas were generated in PR80221 to deal with this in a less verbose and more maintainable fashion. PR80221 comment 7: ... foobar; /* { dg-warning "warning for foobar" continue } { dg-warning "another warning for foobar" continue } { dg-error "error for foobar" } */ ... PR80221 comment 10: ... foobar; /* { dg-warning "warning for foobar" .-1 } Bla, bla, reasoning. { dg-warning "another warning for foobar" continue } Bla, bla, more reasoning. { dg-error "error for foobar" continue } */ ... PR80221 comment 11: ... foobar; /* { dg-begin-same-line-output .-1 } ... { dg-warning "warning for foobar" } ... { dg-message "note for foobar" } ... { dg-error "error for foobar" } ... { dg-end-same-line-output } */ ...