On Wed, 20 Aug 2014, David Wohlferd wrote:

> Or have I completely missed your point?

Suppose you build a copy of GCC, call it GCCA, and use it to compile a 
program P, with -Wformat enabled.  The following must hold:

* If P is not GCC, asm_fprintf formats are not accepted at all by GCCA 
when compiling P.

* If P is a copy of GCC (the same version as GCCA), say GCCB, configured 
for ARM target, then the formats that are used with asm_fprintf in such a 
copy of GCC must be accepted.  It is necessary that builds for all (host, 
target) combinations are clean, as long as the version of GCC used for the 
build is the same as the version of GCC being built, so that cross builds 
with --enable-werror-always can be used detect build problems that would 
show up in a native bootstrap.  If the build for some hosts is not clean, 
this breaks the use of --enable-werror-always for continuous integration.

* If P is a copy of GCC (the same version as GCCA), say GCCB, configured 
for some other target, then the formats that are used with asm_fprintf in 
such a copy of GCC must be accepted - but whether the ARM-GCC-specific 
formats are accepted doesn't matter *as long as that doesn't depend on how 
GCCA was configured*.  You can have GCC always accept them (as at 
present).  Or you can arrange things so that GCCA detects whether P is 
GCCB (ARM target) or GCCB (some other target) and so controls the set of 
supported asm_fprintf formats accordingly.  But having the accepted set 
depend on how GCCA was configured would adversely affect the usefulness of 
--enable-werror-always to detect build failures that would occur in a 
bootstrap without breaking in other cases.

What's not acceptable and represents a fundamental confusion of the 
different platforms inherently involved in a compiler is what the patch 
would introduce, which is the set of formats accepted depending on the 
target of GCCA (= host of GCCB); any such platform-dependence must be on 
the target of GCCB, not the host of GCCB.  That means this cannot be 
determined based on how GCCA is configured; instead, GCCA must obtain the 
information in some way at runtime from the source code of P, just as P 
can already communicate back to GCCA the argument types accepted by 
various of the GCC-specific formats.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to