This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: eliminate warning from libnosys/_exit.c


On Tue, Dec 05, 2006 at 05:44:00PM +1100, Ben Elliston wrote:
> GCC recognises a limited set of statements as non-returning.  For
> functions marked `noreturn' that do not meet this criteria, GCC emits
> a warning.  This patch eliminates this warning by ensuring that GCC
> believes the function to not return.  OK for mainline?
> 
> 2006-12-05  Ben Elliston  <bje@au.ibm.com>
> 
>         * libnosys/_exit.c (_exit): Finish with an infinite loop to
>         eliminate a warning about this noreturn function returning.
> 
> Index: libnosys/_exit.c
> ===================================================================
> RCS file: /cvs/src/src/libgloss/libnosys/_exit.c,v
> retrieving revision 1.1
> diff -u -r1.1 _exit.c
> --- libnosys/_exit.c    25 Jun 2004 22:17:04 -0000      1.1
> +++ libnosys/_exit.c    5 Dec 2006 06:37:35 -0000
> @@ -12,4 +12,8 @@
>    /* Default stub just causes a divide by 0 exception.  */
>    int x = rc / INT_MAX;
>    x = 4 / x;
> +
> +  /* Convince GCC that this function never returns.  */
> +  for (;;)
> +    ;
>  }

would adding __attribute__ ((noreturn)) be appropriate as well?

-- 
  Aaron J. Grier  |   Frye Electronics, Tigard, OR   |  aaron@frye.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]