Skip to content

Commit

Permalink
Fix warnings due to return in void functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Jan 11, 2012
1 parent daa891c commit 5452bff
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
6 changes: 6 additions & 0 deletions nptl/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2012-01-11 Marek Polacek <polacek@redhat.com>

* forward.c (FORWARD_NORETURN): Define macro.
(__pthread_unwind): Use FORWARD_NORETURN macro to avoid warning.
(__pthread_exit): Likewise.

2012-01-10 Ulrich Drepper <drepper@gmail.com>

* sysdeps/pthread/pthread.h: Add const attribute to pthread_equal.
Expand Down
21 changes: 15 additions & 6 deletions nptl/forward.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2004, 2007, 2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
Expand Down Expand Up @@ -42,6 +42,17 @@ name decl \
return PTHFCT_CALL (ptr_##name, params); \
}

/* Same as FORWARD2, only without return. */
#define FORWARD_NORETURN(name, rettype, decl, params, defaction) \
rettype \
name decl \
{ \
if (!__libc_pthread_functions_init) \
defaction; \
\
PTHFCT_CALL (ptr_##name, params); \
}

#define FORWARD(name, decl, params, defretval) \
FORWARD2 (name, int, decl, params, return defretval)

Expand Down Expand Up @@ -160,8 +171,8 @@ FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2),
(thread1, thread2), 1)


/* Use an alias to avoid warning, as pthread_exit is declared noreturn. */
FORWARD2 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS))
FORWARD_NORETURN (__pthread_exit, void, (void *retval), (retval),
exit (EXIT_SUCCESS))
strong_alias (__pthread_exit, pthread_exit);


Expand Down Expand Up @@ -192,13 +203,11 @@ FORWARD (pthread_setcancelstate, (int state, int *oldstate), (state, oldstate),

FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)

#define return /* value is void */
FORWARD2(__pthread_unwind,
FORWARD_NORETURN(__pthread_unwind,
void attribute_hidden __attribute ((noreturn)) __cleanup_fct_attribute
attribute_compat_text_section,
(__pthread_unwind_buf_t *buf), (buf), {
/* We cannot call abort() here. */
INTERNAL_SYSCALL_DECL (err);
INTERNAL_SYSCALL (kill, err, 1, SIGKILL);
})
#undef return

0 comments on commit 5452bff

Please sign in to comment.