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: Bruno Haible
Subject: Re: [PATCH] Fix compilation warning on Solaris 2.5.1
Date: Mon, 30 Jun 2003 12:49:27 +0200
User-agent: KMail/1.5

Eric Botcazou wrote:
> [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,

True but a patch that goes into libintl should work outside GCC too.

> - we have lived with this for almost 6 years, so it probably doesn't really
> matter that much.

The reason is that few people have built gcc with i18n enabled in the past.

> > 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?

We disable these functions on those systems which don't declare them.
These are Solaris 2.5.1 (because I want binary upward compatibility
between Solaris 2.5.1 and 2.6) and glibc-2.0.x (which hardly anyone
uses or cares about today).

> > !   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.

OK, I'm fixing the comment, so it now reads:

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

Find below the updated complete patch.

> I'm not sure it is the way to go for GCC.

If I put a fix for an issue into gettext 0.12.2, I'm not sure it's
desirable for you to put a different fix into the gcc/libintl sources.

Bruno


2003-06-27  Bruno Haible  <address@hidden>

        Avoid use of *_unlocked functions on Solaris 2.5.1.
        * gettext.m4 (AM_INTL_SUBDIR): Don't test for the functions
        feof_unlocked, fgets_unlocked, getc_unlocked. Test for their
        declaration instead.
        (gt_CHECK_DECL): New macro.
        Reported by Eric Botcazou <address@hidden>.

2003-06-27  Bruno Haible  <address@hidden>

        Avoid use of *_unlocked functions on Solaris 2.5.1.
        * localcharset.c: Test HAVE_DECL_GETC_UNLOCKED, not HAVE_GETC_UNLOCKED.
        * localealias.c: Test HAVE_DECL_*_UNLOCKED, not HAVE_*_UNLOCKED.
        Reported by Eric Botcazou <address@hidden>.

*** m4/gettext.m4       19 Jun 2003 12:45:06 -0000      1.9
--- m4/gettext.m4       27 Jun 2003 12:10:06 -0000
***************
*** 377,386 ****
    AC_CHECK_TYPES([ptrdiff_t])
    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
  stdlib.h string.h unistd.h sys/param.h])
!   AC_CHECK_FUNCS([asprintf feof_unlocked fgets_unlocked getc_unlocked getcwd \
! getegid geteuid getgid getuid mempcpy munmap putenv setenv setlocale snprintf 
\
! stpcpy strcasecmp strdup strtoul tsearch wprintf __argz_count \
! __argz_stringify __argz_next __fsetlocking])
  
    case $gt_cv_func_printf_posix in
      *yes) HAVE_POSIX_PRINTF=1 ;;
--- 377,394 ----
    AC_CHECK_TYPES([ptrdiff_t])
    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
  stdlib.h string.h unistd.h sys/param.h])
!   AC_CHECK_FUNCS([asprintf getcwd getegid geteuid getgid getuid mempcpy \
! munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup strtoul \
! tsearch wprintf __argz_count __argz_stringify __argz_next __fsetlocking])
! 
!   dnl Use the *_unlocked functions only if they are declared.
!   dnl (because some of them were defined without being declared in Solaris
!   dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
!   dnl on Solaris 2.5.1 to run on Solaris 2.6).
!   dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
!   gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>])
!   gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>])
!   gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
  
    case $gt_cv_func_printf_posix in
      *yes) HAVE_POSIX_PRINTF=1 ;;
***************
*** 442,447 ****
--- 450,475 ----
    if test $ac_verc_fail = yes; then
      INTLBISON=:
    fi
+ ])
+ 
+ 
+ dnl gt_CHECK_DECL(FUNC, INCLUDES)
+ dnl Check whether a function is declared.
+ AC_DEFUN([gt_CHECK_DECL],
+ [
+   AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1,
+     [AC_TRY_COMPILE([$2], [
+ #ifndef $1
+   char *p = (char *) $1;
+ #endif
+ ], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
+   if test $ac_cv_have_decl_$1 = yes; then
+     gt_value=1
+   else
+     gt_value=0
+   fi
+   AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
+     [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
  ])
  
  
*** intl/localcharset.c 14 Apr 2003 13:39:21 -0000      1.4
--- intl/localcharset.c 27 Jun 2003 12:10:06 -0000
***************
*** 86,92 ****
  # define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
  #endif
  
! #ifdef HAVE_GETC_UNLOCKED
  # undef getc
  # define getc getc_unlocked
  #endif
--- 86,92 ----
  # define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
  #endif
  
! #if HAVE_DECL_GETC_UNLOCKED
  # undef getc
  # define getc getc_unlocked
  #endif
*** intl/localealias.c  31 Mar 2003 20:02:54 -0000      1.3
--- intl/localealias.c  27 Jun 2003 12:10:06 -0000
***************
*** 110,120 ****
  # define freea(p) free (p)
  #endif
  
! #if defined _LIBC_REENTRANT || defined HAVE_FGETS_UNLOCKED
  # undef fgets
  # define fgets(buf, len, s) fgets_unlocked (buf, len, s)
  #endif
! #if defined _LIBC_REENTRANT || defined HAVE_FEOF_UNLOCKED
  # undef feof
  # define feof(s) feof_unlocked (s)
  #endif
--- 110,120 ----
  # define freea(p) free (p)
  #endif
  
! #if defined _LIBC_REENTRANT || HAVE_DECL_FGETS_UNLOCKED
  # undef fgets
  # define fgets(buf, len, s) fgets_unlocked (buf, len, s)
  #endif
! #if defined _LIBC_REENTRANT || HAVE_DECL_FEOF_UNLOCKED
  # undef feof
  # define feof(s) feof_unlocked (s)
  #endif





reply via email to

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