This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] Remove arm-specific formats from asm_fprintf
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: David Wohlferd <dw at LimeGreenSocks dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Kyrill Tkachov <kyrylo dot tkachov at arm dot com>, <nickc at redhat dot com>
- Date: Wed, 20 Aug 2014 12:15:06 +0000
- Subject: Re: [Patch] Remove arm-specific formats from asm_fprintf
- Authentication-results: sourceware.org; auth=none
- References: <53CF8B5B dot 8050703 at LimeGreenSocks dot com> <Pine dot LNX dot 4 dot 64 dot 1407282213250 dot 13295 at digraph dot polyomino dot org dot uk> <53F45739 dot 3010102 at LimeGreenSocks dot com>
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
joseph@codesourcery.com