This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch: Run init tests only when __cxa_atexit is supported.
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: mark at codesourcery dot com
- Cc: pinskia at physics dot uc dot edu, gcc-patches at gcc dot gnu dot org
- Date: Tue, 16 May 2006 14:47:34 -0700 (PDT)
- Subject: Re: Patch: Run init tests only when __cxa_atexit is supported.
> > The only problem with this is that it doesn't allow me to paper over the
> > other problem with init18.C, namely that it calls _Exit.
>
> We have lots of other tests that declare -- and then use -- _exit. So,
> I would just switch that test to use _exit. That change is
> pre-approved, so long as you copy the xfail list from
> g++.old-deja/g++.pt/static11.C, as the problem described there will
> presumably apply to init18.C as well.
>
> --
> Mark Mitchell
> CodeSourcery
> mark@codesourcery.com
> (650) 331-3385 x713
OK, here is the new patch with _Exit changed to _exit and the failure
list copied over from static11. I will check this in tomorrow after my
nightly testing.
Steve Ellcey
sje@cup.hp.com
2006-05-16 Steve Ellcey <sje@cup.hp.com>
* g++.old-deja/g++.other/init5.C: XFAIL if dg-require-cxa-atexit is
false.
* g++.old-deja/g++.other/init19.C: Ditto.
* g++.old-deja/g++.other/init18.C: Ditto, plus change _Exit to _exit
and add other platforms as expected failures.
Index: g++.old-deja/g++.other/init5.C
===================================================================
--- g++.old-deja/g++.other/init5.C (revision 113809)
+++ g++.old-deja/g++.other/init5.C (working copy)
@@ -1,4 +1,4 @@
-// { dg-do run }
+// { dg-do run { xfail { ! { dg-require-cxa-atexit } } } }
// Objects must be destructed in decreasing cnt order
// Original test attributed to James Kanze <jkanze@otelo.ibmmail.com>
Index: g++.old-deja/g++.other/init18.C
===================================================================
--- g++.old-deja/g++.other/init18.C (revision 113809)
+++ g++.old-deja/g++.other/init18.C (working copy)
@@ -1,6 +1,14 @@
-// { dg-do run }
+// Some targets (e.g. those with "set_board_info needs_status_wrapper 1"
+// in their dejagnu baseboard description) require that the status is
+// final when exit is entered (or main returns), and not "overruled" by a
+// destructor calling _exit. It's not really worth it to handle that.
+//
+// Any platform that doesn't have proper __cxa_atexit support will also fail.
+//
+// { dg-do run { xfail { { ! { dg-require-cxa-atexit } } || { mmix-knuth-mmixware xtensa-*-elf* arm*-*-elf arm*-*-eabim68k-*-elf } } } }
#include <stdlib.h>
+extern "C" void _exit (int);
static int cnt = 0;
@@ -8,7 +16,7 @@ class Foo2
{
public:
Foo2() {};
- ~Foo2() { if (++cnt == 2) _Exit (0); };
+ ~Foo2() { if (++cnt == 2) _exit (0); };
};
static Foo2& GetFoo2()
Index: g++.old-deja/g++.other/init19.C
===================================================================
--- g++.old-deja/g++.other/init19.C (revision 113809)
+++ g++.old-deja/g++.other/init19.C (working copy)
@@ -1,4 +1,4 @@
-// { dg-do run }
+// { dg-do run { xfail { ! { dg-require-cxa-atexit } } } }
#include <stdlib.h>
#define assert(x) do { if (! (x)) abort(); } while (0)