This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Preventing ISO C errors when using macros for builtin types
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Jozef Lawrynowicz <jozefl dot gcc at gmail dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, David Malcolm <dmalcolm at redhat dot com>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Mon, 10 Jun 2019 13:32:42 -0500
- Subject: Re: Preventing ISO C errors when using macros for builtin types
- References: <20190605142559.05791323@jozef-kubuntu> <CAFiYyc3cVsk1phrC0gTJa=mJOjzCJ-Be2GTaaYoJemCNBRYb0w@mail.gmail.com> <20190610172031.66eabae6@jozef-kubuntu>
On Mon, Jun 10, 2019 at 05:20:31PM +0100, Jozef Lawrynowicz wrote:
> On Thu, 6 Jun 2019 10:09:32 +0200
> Richard Biener <richard.guenther@gmail.com> wrote:
>
> > On Wed, Jun 5, 2019 at 3:26 PM Jozef Lawrynowicz <jozefl.gcc@gmail.com> wrote:
> > >
> > > I would appreciate if anyone can help me decide if:
> > > - It would be OK for the use of builtin macros such as __SIZE_TYPE__ to somehow
> > > not trigger the "pedantic errors", and what a valid approach might look like
> >
> > I think that would be OK - note you could also modify your target board.
>
> I'm now realising that the most straightforward way to fix this issue will be
> to just modify the configuration of the DejaGNU target board, so that
> DEFAULT_CFLAGS is set there and declarations of DEFAULT_CFLAGS in the testsuite
> that would set -pedantic-errors are never used.
That is not a fix, that is sweeping the problem under the rug.
As a somewhat dirty hack I added
#if __MSP430X_LARGE__
#undef __SIZE_TYPE__
__extension__ typedef unsigned __int20 __SIZE_TYPE__;
#endif
to the start of the installed stddef.h, and that fixes the problem fine,
for correct programs that do not forget to include <stddef.h> (directly
or indirectly), anyway.
Segher