bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Fix compilation warning on Solaris 2.5.1


From: Eric Botcazou
Subject: Re: [PATCH] Fix compilation warning on Solaris 2.5.1
Date: Mon, 30 Jun 2003 09:10:35 +0200
User-agent: KMail/1.4.3

[Sorry for the delay, the week-end was hot :-)]

>   1) It does not address the reason of the warning. Namely, at the
>      times of Solaris 2.5.1, this *_unlocked API was not stable; in
>      fact these functions were removed in Solaris 2.6. So if you use
>      them in Solaris 2.5.1, you create binaries that don't work on
>      Solaris 2.6 !

Sure, but:
- this is not a problem for GCC,
- we have lived with this for almost 6 years, so it probably doesn't really 
matter that much.

>   2) Defining _REENTRANT is a dangerous global switch. It might require
>      that you link to a thread library, or maybe on FreeBSD that you
>      link with libc_r instead of libc.

Ah! Ok, thanks for the clarification.

> Please use this patch instead (resolving possible rejects manually).

Are we going to potentially disable the use of the functions on many systems 
just because of a single warning on Solaris 2.5.1? I'm not sure it is the 
way to go for GCC.

Why not simply add the missing declaration, after testing that we really need 
to do so? GCC already uses this method:

gcc/configure.in:849
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
gcc_AC_CHECK_DECLS(getenv atol sbrk abort atof getcwd getwd \
        strsignal putc_unlocked fputs_unlocked fwrite_unlocked \
        fprintf_unlocked strstr errno vasprintf \
        malloc realloc calloc free basename getopt clock, , ,[
#include "ansidecl.h"
#include "system.h"])

We could do

#if (defined _LIBC_REENTRANT || defined HAVE_FGETS_UNLOCKED)
    && HAVE_DECL_FGETS_UNLOCKED
# undef fgets
# define fgets(buf, len, s) fgets_unlocked (buf, len, s)
#endif

#if (defined _LIBC_REENTRANT || defined HAVE_FEOF_UNLOCKED)
  && HAVE_DECL_FEOF_UNLOCKED
# undef feof
# define feof(s) feof_unlocked (s)
#endif

> !   dnl Use the *_unlocked functions only if they are declared.
> !   dnl (because some of them were declared in Solaris 2.5.1 but were
> removed !   dnl in Solaris 2.6, whereas we want binaries built on Solaris
> 2.5.1 to run !   dnl on Solaris 2.6).

No, they were not declared in Solaris 2.5.1, that's the problem.

-- 
Eric Botcazou




reply via email to

[Prev in Thread] Current Thread [Next in Thread]