[PATCH] Add target hook in C front end

Joseph S. Myers jsm28@cam.ac.uk
Mon Dec 17 12:45:00 GMT 2001


On 17 Dec 2001, Aldy Hernandez wrote:

> >>>>> "Joseph" == Joseph S Myers <jsm28@cam.ac.uk> writes:
> 
>  > (b) It is well-established that __SIZE_TYPE__ is a macro, not a
>  > typedef,
> 
> but that's just because it's always been done that way.  It doesn't
> mean we have to continue doing it that way, especially after having
> looked at the mips specs attrocity which IMHO are completely
> unreadable, let alone maintainable.

Doing something maintainable, that works as present with a __SIZE_TYPE__
macro, is essentially straightforward, given the removal of the separate
cpp0 executable.  Just add some calls to cpp_define, and remove all the
attempts to define __SIZE_TYPE__ in all the specs.  Note that GCC's
<stddef.h> explicitly defines __SIZE_TYPE__ to a default if it isn't
already defined; there is quite likely to be third party GCC-specific code
that does this as well, expecting it to be a macro.

(For some reason, there are __builtin_size_t (which is the internal
sizetype, not the external c_size_type_node) and __builtin_ptrdiff_t
typedefs, but I don't know what they're meant to be used for.)

>  > example, relied on in the format checking tests to determine the
>  > corresponding signed type.  Did your patch pass c99-scanf-1.c?
> 
> Assuming eric's patch does not pass c99-scanf-1.c, can't the tests be
> fixed to work without a dependency on explicit types (ie, not typedefs
> as eric's patch introduces)?

The problem is to determine the signed type corresponding to size_t, and
the unsigned type corresponding to ptrdiff_t, which are required for
certain C99 formats.  I haven't got anything better than the current
kludges in gcc.dg/format/format.h.

-- 
Joseph S. Myers
jsm28@cam.ac.uk



More information about the Gcc-patches mailing list