This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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] |
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. > Anyway, > 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: #pragma push_macro("signed") #pragma push_macro("int") #pragma push_macro("long") #undef signed #undef int #undef long > #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 */ > #else > #error > #endif #pragma pop_macro("signed") #pragma pop_macro("int") #pragma pop_macro("long") This allows to keep the macros settings intact even if somebody using the headers thinks redefining int, long, or signed is a good idea. Corinna -- Corinna Vinschen Cygwin Maintainer Red Hat
Attachment:
pgpomzYLF17Yx.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |