This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add target hook in C front end


On 16 Dec 2001, Eric Christopher wrote:

> The mips port currently needs to pass __SIZE_TYPE__ and __PTRDIFF_TYPE__
> to the preprocessor to make sure that the definitions of size_t and
> ptrdiff_t agree with the size given. This is currently done through spec
> files that are duplicated throughout the backend and usually only work
> for the multilibs that a particular header file was designed to support.
> (insert comment about herculean task of making sure updates work...)
> 
> This patch solves this problem by allowing C code to set the size of
> __SIZE_TYPE__ and __PTRDIFF_TYPE__ and setting SIZE_TYPE and
> PTRDIFF_TYPE to these values.

Where does this patch arrange for __SIZE_TYPE__ and __PTRDIFF_TYPE__ to be
defined to the correct values in the preprocessor, for <stddef.h>?

It would be good to get this out of specs - but to do that, I think you
need (a) no external cpp0, a special mode of cc1 being used instead, and
(b) tradcpp as an integrated part of cc1 (or else say that if you use
traditional preprocessing on C code some predefined macros may be missing
and headers not work).

We shouldn't do any MIPS-specific solution, or one specific to size_t and
ptrdiff_t; we should do a general solution that means cc1/cc1plus can
freely define preprocessor macros based on their state after processing
the command line, so resolving other built-in types and such issues as
__LONG_MAX__ and getting a correct <limits.h> in all cases.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]