jww
jww

Reputation: 102376

Request compiler to print warning/error once when encountered (and not multiple times)?

Is it possible to instruct GCC/Clang to print a warning or error once when its encountered in a header or source file?

I went through the GCC man(1) pages, but I did not see the feature. -fdiagnostics-show-location=once appears to be close, but it looks like a feature for brevity (the message is still emitted, its just shorter than a normal message).

I'm especially interested in Clang and its sanitizers. That is, I'd like Clang to warning me about undefined behavior once per offending line (when using -fsanitize=undefined). I'm looking at an offending library, and the redirected output is over 2GB because the same message gets printed over and over due to macro expansion from a header file.

Is there a switch to instruct GCC or Clang to warn or error once when its enountered the first time?

Upvotes: 1

Views: 152

Answers (0)

Related Questions