Subject: Re: Fix for PR#23300 (cpp and -Wtraditional)
To: Christos Zoulas <christos@zoulas.com>
From: James Chacon <jmc@NetBSD.org>
List: tech-toolchain
Date: 12/15/2003 18:08:32
On Mon, Dec 15, 2003 at 06:35:08PM -0500, Christos Zoulas wrote:
> On Dec 15, 5:02pm, jmc@NetBSD.org (James Chacon) wrote:
> -- Subject: Re: Fix for PR#23300 (cpp and -Wtraditional)
>
> | #error is a historical odditity though as to what's valid vs expected.
> | Traditional cpp implementations say "#error isn't a valid token so error out"
> | and that's exactly what people used it for. All standardizing did there was
> | make it part of the spec vs undefined localized behavior (which under the
> | implementations I've used error'd out as expected).
> |
> | For the rest the warning should remain the same as #elif would (under
> | traditional auspices) error out. Therefore it needs the leading whitespace
> | to work/not error on traditional. Doing that to #error changes the behaviour
> | returned to the programmer by 180 degrees which is going to be highly
> | unexepected.
> |
> | Granted this is no different than using #foobar as a way to error out but
> | #error is exactly what was used traditionally and then grew into C89.
>
> Yes, and the hack was to indent #error statements so that the # was not
> in the first column.
>
By doing so, that changes the behavior for traditional cpp and almost
99% likely breaks the expectation of the use of #error in that case. In
other words, the warning is useless at best here for #error specifically
and actually damaging more than likely.
James