summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/c-common.c4
-rw-r--r--gcc/extend.texi10
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtin-noret-1.c86
5 files changed, 104 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0f68b9033b4..2aa50d0edec 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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,
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 1e36874190c..3a76510428e 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -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,
diff --git a/gcc/extend.texi b/gcc/extend.texi
index 5778a9bde1b..e893c67f15c 100644
--- a/gcc/extend.texi
+++ b/gcc/extend.texi
@@ -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
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e24ff842f04..0626643f7e2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@
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.
* gcc.dg/format/array-1.c, gcc.dg/format/attr-1.c,
gcc.dg/format/branch-1.c, gcc.dg/format/c90-printf-1.c,
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtin-noret-1.c b/gcc/testsuite/gcc.c-torture/execute/builtin-noret-1.c
new file mode 100644
index 00000000000..cfd78991214
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/builtin-noret-1.c
@@ -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