https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80221
--- Comment #10 from Thomas Schwinge <tschwinge at gcc dot gnu.org> --- (In reply to Martin Sebor from comment #7) > A more robust solution that wouldn't have to subject to a limit would be to > add an annotation to dg-{error,message,warning} to indicate that the next > dg-{bogus,error,message,warning} directive is meant to be applied to the > same line as the current one. For instance, something like this: Instead of working "into the future"... > foobar; > /* { dg-warning "warning for foobar" continue } > { dg-warning "another warning for foobar" continue } > { dg-error "error for foobar" } */ > > (For brevity I omitted the comment and the { target ... } parts of the > directives above. It would also be nice to be able to do away with those > when they're not necessary.) ..., perhaps it's easier to implement that idea the other way round: at the end of a "dg-*" handling routine, store the current location into a global variable, and if a later "dg-*" directive uses a "continue" location, use the value of the global variable instead. That is: 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 } */