[PATCH 3/5] libstdthreads/thrd.c: Mark path as unreachable on GCC to resolve warning

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Mar 22 06:26:59 UTC 2016



On 21/03/16 17:53, Joel Sherrill wrote:
>
>
> On Mon, Mar 21, 2016 at 7:33 AM, Sebastian Huber 
> <sebastian.huber at embedded-brains.de 
> <mailto:sebastian.huber at embedded-brains.de>> wrote:
>
>
>
>     On 21/03/16 13:31, Joel Sherrill wrote:
>
>
>
>         On Mon, Mar 21, 2016 at 1:26 AM, Sebastian Huber
>         <sebastian.huber at embedded-brains.de
>         <mailto:sebastian.huber at embedded-brains.de>
>         <mailto:sebastian.huber at embedded-brains.de
>         <mailto:sebastian.huber at embedded-brains.de>>> wrote:
>
>
>
>             On 20/03/16 21:40, Joel Sherrill wrote:
>
>                 ---
>                   cpukit/libstdthreads/thrd.c | 3 +++
>                   1 file changed, 3 insertions(+)
>
>                 diff --git a/cpukit/libstdthreads/thrd.c
>                 b/cpukit/libstdthreads/thrd.c
>                 index c2e439f..cc2d20f 100644
>                 --- a/cpukit/libstdthreads/thrd.c
>                 +++ b/cpukit/libstdthreads/thrd.c
>                 @@ -96,6 +96,9 @@ thrd_exit(int res)
>                   {
>                         pthread_exit((void *)(intptr_t)res);
>                 +       #if defined(__GNUC__)
>                 +               __builtin_unreachable();
>                 +       #endif
>                   }
>                     int
>
>
>             We should fix the pthread_exit() declaration instead, e.g.
>         FreeBSD
>             has this:
>
>             void          pthread_exit(void *) __dead2;
>
>         Does that map to gcc noreturn? And does newlib have that?
>
>
>     Yes, or Noreturn if you use the appropriate C++ version. Needs
>     <sys/cdefs.h>.
>
>
> That moves the noreturn warning.
>
> /data/home/joel/test-gcc/install-head/sparc-rtems4.12/include/pthread.h: 
> In function 'pthread_exit':
> ../../../../../../rtems/c/src/../../cpukit/posix/src/pthreadexit.c:78:1: 
> warning: 'noreturn' function does return
>  }
>  ^
> Other than marking pthread_exit's return as unreachable, do you have 
> another suggestion?

https://lists.rtems.org/pipermail/devel/2016-March/014061.html

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list