Add more noreturn attributes
Andreas Jaeger
aj@suse.de
Sat Apr 21 10:49:00 GMT 2001
The appended patch silences most of the "function might be possible
candidate for attribute `noreturn'" warnings from GCC.
I've got one question about thread_func in
linuxthreads/sysdeps/pthread/timer_routines.c which has a while (1)
loop. Can it ever return? gcc issues the noreturn warning.
Ok to commit?
Andreas
2001-04-21 Andreas Jaeger <aj@suse.de>
* rt/aio_misc.c (handle_fildes_io): Add noreturn attribute.
* resolv/gai_misc.c (handle_requests): Likewise.
* malloc/obstack.c (print_and_abort): Likewise.
* malloc/mcheck.c (mabort): Likewise.
For linuxthreads:
2001-04-21 Andreas Jaeger <aj@suse.de>
* manager.c (__pthread_manager): Add noreturn
attribute.
(pthread_start_thread): Likewise, remove return statement.
(pthread_start_thread_event): Likewise.
Add noreturn attribute for pthread_handle_exit.
* weaks.c: Add noreturn attribute for pthread_exit.
============================================================
Index: malloc/mcheck.c
--- malloc/mcheck.c 2000/03/28 17:30:13 1.10
+++ malloc/mcheck.c 2001/04/21 17:33:13
@@ -1,5 +1,5 @@
/* Standard debugging hooks for `malloc'.
- Copyright (C) 1990-1997, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1990-1997, 1999, 2000, 2001 Free Software Foundation, Inc.
Written May 1989 by Mike Haertel.
This library is free software; you can redistribute it and/or
@@ -270,7 +270,8 @@
return (__ptr_t) (hdr + 1);
}
-static void mabort __P ((enum mcheck_status status));
+static void mabort __P ((enum mcheck_status status))
+ __attribute__ ((noreturn));
static void
mabort (status)
enum mcheck_status status;
============================================================
Index: malloc/obstack.c
--- malloc/obstack.c 2000/11/10 04:20:15 1.12
+++ malloc/obstack.c 2001/04/21 17:33:14
@@ -1,5 +1,5 @@
/* obstack.c - subroutines used implicitly by object stack macros
- Copyright (C) 1988-1994,96,97,98,99,2000 Free Software Foundation, Inc.
+ Copyright (C) 1988-1994,96,97,98,99,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
@@ -472,6 +472,7 @@
#endif
static void
+__attribute__ ((noreturn))
print_and_abort ()
{
fputs (_("memory exhausted"), stderr);
============================================================
Index: linuxthreads/weaks.c
--- linuxthreads/weaks.c 2000/12/27 17:15:25 1.11
+++ linuxthreads/weaks.c 2001/04/21 17:33:14
@@ -1,5 +1,5 @@
/* The weak pthread functions for Linux.
- Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -26,7 +26,8 @@
extern int __pthread_return_0 (void);
extern int __pthread_return_1 (void);
extern void __pthread_return_void (void);
-extern void weak_function pthread_exit (void *__retval);
+extern void weak_function pthread_exit (void *__retval)
+ __attribute__ ((noreturn));
/* Those are pthread functions which return 0 if successful. */
weak_alias (__pthread_return_0, BP_SYM (__libc_pthread_attr_init_2_1))
============================================================
Index: linuxthreads/manager.c
--- linuxthreads/manager.c 2001/04/21 07:50:45 1.67
+++ linuxthreads/manager.c 2001/04/21 17:33:16
@@ -96,13 +96,16 @@
int report_events,
td_thr_events_t *event_maskp);
static void pthread_handle_free(pthread_t th_id);
-static void pthread_handle_exit(pthread_descr issuing_thread, int exitcode);
+static void pthread_handle_exit(pthread_descr issuing_thread, int exitcode)
+ __attribute__ ((noreturn));
static void pthread_reap_children(void);
static void pthread_kill_all_threads(int sig, int main_thread_also);
/* The server thread managing requests for thread creation and termination */
-int __pthread_manager(void *arg)
+int
+__attribute__ ((noreturn))
+__pthread_manager(void *arg)
{
int reqfd = (int) (long int) arg;
struct pollfd ufd;
@@ -220,7 +223,9 @@
/* Process creation */
-static int pthread_start_thread(void *arg)
+static int
+__attribute__ ((noreturn))
+pthread_start_thread(void *arg)
{
pthread_descr self = (pthread_descr) arg;
struct pthread_request request;
@@ -270,10 +275,11 @@
p_start_args.arg));
/* Exit with the given return value */
__pthread_do_exit(outcome, CURRENT_STACK_FRAME);
- return 0;
}
-static int pthread_start_thread_event(void *arg)
+static int
+__attribute__ ((noreturn))
+pthread_start_thread_event(void *arg)
{
pthread_descr self = (pthread_descr) arg;
@@ -289,7 +295,7 @@
__pthread_unlock (THREAD_GETMEM(self, p_lock));
/* Continue with the real function. */
- return pthread_start_thread (arg);
+ pthread_start_thread (arg);
}
static int pthread_allocate_stack(const pthread_attr_t *attr,
============================================================
Index: resolv/gai_misc.c
--- resolv/gai_misc.c 2001/03/03 18:11:16 1.1
+++ resolv/gai_misc.c 2001/04/21 17:33:16
@@ -281,6 +281,7 @@
static void *
+__attribute__ ((noreturn))
handle_requests (void *arg)
{
struct requestlist *runp = (struct requestlist *) arg;
============================================================
Index: rt/aio_misc.c
--- rt/aio_misc.c 2001/03/03 18:08:20 1.17
+++ rt/aio_misc.c 2001/04/21 17:33:16
@@ -454,6 +454,7 @@
static void *
+__attribute__ ((noreturn))
handle_fildes_io (void *arg)
{
pthread_t self = pthread_self ();
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj
More information about the Libc-hacker
mailing list