Permalink
Browse files

Remove need for ARM EABI/OABI difference in va_list handling.

  • Loading branch information...
1 parent 03e34f8 commit fc612602259bd98b28041d11a57ed99c849d1166 @ibuclaw ibuclaw committed Aug 30, 2012
Showing with 14 additions and 77 deletions.
  1. +3 −1 gcc/d/ChangeLog
  2. +0 −10 gcc/d/d-lang.cc
  3. +5 −25 libphobos/libdruntime/core/stdc/stdarg.d
  4. +6 −41 libphobos/std/format.d
View
@@ -1,7 +1,9 @@
2012-08-30 Iain Buclaw <ibuclaw@ubuntu.com>
* d-lang.cc(d_init): Remove 'Thumb' identifier for ARM as 16bit
- platforms aren't supported. Add ARM_EABI identifier.
+ platforms aren't supported.
+ (GNU_LongDouble128): Remove identifier as long double size is
+ determined from type information.
* d-decls.cc(TypeInfoDeclaration::toSymbol): Mark all typeinfo decls
as 'used'.
View
@@ -261,11 +261,6 @@ d_init (void)
VersionCondition::addPredefinedGlobalIdent (D_VENDOR_VERSYM);
#endif
-#ifdef TARGET_ARM
- if (TARGET_AAPCS_BASED)
- VersionCondition::addPredefinedGlobalIdent("ARM_EABI");
-#endif
-
if (BYTES_BIG_ENDIAN)
VersionCondition::addPredefinedGlobalIdent ("BigEndian");
else
@@ -274,11 +269,6 @@ d_init (void)
if (targetm_common.except_unwind_info (&global_options) == UI_SJLJ)
VersionCondition::addPredefinedGlobalIdent ("GNU_SjLj_Exceptions");
-#ifdef TARGET_LONG_DOUBLE_128
- if (TARGET_LONG_DOUBLE_128)
- VersionCondition::addPredefinedGlobalIdent ("GNU_LongDouble128");
-#endif
-
#ifdef STACK_GROWS_DOWNWARD
VersionCondition::addPredefinedGlobalIdent ("GNU_StackGrowsDown");
#endif
@@ -184,32 +184,12 @@ version( GNU )
}
else version( ARM )
{
- version( ARM_EABI )
- {
- // Layout of this struct must match __gnuc_va_list for C ABI compatibility
- struct __va_list
- {
- void* ptr;
- }
-
- void va_arg()(ref va_list apx, TypeInfo ti, void* parmn)
- {
- __va_list* ap = cast(__va_list*)apx;
- auto p = ap.ptr;
- auto tsize = ti.tsize();
- ap.ptr = cast(va_list)( cast(void*) p + ( ( tsize + size_t.sizeof - 1 ) & ~( size_t.sizeof - 1 ) ) );
- parmn[0..tsize] = p[0..tsize];
- }
- }
- else
+ void va_arg()(ref va_list ap, TypeInfo ti, void* parmn)
{
- void va_arg()(ref va_list ap, TypeInfo ti, void* parmn)
- {
- auto p = ap;
- auto tsize = ti.tsize();
- ap = cast(va_list)( cast(void*) p + ( ( tsize + size_t.sizeof - 1 ) & ~( size_t.sizeof - 1 ) ) );
- parmn[0..tsize] = p[0..tsize];
- }
+ auto p = *cast(void**) &ap;
+ auto tsize = ti.tsize();
+ *cast(void**) &ap += ( tsize + size_t.sizeof - 1 ) & ~( size_t.sizeof - 1 );
+ parmn[0..tsize] = p[0..tsize];
}
}
else
View
@@ -4668,14 +4668,7 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr)
}
else version(ARM)
{
- version(ARM_EABI)
- {
- __va_list va;
- va.ptr = p;
- argptr = cast(va_list) va;
- }
- else
- argptr = p;
+ *cast(void**) &argptr = p;
}
else
{
@@ -4733,13 +4726,7 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr)
}
else version (ARM)
{
- version (ARM_EABI)
- { __va_list va;
- va.ptr = pkey;
- argptr = cast(va_list) va;
- }
- else
- argptr = cast(va_list) pkey;
+ *cast(void**) &argptr = pkey;
}
else
{
@@ -4764,13 +4751,7 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr)
}
else version (ARM)
{
- version (ARM_EABI)
- { __va_list va2;
- va.ptr = pvalue;
- argptr = cast(va_list) va2;
- }
- else
- argptr = cast(va_list) pvalue;
+ *cast(void**) &argptr = pvalue;
}
else
{
@@ -4929,12 +4910,7 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr)
else version (X86_64)
putArray((cast(__va_list*)argptr).stack_args, (cast(TypeInfo_StaticArray)ti).len, cast()(cast(TypeInfo_StaticArray)ti).next);
else version (ARM)
- {
- version (ARM_EABI)
- putArray((cast(__va_list)argptr).ptr, (cast(TypeInfo_StaticArray)ti).len, cast()(cast(TypeInfo_StaticArray)ti).next);
- else
- putArray(argptr, (cast(TypeInfo_StaticArray)ti).len, cast()(cast(TypeInfo_StaticArray)ti).next);
- }
+ putArray(*cast(void**) &argptr, (cast(TypeInfo_StaticArray)ti).len, cast()(cast(TypeInfo_StaticArray)ti).next);
else
{
static if (is(va_list == void*))
@@ -5069,19 +5045,8 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr)
}
else version (ARM)
{
- void* p;
- version (ARM_EABI)
- {
- auto talign = tis.talign();
- __va_list* ap = cast(__va_list*)&argptr;
- p = ap.ptr;
- ap.ptr += (tis.tsize() + size_t.sizeof - 1) & ~(size_t.sizeof - 1);
- }
- else
- {
- p = argptr;
- argptr += (tis.tsize() + size_t.sizeof - 1) & ~(size_t.sizeof - 1);
- }
+ void* p = *cast(void**) &argptr;
+ *cast(void**) &argptr += (tis.tsize() + size_t.sizeof - 1) & ~(size_t.sizeof - 1);
s = tis.xtoString(p);
}
else

0 comments on commit fc61260

Please sign in to comment.