Hi, I'd like to know if the current behaviour of -Winvalid-pch is the
intended one, mainly because gcc prints the message saying that the pch
is invalid even if later it finds a valid one.

Suppose that one project builds the pch for several build types (debug,
release...) in the same directory. In the first build, say Debug, only
one pch is there and there's no warning. But if later you build the
Release version, the old pch will be there and will firstly be picked,
the warning will be shown, and then the correct pch (release) will be
used. Things get worse if you use the -Werror directive.

IMHO the real use of -Winvalid-pch is to trap cases where *any* pch is
used, thus slowing the compilation process. If one valid pch is found, I
think it's a good case, and don't deserve a warning (or an error with
-Werror). I've seen people that giving up -Winvalid-pch to get rid of
those spurious warnings in detriment of not knowing whether the pch was
used or not.

Regards,
Rodolfo Lima.

Reply via email to