On Mon, Jan 30, 2023 at 12:27 PM Harald Anlauf via Fortran <fortran@gcc.gnu.org> wrote: > > Dear Hackers, > > is there a way to check that a particular warning is emitted only > once for a source code line instead of multiple times? > > It appears that by default dg-warn matches one or more times.
One example of how to do this is located in testsuite/g++.dg/lookup/duperr1.C . I don't know if this is the best way of doing it though. Basically it uses dg-bogus to match the multiple warnings (since it is a regex over all output lines and `.*` will even match new lines) so you get a failure if there was a duplicated one and then dg-message to match the original message just to make sure it is outputted once (dg-message was because it was originally a note: rather than a warning/error but similar thing can be done for dg-error/dg-warning). Thanks, Andrew Pinski > > Thanks, > Harald >