Pablo
Pablo

Reputation: 889

Declaring Clang’s -fno-caret-diagnostics only for a specific type of #pragma

I rely on Clang’s #pragma message to remember TODO notices. For example,

int
main(void)
{
#pragma message "TODO: do something"
}

which gives this output for clang -o todo todo.c:

todo.c:4:9: warning: TODO: do something [-W#pragma-messages]
#pragma message "TODO: do something"
        ^
1 warning generated.

This, however, is redundant. I know I can use the -fno-caret-diagnostics flag with Clang to avoid having the #pragma line in the compiler’s output, but this also disables the caret diagnostics for other warnings and errors, which I would want to avoid.

Is there a way of declaring -fno-caret-diagnostics only for this kind of #pragma?

Upvotes: 1

Views: 560

Answers (1)

starturtle
starturtle

Reputation: 739

If I understand correctly, the answer is part of this question. Does -Wno#pragma-messages do what you want?

Upvotes: 1

Related Questions