This is the mail archive of the binutils@sources.redhat.com 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: Question about another IA64 HP-UX build problem


> > Here is the patch I came up with to address the getc_unlocked problem.
> > The problem is that HAVE_GETC_UNLOCKED is true (because HP-UX has it)
> > but the declaration isn't seen because we didn't compile with
> > -D_REENTRENT, thus we get a no-declaration error.  Tested on IA64 HP-UX.
> 
> If you're going to use BFD_NEED_DECLARATION, please use it to provide
> the declaration instead :-)
> 
> -- 
> Daniel Jacobowitz
> CodeSourcery, LLC

I considered that, but I don't think I really want to do that.  I don't
believe I should use getc_unlocked unless I have the official OS
declaration for it.  If we were using a newer autoconf I would have
used 'AC_CHECK_DECLS(getc_unlocked)' and then my ifdef would have been:

#if defined(HAVE_GETC_UNLOCKED) && defined(HAVE_DECL_GETC_UNLOCKED)

which would look better but does the same thing.

The idea is to use getc_unlocked only if the OS provided a declaration
for it and not to use it if you just found it in libc but didn't see a
declaration for it.

On HP-UX the <stdio.h> header file will automatically convert getc into
getc_unlocked if you did not compile with -D_REENTRENT which tells the
compiler you are doing multithreaded stuff.  Without the -D_REENTRENT
getc is unlocked anyway and the getc_unlocked declaration is not
visible.

Steve Ellcey
sje@cup.hp.com


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