This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: Silence compiler warning on


Mark Kettenis <mark.kettenis@xs4all.nl> writes:

> > From: Ian Lance Taylor <ian@airs.com>
> > Date: 18 Apr 2006 16:13:59 -0700
> > 
> > Mark Kettenis <mark.kettenis@xs4all.nl> writes:
> > 
> > > Index: ChangeLog
> > > from  Mark Kettenis  <kettenis@jive.nl>
> > > 
> > >         * bfd.c (_bfd_abort): Provide prototype for _exit with
> > >         ATTRIBUTE_NORETURN.
> > 
> > I think something like this should use AC_CHECK_DECLS to avoid a
> > conflict with the system header files.
> 
> I fail to see how that would work.  I'm not trying to add a missing
> prototype; I'm trying to augment a prototype with a noreturn attribute.

You're right, AC_CHECK_DECLS isn't the right thing to use.  What is
needed is some test to make sure that you can compile code with the
declaration that you want to add.

> A conflict with the system header files seems rather unlikely; the
> only variation I could imagine, is that some (pre ISO C) header files
> fail to provide the proper return type.

_exit is not an ISO C function.  System header files are sadly
unreliable when it comes to declaring functions.  If the system header
file happens to declare the function in some incompatible way--say it
uses unsigned int--then you will introduce a build failure.

I think it's safer to use an autoconf test to see whether the
prototype declaration is safe.

We've had unfortunate experiences over the years with attempts to
declare functions which should be declared in system header files.

Ian


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