Re: time_r.m4 checks unexpectedly pass on hpux10

2008-02-24 Thread Peter O'Gorman
Bruno Haible wrote:

 The compile line and warning:
 cc -Ae -c lcltimecheck.c -D_REENTRANT 
 cc: lcltimecheck.c, line 7: warning 604: Pointers are not 
 assignment-compatible.
 
 Thanks for reporting this.

 How about this proposed patch? Does it work for you?

This worked. Thank you.

Peter




Re: time_r.m4 checks unexpectedly pass on hpux10

2008-02-24 Thread Bruno Haible
Peter O'Gorman wrote:
  How about this proposed patch? Does it work for you?
 
 This worked.

Paul Eggert wrote:
 Yes, that looks good to me

So I committed the patch.

Bruno





time_r.m4 checks unexpectedly pass on hpux10

2008-02-22 Thread Peter O'Gorman
Hi,

HP-UX10 has:
int gmtime_r(const time_t *timer, struct tm *result);
int localtime_r(const time_t *timer, struct tm *result);

Which is, as you know, not standards conforming.

However, compiling the test case for reentrant time functions on
hpux10 with its native cc and -Ae results in a compiler warning, not
an error. So the test, unfortunately, passes.

The test case is:
#include time.h

int main() {
/* We don't need to append 'restrict's to the argument types,
   even though the POSIX signature has the 'restrict's,   
   since C99 says they can't affect type compatibility.  */
   struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r;
   if (ptr) return 0;
}

The compile line and warning:
cc -Ae -c lcltimecheck.c -D_REENTRANT 
cc: lcltimecheck.c, line 7: warning 604: Pointers are not 
assignment-compatible.

Perhaps we should set ac_c_werror_flag=yes before running this test?

Thanks,
Peter






Re: time_r.m4 checks unexpectedly pass on hpux10

2008-02-22 Thread Bruno Haible
Hi,

Peter O'Gorman wrote:

 HP-UX10 has:
 int gmtime_r(const time_t *timer, struct tm *result);
 int localtime_r(const time_t *timer, struct tm *result);
 
 Which is, as you know, not standards conforming.
 
 However, compiling the test case for reentrant time functions on
 hpux10 with its native cc and -Ae results in a compiler warning, not
 an error. So the test, unfortunately, passes.
 
 The test case is:
 #include time.h
 
 int main() {
 /* We don't need to append 'restrict's to the argument types,
even though the POSIX signature has the 'restrict's,   
since C99 says they can't affect type compatibility.  */
struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r;
if (ptr) return 0;
 }
 
 The compile line and warning:
 cc -Ae -c lcltimecheck.c -D_REENTRANT 
 cc: lcltimecheck.c, line 7: warning 604: Pointers are not 
 assignment-compatible.

Thanks for reporting this.

 Perhaps we should set ac_c_werror_flag=yes before running this test?

ac_c_werror_flag is undocumented. I wouldn't use it. There is a documented
macro AC_LANG_WERROR, but I'd prefer not to use it, because there are
compilers that spew warnings on every invocation.

How about this proposed patch? Does it work for you?

Paul, is this ok to commit?

Bruno


2008-02-22  Bruno Haible  [EMAIL PROTECTED]

* m4/time_r.m4 (gl_TIME_R): Also check that localtime_r's return type
is a pointer type.  Needed for HP-UX 10.
* doc/posix-functions/localtime_r.texi: Mention HP-UX 10.
* doc/posix-functions/gmtime_r.texi: Likewise.
Reported by Peter O'Gorman [EMAIL PROTECTED].

*** m4/time_r.m4.orig   2008-02-22 23:49:16.0 +0100
--- m4/time_r.m42008-02-22 23:45:41.0 +0100
***
*** 1,6 
  dnl Reentrant time functions like localtime_r.
  
! dnl Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
  dnl with or without modifications, as long as this notice is preserved.
--- 1,6 
  dnl Reentrant time functions like localtime_r.
  
! dnl Copyright (C) 2003, 2006, 2007, 2008 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
  dnl with or without modifications, as long as this notice is preserved.
***
*** 23,29 
   even though the POSIX signature has the 'restrict's,
   since C99 says they can't affect type compatibility.  */
struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r;
! if (ptr) return 0;],
 [gl_cv_time_r_posix=yes],
 [gl_cv_time_r_posix=no])])
if test $gl_cv_time_r_posix = yes; then
--- 23,31 
   even though the POSIX signature has the 'restrict's,
   since C99 says they can't affect type compatibility.  */
struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r;
! if (ptr) return 0;
! /* Check the return type is a pointer.  On HP-UX 10 it is 'int'.  */
! *localtime_r (0, 0);],
 [gl_cv_time_r_posix=yes],
 [gl_cv_time_r_posix=no])])
if test $gl_cv_time_r_posix = yes; then
*** doc/posix-functions/gmtime_r.texi.orig  2008-02-22 23:49:16.0 
+0100
--- doc/posix-functions/gmtime_r.texi   2008-02-22 23:48:16.0 +0100
***
*** 16,20 
  This function is missing on some platforms:
  mingw.
  @item
! Some platforms define a function of this name that is incompatible to POSIX.
  @end itemize
--- 16,21 
  This function is missing on some platforms:
  mingw.
  @item
! Some platforms define a function of this name that is incompatible to POSIX:
! HP-UX 10.
  @end itemize
*** doc/posix-functions/localtime_r.texi.orig   2008-02-22 23:49:16.0 
+0100
--- doc/posix-functions/localtime_r.texi2008-02-22 23:48:16.0 
+0100
***
*** 16,20 
  This function is missing on some platforms:
  mingw.
  @item
! Some platforms define a function of this name that is incompatible to POSIX.
  @end itemize
--- 16,21 
  This function is missing on some platforms:
  mingw.
  @item
! Some platforms define a function of this name that is incompatible to POSIX:
! HP-UX 10.
  @end itemize






Re: time_r.m4 checks unexpectedly pass on hpux10

2008-02-22 Thread Paul Eggert
Bruno Haible [EMAIL PROTECTED] writes:

 Paul, is this ok to commit?

Yes, that looks good to me; thanks.