Add more noreturn attributes
Andreas Jaeger
aj@suse.de
Sat Apr 21 11:45:00 GMT 2001
Ulrich Drepper <drepper@redhat.com> writes:
> Andreas Jaeger <aj@suse.de> writes:
>
> > The appended patch silences most of the "function might be possible
> > candidate for attribute `noreturn'" warnings from GCC.
>
> OK.
>
> > 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.
>
> I cannot return. And the unlock call can go therefore.
I've committed the following now,
Andreas
2001-04-21 Andreas Jaeger <aj@suse.de>
* sysdeps/pthread/timer_routines.c (thread_func): Add
noreturn attribute, remove statements that will never be executed.
============================================================
Index: linuxthreads/sysdeps/pthread/timer_routines.c
--- linuxthreads/sysdeps/pthread/timer_routines.c 2000/09/02 17:42:10 1.11
+++ linuxthreads/sysdeps/pthread/timer_routines.c 2001/04/21 18:43:47
@@ -1,5 +1,5 @@
/* Helper code for POSIX timer implementation on LinuxThreads.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Kaz Kylheku <kaz@ashi.footprints.net>.
@@ -370,6 +370,7 @@
timers in chronological order as close to their scheduled time as
possible. */
static void *
+__attribute__ ((noreturn))
thread_func (void *arg)
{
struct thread_node *self = arg;
@@ -437,11 +438,13 @@
else
pthread_cond_wait (&self->cond, &__timer_mutex);
}
-
+ /* These statements will never be executed since the while loop
+ loops forever:
pthread_mutex_unlock (&__timer_mutex);
pthread_cleanup_pop (1);
return NULL;
+ */
}
--
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