h8300, m32c and PRIuPTR
Joel Sherrill
joel.sherrill@oarcorp.com
Tue Mar 17 19:31:00 GMT 2015
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. Anyway,
I through it into the test case and it did work for my cases.
Yaakov, does it work for all your configurations?
--
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
-------------- next part --------------
#include <stdio.h>
#include <inttypes.h>
#define __mySTRINGIFY(a) #a
#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
#undef signed
#undef int
#undef long
#define myPRIuPTR __myPRIPTR(u)
void f( uintptr_t x)
{
printf( "%" myPRIuPTR "\n", x );
}
-------------- next part --------------
# moxie-rtems4.11
#
testit()
{
echo === ${*}
${*} -dM -E - </dev/null | grep UINTPTR_TYPE
${*} -Wall -Wextra -c f.c
}
for t in arm-rtems4.11 avr-rtems4.11 bfin-rtems4.11 h8300-rtems4.11 \
i386-rtems4.11 lm32-rtems4.11 m32c-rtems4.11 m32r-rtems4.11 \
m68k-rtems4.11 mips-rtems4.11 nios2-rtems4.11 or1k-rtems4.11 \
powerpc-rtems4.11 sh-rtems4.11 sparc64-rtems4.11 sparc-rtems4.11 \
v850-rtems4.11
do
testit ${t}-gcc
done
for t in "h8300-rtems4.11-gcc -mh -mint32" \
"h8300-rtems4.11-gcc -msx " \
"m32c-rtems4.11-gcc -mcpu=m32cm" \
"m32c-rtems4.11-gcc -mcpu=r8c" \
"gcc"
do
testit ${t}
done
More information about the Newlib
mailing list