From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12006 invoked by alias); 4 May 2006 18:39:59 -0000 Received: (qmail 11992 invoked by uid 22791); 4 May 2006 18:39:58 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Thu, 04 May 2006 18:39:33 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1Fbija-0001sg-SU; Thu, 04 May 2006 14:39:31 -0400 Date: Thu, 04 May 2006 18:39:00 -0000 From: Daniel Jacobowitz To: Mark Kettenis Cc: binutils@sourceware.org Subject: Re: Silence compiler warning on Message-ID: <20060504183930.GA6506@nevyn.them.org> Mail-Followup-To: Mark Kettenis , binutils@sourceware.org References: <200604180912.k3I9Cvra015638@elgar.sibelius.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200604180912.k3I9Cvra015638@elgar.sibelius.xs4all.nl> User-Agent: Mutt/1.5.8i Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00084.txt.bz2 On Tue, Apr 18, 2006 at 11:12:57AM +0200, Mark Kettenis wrote: > Right now, when I compile BFD on HP-UX 10.20, I get the following > warning (wich is fatal because of -Werror): > > /export/jive/kettenis/src/gdb/bfd/bfd.c: In function `_bfd_abort': > /export/jive/kettenis/src/gdb/bfd/bfd.c:801: warning: `noreturn' function does return > > The problem here is that the system headers don't declare _exit() with > __attribute__((noreturn). Previously we didn't get this warning > because _bfd_abort() called xexit(), which was declared with > __attribute__((noreturn)) (and xexit.c was compiled without -Werror). > > The attached patch is an attempt to fix this. Ok? > > > Index: ChangeLog > from Mark Kettenis > > * bfd.c (_bfd_abort): Provide prototype for _exit with > ATTRIBUTE_NORETURN. I would like this fixed before binutils 2.17. Does something like this work for you? -- Daniel Jacobowitz CodeSourcery 2006-05-04 Daniel Jacobiwtz * configure.in: Check if _exit with ATTRIBUTE_NORETURN is OK. * bfd.c (_bfd_abort): Handle USE_EXIT_NORETURN. * configure, config.in: Regenerated. Index: configure.in =================================================================== RCS file: /cvs/src/src/bfd/configure.in,v retrieving revision 1.206 diff -u -p -r1.206 configure.in --- configure.in 16 Apr 2006 18:01:02 -0000 1.206 +++ configure.in 4 May 2006 18:37:57 -0000 @@ -159,6 +159,19 @@ AC_CHECK_DECLS(strstr) AC_CHECK_DECLS(snprintf) AC_CHECK_DECLS(vsnprintf) +# At least HP-UX 10.20 declares _exit without noreturn. If we can +# add the attribute ourselves, we'll do so. +AC_CACHE_CHECK([if we can redeclare _exit], bfd_cv_exit_noreturn, +[AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([#include "../include/ansidecl.h"], + [[extern void _exit (int) ATTRIBUTE_NORETURN; _exit (0);]])], + [bfd_cv_exit_noreturn=yes], + [bfd_cv_exit_noreturn=no])]) +if test "$bfd_cv_exit_noreturn" = yes; then + AC_DEFINE(USE_EXIT_NORETURN, 1, + [Define if redeclaring _exit with noreturn is OK]) +fi + # If we are configured native, pick a core file support file. COREFILE= COREFLAG= Index: bfd.c =================================================================== RCS file: /cvs/src/src/bfd/bfd.c,v retrieving revision 1.81 diff -u -p -r1.81 bfd.c --- bfd.c 16 Mar 2006 12:20:15 -0000 1.81 +++ bfd.c 4 May 2006 18:37:57 -0000 @@ -783,6 +783,10 @@ bfd_assert (const char *file, int line) void _bfd_abort (const char *file, int line, const char *fn) { +#ifdef USE_EXIT_NORETURN + /* Make sure the compiler knows _exit doesn't return. */ + extern void _exit (int) ATTRIBUTE_NORETURN; +#endif if (fn != NULL) (*_bfd_error_handler) (_("BFD %s internal error, aborting at %s line %d in %s\n"),