On 24 October 2016 at 19:02, Peter Maydell <peter.mayd...@linaro.org> wrote:
> On 24 October 2016 at 18:27, Richard Henderson <r...@twiddle.net> wrote:
>> Bah.  Annoyingly, even though I didn't configure with --disable-werror, I 
>> only
>> got the warning from clang, which of course flashed by unseen.
>
> I think that configure looks for "does this compiler support
> the GCC diagnostic pragma" (which clang doesn't) and doesn't enable
> werror by default if it doesn't exist, even though often your
> combination of config options and system headers won't produce
> the warnings that we would need the pragma to suppress.

Checking a bit more carefully, there are several things
happening here:

(1) configure currently only defaults to werror for linux
    and mingw32 builds (deliberate decision, which we can
    change if we like)
(2) clang does support the GCC diagnostic pragmas, but one
    of the ones the test checks for is
    #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
    and that particular -W option is not one clang recognizes,
    so it complains and the "does the pragma work" test is
    thus failed.
    (Ideally clang ought to silently accept -Wno-wombat like
    gcc, and also #pragma GCC diagnostic ignored -Wwombat,
    which gcc might or might not handle. But it doesn't.)
(3) if you fix or work around both of those then on OSX
    Sierra the configure test for SASL fails the "does this
    test give the same answer with and without -Werror" check
    because the SASL functions provoke deprecation warnings.

If you fudge all of those then you can get configure to
automatically use -Werror on OSX (at which point if you're
using Sierra the build will fail on the SASL deprecations
unless you passed configure --disable-vnc-sasl). I suspect
it would fail if we were building with Valgrind support
when we tried to use the pragma to disable
-Wunused-but-set-variable in util/coroutine-ucontext.c though.

In conclusion, trying to suppress diagnostics to produce
a warning-free build across a range of compilers is a mess :-(

thanks
-- PMM

Reply via email to