c-common.c (c_common_nodes_and_builtins): Add _Exit builtin.
* c-common.c (c_common_nodes_and_builtins): Add _Exit builtin. * extend.texi: Document _Exit builtin. testsuite: * gcc.c-torture/execute/builtin-noret-1.c: New test. From-SVN: r38771
This commit is contained in:
parent
7ca3d2b152
commit
796cdb659f
|
@ -1,3 +1,8 @@
|
|||
2001-01-07 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||
|
||||
* c-common.c (c_common_nodes_and_builtins): Add _Exit builtin.
|
||||
* extend.texi: Document _Exit builtin.
|
||||
|
||||
2001-01-07 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||
|
||||
* (initialize, initialize_builtins,
|
||||
|
|
|
@ -5558,9 +5558,11 @@ c_common_nodes_and_builtins ()
|
|||
builtin_function_2 (NULL_PTR, "alloca", NULL_TREE, ptr_ftype_sizetype,
|
||||
BUILT_IN_ALLOCA, BUILT_IN_NORMAL, 0, 1, 0);
|
||||
#endif
|
||||
/* Declare _exit just to mark it as non-returning. */
|
||||
/* Declare _exit and _Exit just to mark them as non-returning. */
|
||||
builtin_function_2 (NULL_PTR, "_exit", NULL_TREE, void_ftype_int,
|
||||
0, NOT_BUILT_IN, 0, 1, 1);
|
||||
builtin_function_2 (NULL_PTR, "_Exit", NULL_TREE, void_ftype_int,
|
||||
0, NOT_BUILT_IN, 0, !flag_isoc99, 1);
|
||||
|
||||
builtin_function_2 ("__builtin_index", "index",
|
||||
string_ftype_cstring_int, string_ftype_cstring_int,
|
||||
|
|
|
@ -3371,6 +3371,7 @@ function as well.
|
|||
@findex creall
|
||||
@findex exit
|
||||
@findex _exit
|
||||
@findex _Exit
|
||||
@findex fabs
|
||||
@findex fabsf
|
||||
@findex fabsl
|
||||
|
@ -3421,10 +3422,11 @@ option. Many of these functions are only optimized in certain cases; if
|
|||
not optimized in a particular case, a call to the library function will
|
||||
be emitted.
|
||||
|
||||
The functions @code{abort}, @code{exit}, and @code{_exit} are recognized
|
||||
and presumed not to return, but otherwise are not built in.
|
||||
@code{_exit} is not recognized in strict ISO C mode (@samp{-ansi},
|
||||
@samp{-std=c89} or @samp{-std=c99}).
|
||||
The functions @code{abort}, @code{exit}, @code{_Exit} and @code{_exit}
|
||||
are recognized and presumed not to return, but otherwise are not built
|
||||
in. @code{_exit} is not recognized in strict ISO C mode (@samp{-ansi},
|
||||
@samp{-std=c89} or @samp{-std=c99}). @code{_Exit} is not recognized in
|
||||
strict C89 mode (@samp{-ansi} or @samp{-std=c89}).
|
||||
|
||||
Outside strict ISO C mode, the functions @code{alloca}, @code{bcmp},
|
||||
@code{bzero}, @code{index}, @code{rindex} and @code{ffs} may be handled
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2001-01-07 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||
|
||||
* gcc.c-torture/execute/builtin-noret-1.c: New test.
|
||||
|
||||
2001-01-07 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||
|
||||
* gcc.dg/format/format.h: New file.
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
/* Test for builtin noreturn attributes. */
|
||||
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
|
||||
|
||||
extern void abort (void);
|
||||
extern void exit (int);
|
||||
#if 0 /* Doesn't work with prototype (bug?). */
|
||||
extern void _exit (int);
|
||||
extern void _Exit (int);
|
||||
#endif
|
||||
|
||||
extern void tabort (void);
|
||||
extern void texit (void);
|
||||
extern void t_exit (void);
|
||||
extern void t_Exit (void);
|
||||
|
||||
extern void link_failure (void);
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
volatile int i = 0;
|
||||
/* The real test here is that the program links. */
|
||||
if (i)
|
||||
tabort ();
|
||||
if (i)
|
||||
texit ();
|
||||
if (i)
|
||||
t_exit ();
|
||||
if (i)
|
||||
t_Exit ();
|
||||
exit (0);
|
||||
}
|
||||
|
||||
void
|
||||
tabort (void)
|
||||
{
|
||||
abort ();
|
||||
link_failure ();
|
||||
}
|
||||
|
||||
void
|
||||
texit (void)
|
||||
{
|
||||
exit (1);
|
||||
link_failure ();
|
||||
}
|
||||
|
||||
void
|
||||
t_exit (void)
|
||||
{
|
||||
_exit (1);
|
||||
link_failure ();
|
||||
}
|
||||
|
||||
/* Some non-Unix libcs might not have _exit. This version should never
|
||||
get called. */
|
||||
static void
|
||||
_exit (int i)
|
||||
{
|
||||
abort ();
|
||||
}
|
||||
|
||||
void
|
||||
t_Exit (void)
|
||||
{
|
||||
_Exit (1);
|
||||
link_failure ();
|
||||
}
|
||||
|
||||
/* Some libcs might not have _Exit. This version should never get called. */
|
||||
static void
|
||||
_Exit (int i)
|
||||
{
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* When optimizing, no calls to link_failure should remain. In any case,
|
||||
link_failure should not be called. */
|
||||
|
||||
#ifndef __OPTIMIZE__
|
||||
void
|
||||
link_failure (void)
|
||||
{
|
||||
abort ();
|
||||
}
|
||||
#endif
|
Loading…
Reference in New Issue