Suppressing specific compiler warnings

Zack Weinberg zack@codesourcery.com
Wed May 26 20:15:00 GMT 2004


Dale Johannesen <dalej@apple.com> writes:

> Another compiler I worked on did simple pattern matching:
>
> -Wno="uninit"
>
> to suppress the English uninitialized-variable warning, for example.
> Some people see this as inelegant, but it's trivial to implement and
> maintain, coexists nicely with i18n, is convenient for users, and
> would simplify the compiler internals: just go ahead and call
> 'warning' and let the low level routine do the pattern match.

I'm fond of this idea myself.  We've already got a regex engine to
hand.  We could even convert all the existing warn_* flags to canned
sets of patterns to suppress, except that (a) that will break if
someone decides to reword a message, and (b) some warnings involve
doing expensive calculations to decide if they're appropriate.

I don't see how it coexists nicely with i18n, though.  Do we match
against the message before translation (user unfriendly) or after
(code/makefiles suddenly dependent on locale)?

zw



More information about the Gcc mailing list