h8300, m32c and PRIuPTR
Tue Mar 17 19:42:00 GMT 2015
On Mar 17 11:54, Joel Sherrill wrote:
> On 3/17/2015 11:22 AM, Joseph Myers wrote:
> > On Tue, 17 Mar 2015, Joel Sherrill wrote:
> >> On 3/17/2015 11:09 AM, Joseph Myers wrote:
> >>> On Tue, 17 Mar 2015, Corinna Vinschen wrote:
> >>>> Do we really gain anything by introducing a massive ifdef mentioning
> >>>> all targets out there? This looks like overkill.
> >>> Was there some problem with the logic I suggested in
> >>> <https://sourceware.org/ml/newlib/2014/msg00421.html> to determine the
> >>> type used for intptr_t without any per-architecture conditionals or
> >>> configure tests being needed? (It's true that if some architecture
> >>> decides to use e.g. __int24 for intptr_t, additional cases would be
> >>> needed, but that logic should cover all architectures where int, long or
> >>> long long are used.)
> >> That works except in cases where the definition of uintptr_t varies based
> >> on the multilib.
> > My proposed logic would go in an architecture-independent installed
> > header, so I don't see the issue.
> I remember you proposing this but not why it wasn't pursued.
Me neither. Probably too much other stuff on the plate.
> I through it into the test case and it did work for my cases.
That looks like a pretty neat solution. If we pull this into the newlib
headers, we should probably use #pragma push_macro, like this:
> #define signed +0
> #define int +0
> #define long +1
> #if __INTPTR_TYPE__ == 2
> /* long long */
> # define __myPRIPTR(x) __mySTRINGIFY(ll##x)
> # define __mySCNPTR(x) __mySTRINGIFY(ll##x)
> #elif __INTPTR_TYPE__ == 1
> # define __myPRIPTR(x) __mySTRINGIFY(l##x)
> # define __mySCNPTR(x) __mySTRINGIFY(l##x)
> /* long */
> #elif __INTPTR_TYPE__ == 0
> # define __myPRIPTR(x) __mySTRINGIFY(x)
> # define __mySCNPTR(x) __mySTRINGIFY(x)
> /* int */
This allows to keep the macros settings intact even if somebody using
the headers thinks redefining int, long, or signed is a good idea.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 819 bytes
Desc: not available
More information about the Newlib