fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / libgloss / mn10200 / _exit.c
blobec51d40884542aa4dac5d15da1279d47fe29a091
1 #include <_ansi.h>
2 #include <sys/types.h>
3 #include <sys/stat.h>
4 #include "trap.h"
7 static void _do_dtors()
9 /* The loop variable is static so that if a destructor calls exit,
10 and we return here, we simply continue with the next destructor. */
11 typedef void (*pfunc) ();
12 extern pfunc __dtors[];
13 extern pfunc __dtors_end[];
14 static pfunc *p = __dtors;
16 while (p < __dtors_end)
17 (*p++) ();
21 void _exit (n)
23 /* Destructors should be done earlier because they need to be done before the
24 files are closed, but here is better than nowhere (and this balances the
25 constructors done in crt1.c. */
26 _do_dtors();
28 TRAP0 (SYS_exit, n, 0, 0);