Re: coreutils build on IRIX 6.5

2007-02-24 Thread Ralf Wildenhues
Hello Bruno, all,

* Bruno Haible wrote on Sat, Feb 24, 2007 at 01:30:53AM CET:
[...]
> + @case $(PERL) in\

You probably want to put that in quotes, so $(PERL) expanding to two
words won't cause a syntax error.

> +   *"/missing "*) ;; \
> +   *)\
> + rm -f $@\
> + && { echo "Updating man page $@";   \
> +  rm -rf $t; \

Cheers,
Ralf




Re: coreutils build on IRIX 6.5

2007-02-24 Thread Jim Meyering
Bruno Haible <[EMAIL PROTECTED]> wrote:
> 2007-02-23  Bruno Haible  <[EMAIL PROTECTED]>
>
>   * m4/perl.m4 (gl_PERL): Require version 5.005, not 5.003. Needed for
>   help2man.
>   * man/Makefile.am (.x.1): If the autoconf test has determined that
>   perl is missing or not a sufficient version, do nothing.

Thanks yet again.
Applied, part in coreutils and part in gnulib.

Also, I added a warning, as you proposed.

But noticed a problem.  Although "case $(PERL)" often works,
and looks ok because we know "case $shell_var" does not
require quotes around $shell_var, here $(PERL) must be quoted,
because it is expanded by make.

So I checked in this additional change:

Avoid a shell syntax error, when building with an inadequate Perl.
* man/Makefile.am (.x.1): Add quotes around $(PERL) in case, since
it can expand to "/.../missing perl".

diff --git a/man/Makefile.am b/man/Makefile.am
index 17b3415..32df9d1 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -153,7 +153,7 @@ mapped_name = `echo $*|sed 's/install/ginstall/; s/test/[/'`
 # That is necessary to avoid failures for programs that are also shell built-in
 # functions like echo, false, printf, pwd.
 .x.1:
-   @case $(PERL) in\
+   @case '$(PERL)' in  \
  *"/missing "*)\
echo 'WARNING: cannot update man page $@ since perl is missing' \
  'or inadequate' 1>&2 \




Re: build reports of coreutils snapshot on AIX 4.3.2

2007-02-24 Thread Paul Eggert
Bruno Haible <[EMAIL PROTECTED]> writes:

> So it's an endless loop in lines 71-72 of nanosleep.c.

That's weird.  I guess we should mark nanosleep as not working on your
platform.  I installed the following patch, which should be harmless
on valid nanosleep hosts; does it detect the bug on your platform?

2007-02-24  Paul Eggert  <[EMAIL PROTECTED]>

* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Check for a nanosleep that
loops on small arguments.  This attempts to avoid the problem
Bruno Haible reported for AIX 4.3.2 in
.

--- m4/nanosleep.m4 12 Feb 2007 18:49:19 -  1.28
+++ m4/nanosleep.m4 24 Feb 2007 10:01:45 -
@@ -60,14 +60,20 @@ AC_DEFUN([gl_FUNC_NANOSLEEP],
  static struct timespec ts_sleep;
  static struct timespec ts_remaining;
  static struct sigaction act;
+ if (! nanosleep)
+   return 1;
  act.sa_handler = check_for_SIGALRM;
-  sigemptyset (&act.sa_mask);
+ sigemptyset (&act.sa_mask);
  sigaction (SIGALRM, &act, NULL);
+ ts_sleep.tv_sec = 0;
+ ts_sleep.tv_nsec = 1;
+ alarm (1);
+ if (nanosleep (&ts_sleep, NULL) != 0)
+   return 1;
  ts_sleep.tv_sec = TYPE_MAXIMUM (time_t);
  ts_sleep.tv_nsec = 9;
  alarm (1);
  if (nanosleep (&ts_sleep, &ts_remaining) == -1 && errno == EINTR
- && nanosleep
  && TYPE_MAXIMUM (time_t) - 10 < ts_remaining.tv_sec)
return 0;
  return 119;




Re: portability checks, errors and warnings

2007-02-24 Thread Paul Eggert
Bruno Haible <[EMAIL PROTECTED]> writes:

>   "For testing portability, invoke 'gnulib-tool --import check-portability'
>(or check-portability-unix if mingw is not among your portability targets),
>then compile the program and look at the link time warnings. Use
>gnulib-tool --import with all the mentioned modules; all portability
>warnings will then disappear, and your program will be portable."

A problem with this is that there will be false alarms in the link
time warnings.  The user will figure this out and ignore them.  But
the next time they redo the portability-testing step, the same false
alarms will be generated.  There should be a way to shut off the false
alarm in the source code.  That is what I was proposing "#undef ctime"
for (in system-dependent code that can assume a ctime with
well-defined behavior no matter what the argument is).

If I compile coreutils that way I get plenty of false alarms.  I don't
know whether any of them are valid (I haven't checked them recently,
there were too many and I didn't have time, but the first few were
false).

Also, I have some qualms about the whole idea of of "gnulib-tool
--import check-portability" step.  It'd be nicer if we could just ask
people to compile with -DGNULIB_POSIXCHECK or whatever.  That way they
won't have to use gnulib-tool, and the test can be done by installers
rather than just maintainers.

> What precisely is the use case that you imagine?

m4/foo.m4 has determined that foo doesn't work and ordinary code
shouldn't use it directly, but some ordinary code uses it anyway.
(Sorry, I'm not sure whether this is precise enough, but it's
late)




Re: coreutils build on IRIX 6.5

2007-02-24 Thread Jim Meyering
Ralf Wildenhues <[EMAIL PROTECTED]> wrote:
> * Bruno Haible wrote on Sat, Feb 24, 2007 at 01:30:53AM CET:
> [...]
>> +@case $(PERL) in\
>
> You probably want to put that in quotes, so $(PERL) expanding to two
> words won't cause a syntax error.

Thanks, Ralf.
Actually I fixed that before reading (just now) your message.
Otherwise I would have attributed the fix to you.




doc change for regex.m4

2007-02-24 Thread Jim Meyering
I've had this change sitting around for a while...

* m4/regex.m4: Update the description of the configure-time option,
--without-included-regex, to state accurately what the defaults are,
and perhaps to give people an idea why using this option is risky.

Index: m4/regex.m4
===
RCS file: /sources/gnulib/gnulib/m4/regex.m4,v
retrieving revision 1.63
diff -u -p -r1.63 regex.m4
--- m4/regex.m4 15 Feb 2007 00:16:55 -  1.63
+++ m4/regex.m4 24 Feb 2007 11:52:48 -
@@ -1,4 +1,4 @@
-#serial 45
+#serial 46

 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
 # 2006, 2007 Free Software Foundation, Inc.
@@ -18,9 +18,12 @@ AC_DEFUN([gl_REGEX],

   AC_ARG_WITH([included-regex],
 [AC_HELP_STRING([--without-included-regex],
-   [don't compile regex; this is the default on
+   [don't compile regex; this is the default on 32-bit
 systems with recent-enough versions of the GNU C
-Library (use with caution on other systems)])])
+Library (use with caution on other systems).
+On systems with 64-bit ptrdiff_t and 32-bit int,
+--with-included-regex is the default, in case
+regex functions operate on very long strings (>2GB)])])

   case $with_included_regex in #(
   yes|no) ac_use_included_regex=$with_included_regex




Re: coreutils build on IRIX 6.5

2007-02-24 Thread Bruno Haible
Jim Meyering wrote:
> Although "case $(PERL)" often works,
> and looks ok because we know "case $shell_var" does not
> require quotes around $shell_var, here $(PERL) must be quoted,
> because it is expanded by make.

Yes, you're right. My mistake.

In gnulib and gettext, I therefore always put double-quotes even at positions
where they are not necessary:
   case "$shell_var" in ...
It reduces the amount of little details you have to think at when coding.

Bruno





Re: build reports of coreutils snapshot on AIX 4.3.2

2007-02-24 Thread Bruno Haible
Paul Eggert wrote:
> I installed the following patch, which should be harmless
> on valid nanosleep hosts; does it detect the bug on your platform?

Yes, it does. With this patch, "gmake check" passes all tests on AIX 4.3.2.

However, when built with "make", the program src/[ is not built. ("make"
succeeds but simply does not build src/[ !) "make check" then fails
because it cannot find ../../src/[ . Similar to the problem on OSF/1 4.0d.

Bruno





bug in frexpl module

2007-02-24 Thread Bruno Haible
Hi Paolo,

frexpl of 1.0L should return the exponent 1 and mantissa 0.5L. Glibc does
this. The substitute code in frexpl.c, however, returns the exponent 0 and
mantissa 1.0L, which IMO is wrong.

OK to fix this?

By the way, now that gnulib supports unit tests, how about moving the test
code at the end of this file into a test module (modules/frexpl-tests,
tests/test-frexpl.c)?

Also, assuming that the exponent has at most 20 bits is a bit risky. One
can very well imagine 'long double' floating-point formats with an 31-bit
or 32-bit exponent. Care to change the size of the array to 64 instead of 20?
That should be safe for the near future.


2007-02-24  Bruno Haible  <[EMAIL PROTECTED]>

* lib/frexpl.c (frexpl): Correct return values for x = 1.0L.

--- lib/frexpl.c18 Feb 2007 15:10:28 -  1.5
+++ lib/frexpl.c24 Feb 2007 15:21:51 -
@@ -34,7 +34,7 @@
   int exponent, bit;
 
   /* Check for zero, nan and infinity. */
-  if (x != x || x + x == x )
+  if (x != x || x + x == x)
 {
   *exp = 0;
   return x;
@@ -44,7 +44,7 @@
 return -frexpl(-x, exp);
 
   exponent = 0;
-  if (x > 1.0)
+  if (x >= 1.0)
 {
   for (next = exponents, exponents[0] = 2.0L, bit = 1;
   *next <= x + x;
@@ -90,6 +90,7 @@
   x = frexpl(-1.0L / 0.0L, &y); printf ("%.6Lg %d\n", x, y);
   x = frexpl(0.5L, &y); printf ("%.6Lg %d\n", x, y);
   x = frexpl(0.75L, &y); printf ("%.6Lg %d\n", x, y);
+  x = frexpl(1.0L, &y); printf ("%.6Lg %d\n", x, y);
   x = frexpl(3.6L, &y); printf ("%.6Lg %d\n", x, y);
   x = frexpl(17.8L, &y); printf ("%.6Lg %d\n", x, y);
   x = frexpl(8.0L, &y); printf ("%.6Lg %d\n", x, y);





Re: bug in frexpl module

2007-02-24 Thread Paolo Bonzini



frexpl of 1.0L should return the exponent 1 and mantissa 0.5L. Glibc does
this. The substitute code in frexpl.c, however, returns the exponent 0 and
mantissa 1.0L, which IMO is wrong.

OK to fix this?


Ok for all.  Don't even ask for approval of changes like the testsuite, 
since you're much more up-to-date than me about what gnulib now supports.


Paolo




Re: coreutils plans, test release coming soon, then stable, then selinux

2007-02-24 Thread James Youngman

On 2/18/07, Bruno Haible <[EMAIL PROTECTED]> wrote:


Hmm, should we reduce the amount of gnulib changes in this period


I hope that sort of thing would not be necessary, otherwise gnulib
will have its development stalled by the release shedules of GNU
packages other than gnulib, presumably.

James.




GNU M4 1.4.8b released (beta release)

2007-02-24 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

The GNU M4 Team is pleased to announce the beta release of GNU M4 1.4.8b.

GNU `m4' is an implementation of the traditional Unix macro processor. It
is mostly SVR4 compatible, although it has some extensions (for example,
handling more than 9 positional parameters to macros).  `m4' also has
built-in functions for including files, running shell commands, doing
arithmetic, etc.  Autoconf needs GNU `m4' for generating `configure'
scripts, but not for running them.

Here are the compressed sources:

  ftp://alpha.gnu.org/gnu/m4/m4-1.4.8b.tar.gz[746 KB]
  ftp://alpha.gnu.org/gnu/m4/m4-1.4.8b.tar.bz2   [591 KB]

Diffs against M4 1.4.8 are not available at this time, but will be
generated as part of the M4 1.4.9 release.

Here are the gpg detached signatures:

  ftp://alpha.gnu.org/gnu/m4/m4-1.4.8b.tar.gz.sig
  ftp://alpha.gnu.org/gnu/m4/m4-1.4.8b.tar.bz2.sig

You should download the signature named after any tarball you download,
and then verify its integrity with, for example:

  gpg --verify m4-1.4.8b.tar.gz.sig

If that command fails because you don't have the required public key, then
run this command to import it:

  gpg --keyserver wwwkeys.pgp.net --recv-keys F4850180

Here are the MD5 and SHA1 checksums:

  e44ea9d3c28fab6c4ab0f067b5607416  m4-1.4.8b.tar.gz
  0619358c9c95110cb4d75c6bec8cc5b1  m4-1.4.8b.tar.bz2
  a82bd1194a04ef5788baee6cb6547de41ceecc1e m4-1.4.8b.tar.gz
  7c986708ae9fb22b673e8b5574da15a6e2a51153 m4-1.4.8b.tar.bz2

This release exercises several recent changes in gnulib, in an attempt to
improve code portability while minimizing maintainence efforts.  Testing
on a wide variety of platforms prior to the formal release of M4 1.4.9 is
appreciated.  This release also fixes a couple of regressions introduced
in 1.4.8, and adds some POSIX compliance to the `eval' and `include'
builtins.  It also adds a command-line option --warn-macro-sequence that
can be used to prepare for the eventual M4 2.0 release, since some of the
POSIX compliance changes planned for M4 2.0 are not backwards-compatible
with existing M4 1.4.x scripts.

This release was bootstrapped with Automake 1.10 and Autoconf 2.61.

Alternatively, you can fetch the unbootstrapped sourcecode from anonymous
cvs by using the following commands:

  $ export CVS_RSH=ssh
  $ cvs -z3 -d :pserver:[EMAIL PROTECTED]:/sources/m4 \
  co -r release-1_4_8b m4

You will then need to have recent versions of Automake and Autoconf
installed, and a recent checkout of gnulib, in order to bootstrap the
checked out sources yourself.

New in 1.4.8b: 24 Feb 2007

 * Fix a regression introduced in 1.4.8 that made m4 unable to process
files larger than 2GiB on some platforms.
 * Fix a regression introduced in 1.4.8 that made m4 dump core when
invoked as 'm4 -- file'.
 * The `eval' builtin now follows C precedence rules.  Additionally, the
short-circuit operators correctly short-circuit division by zero.  The
previously undocumented alias of '=' meaning '==' in eval now triggers a
deprecation warning, so that a future version of M4 can implement a form
of variable assignment as an extension.
 * The `include' builtin now affects exit status on failure, as required
by POSIX.  Use `sinclude' if you need a successful exit status.
 * The `-E'/`--fatal-warnings' command-line option now has two levels.
When specified only once, warnings affect exit status, but execution
continues, so that you can see all warnings instead of fixing them one at
a time.  To acheive 1.4.8 behavior, where the first warning immediately
exits, specify -E twice on the command line.
 * A new `--warn-macro-sequence' command-line option allows detection of
sequences in `define' and `pushdef' definitions that match an optional
regular expression.  The default regular expression is
`\$\({[^}]*}\|[0-9][0-9]+\)', corresponding to the sequences that might
not behave correctly when upgrading to the eventual M4 2.0.  By default,
M4 2.0 will follow the POSIX requirement that a macro definition
containing `$11' must expand to the first argument concatenated with 1,
rather than the eleventh argument; and will take advantage of the POSIX
wording that allows implementations to treat `${11}' as the eleventh
argument instead of literal text.  Be aware that Autoconf 2.61 will not
work with this option enabled with the default regular expression; but
Autoconf 2.62 will be compatible with this option.
 * Improved portability to platforms such as BSD/OS and AIX.

Please report bugs to , along with the output of 'make
check' and any other information that might be useful in resolving the issue.

- --
Eric Blake
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF4HoP84KuGfSFAYARAgpkAJ96rN1uj3xVtltl3FKGI4UnIeSG+ACgrBQD
QLBfbVA8a/F2990x5aU0Ex0=
=LURx
-END PGP SIGNATURE-




new module 'isnan-nolibm'

2007-02-24 Thread Bruno Haible
Hi,

A printf substitute should be able to print numbers in hexadecimal notation
(conversion 'a' or 'A'), and for this is needs to test whether a number is
NaN. The 'x == x' trick doesn't do it, because - as far as I know - this
can trap if x is a signalling NaN. So we need an isnan() function. But
isnan() is available in libm on many systems (AIX, Cygwin, HP-UX, OSF/1,
Solaris), and our users don't want to add a $(PRINTF_LIBM) variable to the
*_LDFLAGS of each of their programs. We can only use it for printf if it
is in libc.

This does it, with a few (hopefully reasonable) assumptions on the
representation of 'double'.

2007-02-24  Bruno Haible  <[EMAIL PROTECTED]>

* modules/isnan-nolibm: New file.
* lib/isnan.h: New file.
* lib/isnan.c: New file.
* m4/isnan.m4: New file.

=== modules/isnan-nolibm ==
Description:
isnan() function: test for NaN, without requiring libm.

Files:
lib/isnan.h
lib/isnan.c
m4/isnan.m4

Depends-on:

configure.ac:
gl_FUNC_ISNAN_NO_LIBM

Makefile.am:

Include:
#include "isnan.h"

License:
LGPL

Maintainer:
Bruno Haible

= lib/isnan.h =
/* Test for NaN that does not need libm.
   Copyright (C) 2007 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License along
   with this program; if not, write to the Free Software Foundation,
   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */

#if HAVE_ISNAN_IN_LIBC
/* Get declaration of isnan.  */
# include 
#else
/* Test whether X is a NaN.  */
# undef isnan
# define isnan rpl_isnan
extern int isnan (double x);
#endif
= lib/isnan.c =
/* Test for NaN that does not need libm.
   Copyright (C) 2007 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License along
   with this program; if not, write to the Free Software Foundation,
   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */

/* Written by Bruno Haible <[EMAIL PROTECTED]>, 2007.  */

#include 

#include 
#include 

#define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7)

#define NWORDS \
  ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
typedef union { double value; unsigned int word[NWORDS]; } memory_double;

int
rpl_isnan (double x)
{
#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
  /* Be careful to not do any floating-point operation on x, such as x == x,
 because x may be a signaling NaN.  */
  static memory_double nan = { 0.0 / 0.0 };
  static double plus_inf = 1.0 / 0.0;
  static double minus_inf = -1.0 / 0.0;
  memory_double m;

  /* A NaN can be recognized through its exponent.  But exclude +Infinity and
 -Infinity, which have the same exponent.  */
  m.value = x;
  if m.word[DBL_EXPBIT0_WORD] >> DBL_EXPBIT0_BIT)
^ (nan.word[DBL_EXPBIT0_WORD] >> DBL_EXPBIT0_BIT))
   & DBL_EXP_MASK)
  == 0)
return (memcmp (&m.value, &plus_inf, sizeof (double)) != 0
&& memcmp (&m.value, &minus_inf, sizeof (double)) != 0);
  else
return 0;
#else
  /* The configuration did not find sufficient information.  Give up about
 the signaling NaNs, handle only the quiet NaNs.  */
  if (x == x)
return 0;
  else
return 1;
#endif
}
= m4/isnan.m4 =
# isnan.m4 serial 1
dnl Copyright (C) 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.

dnl Check how to get or define isnan() without linking with libm.

AC_DEFUN([gl_FUNC_ISNAN_NO_LIBM],
[
  AC_CHECK_FUNC([isnan],
[gl_cv_func_isnan_no_libm=yes],
[gl_cv_func_isnan_no_libm=no])
  if test $gl_cv_func_isnan_no_libm = yes; then
AC_DEFINE([HAVE_

new module 'isnanl-nolibm'

2007-02-24 Thread Bruno Haible
Hi,

printf also needs to output long double numbers... so it needs an isnanl()
function as well. Like for isnan(), having it defined in libm (OSF/1,
Solaris) doesn't help.

2007-02-24  Bruno Haible  <[EMAIL PROTECTED]>

* modules/isnanl-nolibm: New file.
* lib/isnanl.h: New file.
* lib/isnanl.c: New file.
* m4/isnanl.m4: New file.

 modules/isnanl-nolibm 
Description:
isnanl() function: test for NaN, without requiring libm.

Files:
lib/isnanl.h
lib/isnanl.c
m4/isnanl.m4
m4/longdouble.m4

Depends-on:

configure.ac:
gl_FUNC_ISNANL_NO_LIBM

Makefile.am:

Include:
#if HAVE_LONG_DOUBLE
# include "isnan.h"
#endif

License:
LGPL

Maintainer:
Bruno Haible

 lib/isnanl.h =
/* Test for NaN that does not need libm.
   Copyright (C) 2007 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License along
   with this program; if not, write to the Free Software Foundation,
   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */

#if HAVE_ISNANL_IN_LIBC
/* Get declaration of isnanl.  */
# include 
#else
/* Test whether X is a NaN.  */
# undef isnanl
# define isnanl rpl_isnanl
extern int isnanl (long double x);
#endif
 lib/isnanl.c =
/* Test for NaN that does not need libm.
   Copyright (C) 2007 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License along
   with this program; if not, write to the Free Software Foundation,
   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */

/* Written by Bruno Haible <[EMAIL PROTECTED]>, 2007.  */

#include 

#include 
#include 

#define LDBL_EXP_MASK ((LDBL_MAX_EXP - LDBL_MIN_EXP) | 7)

#define NWORDS \
  ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
typedef union { long double value; unsigned int word[NWORDS]; }
memory_long_double;

int
rpl_isnanl (long double x)
{
#if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT
  /* Be careful to not do any floating-point operation on x, such as x == x,
 because x may be a signalling NaN.  */
  static memory_long_double nan = { 0.0L / 0.0L };
  static long double plus_inf = 1.0L / 0.0L;
  static long double minus_inf = -1.0L / 0.0L;
  memory_long_double m;

  /* A NaN can be recognized through its exponent.  But exclude +Infinity and
 -Infinity, which have the same exponent.  */
  m.value = x;
  if m.word[LDBL_EXPBIT0_WORD] >> LDBL_EXPBIT0_BIT)
^ (nan.word[LDBL_EXPBIT0_WORD] >> LDBL_EXPBIT0_BIT))
   & LDBL_EXP_MASK)
  == 0)
return (memcmp (&m.value, &plus_inf, sizeof (long double)) != 0
&& memcmp (&m.value, &minus_inf, sizeof (long double)) != 0);
  else
return 0;
#else
  /* The configuration did not find sufficient information.  Give up about
 the signaling NaNs, handle only the quiet NaNs.  */
  if (x == x)
return 0;
  else
return 1;
#endif
}
 m4/isnanl.m4 =
# isnanl.m4 serial 1
dnl Copyright (C) 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.

AC_DEFUN([gl_FUNC_ISNANL_NO_LIBM],
[
  AC_REQUIRE([gt_TYPE_LONGDOUBLE])
  if test $gt_cv_c_long_double = yes; then
AC_CHECK_FUNC([isnanl],
  [gl_cv_func_isnanl_no_libm=yes],
  [gl_cv_func_isnanl_no_libm=no])
if test $gl_cv_func_isnanl_no_libm = yes; then
  AC_DEFINE([HAVE_ISNANL_IN_LIBC], 1,
[Define if the isnanl() function is available in libc.])
else
  AC_LIBOBJ([isnanl])
  gl_LONG_DOUBLE_EXPONENT_LOCATION
fi
  fi
])

AC_DEFUN([gl_LONG_DOUBLE_EXPONENT_LOCATION],
[
  AC_CACHE_CHECK([where to find the exponent in a 'long double'],

Re: new module 'isnan-nolibm'

2007-02-24 Thread Ben Pfaff
Bruno Haible <[EMAIL PROTECTED]> writes:

> 2007-02-24  Bruno Haible  <[EMAIL PROTECTED]>
>
>   * modules/isnan-nolibm: New file.
>   * lib/isnan.h: New file.
>   * lib/isnan.c: New file.
>   * m4/isnan.m4: New file.

Could/should this be merged into math_.h, so that there's no need
for an additional #include "isnan.h"?
-- 
Ben Pfaff 
[EMAIL PROTECTED]
http://benpfaff.org





Re: new module 'isnan-nolibm'

2007-02-24 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Bruno Haible on 2/24/2007 12:10 PM:
> But
> isnan() is available in libm on many systems (AIX, Cygwin, HP-UX, OSF/1,
> Solaris)

Correction - on cygwin, libm is a dummy library to merely pacify people
who insist on using -lm unnecessarily, and isnan is available in libc.

- --
Don't work too hard, make some time for fun as well!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF4JiH84KuGfSFAYARAkgBAKDXvq+fVPvat/G+qlWiFYI5lw72uACg1Peu
VQHLbO/jBG7XwuG203kFVtU=
=f2Gt
-END PGP SIGNATURE-




Re: new module 'isnan-nolibm'

2007-02-24 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Eric Blake on 2/24/2007 12:56 PM:
> According to Bruno Haible on 2/24/2007 12:10 PM:
>> But
>> isnan() is available in libm on many systems (AIX, Cygwin, HP-UX, OSF/1,
>> Solaris)
> 
> Correction - on cygwin, libm is a dummy library to merely pacify people
> who insist on using -lm unnecessarily, and isnan is available in libc.

For that matter, isnan() is specified to be a macro, not a function.  On
what platforms does the macro in the system  truly rely on a libm
function?

- --
Don't work too hard, make some time for fun as well!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF4JoP84KuGfSFAYARAlGhAKCJSDPl/Skz6ha5PG4ua7H+sloAjQCdGfrT
ABZi/IQLfJPz5dx39WyO4uU=
=KNNP
-END PGP SIGNATURE-




Re: new module 'isnan-nolibm'

2007-02-24 Thread Daniel Jacobowitz
On Sat, Feb 24, 2007 at 08:10:02PM +0100, Bruno Haible wrote:
>   dnl On ARM, integer types are stored in little-endian byte order,
>   dnl but floats are stored in big-endian word order.
>   AC_EGREP_CPP([mixed_endianness], [
> #if defined arm || defined __arm || defined __arm__
>   mixed_endianness
> #endif

That hasn't been the full story for a while.  FPA (the obsolete,
usually emulated floating point format) does this, but all modern
systems use VFP word ordering, even if they have only software
floating point.

I don't see a single clear macro that determines this.  __VFP_FP__ is
a subset of the times that normal IEEE layout is used.

-- 
Daniel Jacobowitz
CodeSourcery




Re: new module 'isnan-nolibm'

2007-02-24 Thread Bruno Haible
Ben Pfaff asked:
> > * lib/isnan.h: New file.
> Could/should this be merged into math_.h, so that there's no need
> for an additional #include "isnan.h"?

If many other modules want isnan() without libm, it would make sense.

If only *printf routines need it - and that's the current hypothesis -,
then it's better as a separate file, since it avoids confusion with code
that wants the "real" isnan() function.

Bruno





Re: new module 'isnan-nolibm'

2007-02-24 Thread Bruno Haible
Daniel Jacobowitz wrote:
> That hasn't been the full story for a while.  FPA (the obsolete,
> usually emulated floating point format) does this, but all modern
> systems use VFP word ordering, even if they have only software
> floating point.

Thanks for pointing this out. I'm changing the macro to not assume anything
about the endianness then:

--- m4/isnan.m4 24 Feb 2007 19:08:56 -  1.1
+++ m4/isnan.m4 25 Feb 2007 01:56:12 -
@@ -92,14 +92,17 @@
 [gl_cv_cc_double_expbit0=`cat conftest.out`],
 [gl_cv_cc_double_expbit0="unknown"],
 [
-  dnl On ARM, integer types are stored in little-endian byte order,
-  dnl but floats are stored in big-endian word order.
+  dnl On ARM, there are two 'double' floating-point formats, used by
+  dnl different sets of instructions: The older FPA instructions assume
+  dnl that they are stored in big-endian word order, while the words
+  dnl (like integer types) are stored in little-endian byte order.
+  dnl The newer VFP instructions assume little-endian order 
consistenly.
   AC_EGREP_CPP([mixed_endianness], [
 #if defined arm || defined __arm || defined __arm__
   mixed_endianness
 #endif
 ],
-[gl_cv_cc_double_expbit0="word 0 bit 20"],
+[gl_cv_cc_double_expbit0="unknown"],
 [
   AC_C_BIGENDIAN(
 [gl_cv_cc_double_expbit0="word 0 bit 20"],





Re: new module 'isnan-nolibm'

2007-02-24 Thread Bruno Haible
Eric Blake asked:
> For that matter, isnan() is specified to be a macro, not a function.  On
> what platforms does the macro in the system  truly rely on a libm
> function?

On AIX, OSF/1, HP-UX:

AIX 4.3.2:   isnan() is a function, defined in libm
OSF/1 4.0d:  isnan() is a function, defined in libm
HP-UX 11.00: isnan() is a macro, dispatching to _Isnanf, isnan, _Isnanf80,
 the first two being defined in libm.

Solaris 10:  isnan() is a function, defined in libc
Cygwin:  isnan() is a function, defined in cygwin.dll

Bruno





putenv.c: avoid conflicting types for 'unsetenv' on FreeBSD.

2007-02-24 Thread Jim Meyering
I've just committed this:
[coreutils-6.8 needs this patch on FreeBSD]

Avoid conflicting types for 'unsetenv' on FreeBSD.
* lib/putenv.c (_unsetenv): Rename from "unsetenv", to avoid
conflicting with FreeBSD's (5.0 and 6.1) function declaration
in stdlib.h.

Index: lib/putenv.c
===
RCS file: /sources/gnulib/gnulib/lib/putenv.c,v
retrieving revision 1.33
diff -u -p -r1.33 putenv.c
--- lib/putenv.c21 Feb 2007 07:54:16 -  1.33
+++ lib/putenv.c25 Feb 2007 00:47:12 -
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1994, 1997, 1998, 2000, 2003, 2004, 2005, 2006
+/* Copyright (C) 1991, 1994, 1997, 1998, 2000, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.

NOTE: The canonical source of this file is maintained with the GNU C
@@ -57,7 +57,7 @@ __libc_lock_define_initialized (static,
 #endif

 static int
-unsetenv (const char *name)
+_unsetenv (const char *name)
 {
   size_t len;
   char **ep;
@@ -105,7 +105,7 @@ rpl_putenv (const char *string)
   if (name_end == NULL)
 {
   /* Remove the variable from the environment.  */
-  return unsetenv (string);
+  return _unsetenv (string);
 }

   size = 0;




Re: new module 'isnanl-nolibm'

2007-02-24 Thread Bruno Haible
Oops, this was code duplication, which is bad. I'm merging the two functions
into a single code.

2007-02-24  Bruno Haible  <[EMAIL PROTECTED]>

* lib/isnan.c: Support the 'long double' case if USE_LONG_DOUBLE is
defined.
* lib/isnanl.c: Remove all code. Just include isnan.c.
* modules/isnanl-nolibm (Files): Add lib/isnan.c.

*** lib/isnan.c 24 Feb 2007 19:08:56 -  1.1
--- lib/isnan.c 25 Feb 2007 02:28:51 -
***
*** 22,53 
  #include 
  #include 
  
! #define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7)
  
  #define NWORDS \
!   ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
! typedef union { double value; unsigned int word[NWORDS]; } memory_double;
  
  int
! rpl_isnan (double x)
  {
! #if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
/* Be careful to not do any floating-point operation on x, such as x == x,
   because x may be a signaling NaN.  */
!   static memory_double nan = { 0.0 / 0.0 };
!   static double plus_inf = 1.0 / 0.0;
!   static double minus_inf = -1.0 / 0.0;
memory_double m;
  
/* A NaN can be recognized through its exponent.  But exclude +Infinity and
   -Infinity, which have the same exponent.  */
m.value = x;
!   if m.word[DBL_EXPBIT0_WORD] >> DBL_EXPBIT0_BIT)
!   ^ (nan.word[DBL_EXPBIT0_WORD] >> DBL_EXPBIT0_BIT))
!& DBL_EXP_MASK)
== 0)
! return (memcmp (&m.value, &plus_inf, sizeof (double)) != 0
!   && memcmp (&m.value, &minus_inf, sizeof (double)) != 0);
else
  return 0;
  #else
--- 22,76 
  #include 
  #include 
  
! #ifdef USE_LONG_DOUBLE
! # define FUNC rpl_isnanl
! # define DOUBLE long double
! # define MAX_EXP LDBL_MAX_EXP
! # define MIN_EXP LDBL_MIN_EXP
! # if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT
! #  define KNOWN_EXPBIT0_LOCATION
! #  define EXPBIT0_WORD LDBL_EXPBIT0_WORD
! #  define EXPBIT0_BIT LDBL_EXPBIT0_BIT
! # endif
! # define L_(literal) literal##L
! #else
! # define FUNC rpl_isnan
! # define DOUBLE double
! # define MAX_EXP DBL_MAX_EXP
! # define MIN_EXP DBL_MIN_EXP
! # if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
! #  define KNOWN_EXPBIT0_LOCATION
! #  define EXPBIT0_WORD DBL_EXPBIT0_WORD
! #  define EXPBIT0_BIT DBL_EXPBIT0_BIT
! # endif
! # define L_(literal) literal
! #endif
! 
! #define EXP_MASK ((MAX_EXP - MIN_EXP) | 7)
  
  #define NWORDS \
!   ((sizeof (DOUBLE) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
! typedef union { DOUBLE value; unsigned int word[NWORDS]; } memory_double;
  
  int
! FUNC (DOUBLE x)
  {
! #ifdef KNOWN_EXPBIT0_LOCATION
/* Be careful to not do any floating-point operation on x, such as x == x,
   because x may be a signaling NaN.  */
!   static memory_double nan = { L_(0.0) / L_(0.0) };
!   static DOUBLE plus_inf = L_(1.0) / L_(0.0);
!   static DOUBLE minus_inf = -L_(1.0) / L_(0.0);
memory_double m;
  
/* A NaN can be recognized through its exponent.  But exclude +Infinity and
   -Infinity, which have the same exponent.  */
m.value = x;
!   if (((m.word[EXPBIT0_WORD] ^ nan.word[EXPBIT0_WORD])
!& (EXP_MASK << EXPBIT0_BIT))
== 0)
! return (memcmp (&m.value, &plus_inf, sizeof (DOUBLE)) != 0
!   && memcmp (&m.value, &minus_inf, sizeof (DOUBLE)) != 0);
else
  return 0;
  #else
*** lib/isnanl.c24 Feb 2007 19:15:21 -  1.1
--- lib/isnanl.c25 Feb 2007 02:28:51 -
***
*** 17,62 
  
  /* Written by Bruno Haible <[EMAIL PROTECTED]>, 2007.  */
  
! #include 
! 
! #include 
! #include 
! 
! #define LDBL_EXP_MASK ((LDBL_MAX_EXP - LDBL_MIN_EXP) | 7)
! 
! #define NWORDS \
!   ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
! typedef union { long double value; unsigned int word[NWORDS]; }
! memory_long_double;
! 
! int
! rpl_isnanl (long double x)
! {
! #if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT
!   /* Be careful to not do any floating-point operation on x, such as x == x,
!  because x may be a signalling NaN.  */
!   static memory_long_double nan = { 0.0L / 0.0L };
!   static long double plus_inf = 1.0L / 0.0L;
!   static long double minus_inf = -1.0L / 0.0L;
!   memory_long_double m;
! 
!   /* A NaN can be recognized through its exponent.  But exclude +Infinity and
!  -Infinity, which have the same exponent.  */
!   m.value = x;
!   if m.word[LDBL_EXPBIT0_WORD] >> LDBL_EXPBIT0_BIT)
!   ^ (nan.word[LDBL_EXPBIT0_WORD] >> LDBL_EXPBIT0_BIT))
!& LDBL_EXP_MASK)
!   == 0)
! return (memcmp (&m.value, &plus_inf, sizeof (long double)) != 0
!   && memcmp (&m.value, &minus_inf, sizeof (long double)) != 0);
!   else
! return 0;
! #else
!   /* The configuration did not find sufficient information.  Give up about
!  the signaling NaNs, handle only the quiet NaNs.  */
!   if (x == x)
! return 0;
!   else
! return 1;
! #endif
! }
--- 17,21 
  
  /* Written by Bruno H

Re: new module 'isnan-nolibm'

2007-02-24 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Bruno Haible on 2/24/2007 7:08 PM:
> Cygwin:  isnan() is a function, defined in cygwin.dll

No, on cygwin, isnan is a macro in  that wraps the internal
functions __isnan{,lf}, and the isnan entry point in cygwin1.dll exists
only for backwards compatibility for multi-year-old apps that were
compiled against cygwin prior to the POSIX compliance bug being fixed of
providing isnan only as a macro.  And you still didn't catch my point that
on cygwin, you don't need -lm to get isnan() to work, whether or not it is
an exported function, since modern code should not be linking against the
entry point isnan on cygwin anyways.  Checking AC_CHECK_FUNC([isnan]) is
wrong since POSIX does not guarantee that isnan is a function; instead,
you must check whether including  and using isnan() will link
correctly in the absence of -lm.

- --
Don't work too hard, make some time for fun as well!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF4PeB84KuGfSFAYARAmNXAJ9EcgCWHP7yZWuPYe5dHjJzAZVE/gCfcojf
EhJR2e9ugLNQkbQACW2e4xM=
=nYab
-END PGP SIGNATURE-




Re: new module 'isnan-nolibm'

2007-02-24 Thread Ben Pfaff
Bruno Haible <[EMAIL PROTECTED]> writes:

> Ben Pfaff asked:
>> >* lib/isnan.h: New file.
>> Could/should this be merged into math_.h, so that there's no need
>> for an additional #include "isnan.h"?
>
> If many other modules want isnan() without libm, it would make sense.

I was under the impression that some platforms were missing isnan
entirely, so that this was worth more than just "isnan() without
libm".  But I can't confidently name a system that lacks it.  So
I'll drop the matter until I can.
-- 
"Now I have to go wash my mind out with soap."
--Derick Siddoway





Re: new module 'isnan-nolibm'

2007-02-24 Thread Bruno Haible
Eric Blake wrote:
> No, on cygwin, isnan is a macro in  that wraps the internal
> functions __isnan{,lf}, and the isnan entry point in cygwin1.dll exists
> only for backwards compatibility for multi-year-old apps that were
> compiled against cygwin prior to the POSIX compliance bug being fixed of
> providing isnan only as a macro.

My copy of cygwin  (dated 2006-01-20) still has
   extern int isnan _PARAMS((double));
You simply have a newer copy of cygwin than me.

> And you still didn't catch my point that
> on cygwin, you don't need -lm to get isnan() to work

Since there are also AIX, OSF/1, HP-UX, the situation on cygwin has no
effect on m4/isnan.m4.

> Checking AC_CHECK_FUNC([isnan]) is
> wrong since POSIX does not guarantee that isnan is a function; instead,
> you must check whether including  and using isnan() will link
> correctly in the absence of -lm.

Oh, I see now what you mean. Thanks for insisting. I had based my
understanding of these functions on a manual page that lists isnanf(),
isnan() as a function, and isnanl(). Doing as you say.

Bruno


2007-02-24  Bruno Haible  <[EMAIL PROTECTED]>

* lib/isnanl.h (isnanl): Define through isnan if isnan is a macro.
* m4/isnan.m4 (gl_FUNC_ISNAN_NO_LIBM): Don't check for isnan as a
function; instead check whether isnan with a double argument links.
* m4/isnanl.m4 (gl_FUNC_ISNANL_NO_LIBM): Don't check for isnanl as a
function; instead check whether isnan with a 'long double' argument
links.
Reported by Eric Blake <[EMAIL PROTECTED]>.

*** lib/isnan.h 24 Feb 2007 19:08:56 -  1.1
--- lib/isnan.h 25 Feb 2007 04:38:13 -
***
*** 16,22 
 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #if HAVE_ISNAN_IN_LIBC
! /* Get declaration of isnan.  */
  # include 
  #else
  /* Test whether X is a NaN.  */
--- 16,22 
 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #if HAVE_ISNAN_IN_LIBC
! /* Get declaration of isnan macro.  */
  # include 
  #else
  /* Test whether X is a NaN.  */
*** lib/isnanl.h24 Feb 2007 19:15:21 -  1.1
--- lib/isnanl.h25 Feb 2007 04:38:13 -
***
*** 16,23 
 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #if HAVE_ISNANL_IN_LIBC
! /* Get declaration of isnanl.  */
  # include 
  #else
  /* Test whether X is a NaN.  */
  # undef isnanl
--- 16,27 
 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #if HAVE_ISNANL_IN_LIBC
! /* Get declaration of isnan macro or (older) isnanl function.  */
  # include 
+ # ifdef isnan
+ #  undef isnanl
+ #  define isnanl(x) isnan ((long double)(x))
+ # endif
  #else
  /* Test whether X is a NaN.  */
  # undef isnanl
*** m4/isnan.m4 25 Feb 2007 01:57:58 -  1.2
--- m4/isnan.m4 25 Feb 2007 04:38:13 -
***
*** 8,19 
  
  AC_DEFUN([gl_FUNC_ISNAN_NO_LIBM],
  [
!   AC_CHECK_FUNC([isnan],
! [gl_cv_func_isnan_no_libm=yes],
! [gl_cv_func_isnan_no_libm=no])
if test $gl_cv_func_isnan_no_libm = yes; then
  AC_DEFINE([HAVE_ISNAN_IN_LIBC], 1,
!   [Define if the isnan() function is available in libc.])
else
  AC_LIBOBJ([isnan])
  gl_DOUBLE_EXPONENT_LOCATION
--- 8,25 
  
  AC_DEFUN([gl_FUNC_ISNAN_NO_LIBM],
  [
!   AC_CACHE_CHECK([whether isnan(double) can be used without linking with 
libm],
! [gl_cv_func_isnan_no_libm],
! [
!   AC_TRY_LINK([#include 
!double x;],
!   [return isnan (x);],
! [gl_cv_func_isnan_no_libm=yes],
! [gl_cv_func_isnan_no_libm=no])
! ])
if test $gl_cv_func_isnan_no_libm = yes; then
  AC_DEFINE([HAVE_ISNAN_IN_LIBC], 1,
!   [Define if the isnan(double) function is available in libc.])
else
  AC_LIBOBJ([isnan])
  gl_DOUBLE_EXPONENT_LOCATION
*** m4/isnanl.m424 Feb 2007 19:15:21 -  1.1
--- m4/isnanl.m425 Feb 2007 04:38:13 -
***
*** 8,19 
  [
AC_REQUIRE([gt_TYPE_LONGDOUBLE])
if test $gt_cv_c_long_double = yes; then
! AC_CHECK_FUNC([isnanl],
!   [gl_cv_func_isnanl_no_libm=yes],
!   [gl_cv_func_isnanl_no_libm=no])
  if test $gl_cv_func_isnanl_no_libm = yes; then
AC_DEFINE([HAVE_ISNANL_IN_LIBC], 1,
! [Define if the isnanl() function is available in libc.])
  else
AC_LIBOBJ([isnanl])
gl_LONG_DOUBLE_EXPONENT_LOCATION
--- 8,29 
  [
AC_REQUIRE([gt_TYPE_LONGDOUBLE])
if test $gt_cv_c_long_double = yes; then
! AC_CACHE_CHECK([whether isnan(long double) can be used without linking 
with libm],
!   [gl_cv_func_isnanl_no_libm],
!   [
! AC_TRY_LINK([#include 
!  #ifdef isnan
!  # undef isnanl
!  # define isnanl(x) isnan ((long double)(x))
!  #endif
!  long double x;],
! [re

Re: new module 'isnan-nolibm'

2007-02-24 Thread Bruno Haible
Ben Pfaff wrote:
> I was under the impression that some platforms were missing isnan
> entirely, so that this was worth more than just "isnan() without
> libm".  But I can't confidently name a system that lacks it.

The package I announced two days ago shows that most systems have isnan()
as a function:

$ ./show-portability isnan
libcfreebsd-5.2.1
libcfreebsd-6.0
libcirix-6.5
libcmacosx-10.3
libcnetbsd-3.0
libcopenbsd-3.8
libcsolaris-2.10
libcsolaris-2.4
libcsolaris-2.5.1
libcsolaris-2.6
libcsolaris-2.7
libcsolaris-2.8
libcsolaris-2.9
libcygwin   cygwin
libmaix-4.3.2
libmaix-5.1.0
libmaix-5.1.0
libmcygwin
libmhpux-11.00
libmhpux-11.11
libmosf1-4.0d
libmosf1-5.1a
libmsolaris-2.10
libmsolaris-2.4
libmsolaris-2.5.1
libmsolaris-2.6
libmsolaris-2.7
libmsolaris-2.8
libmsolaris-2.9
libroot beos
MISSING in  mingw

and mingw has it as a macro:

#define isnan(x) (sizeof (x) == sizeof (float) ? __isnanf (x)   \
  : sizeof (x) == sizeof (double) ? __isnan (x) \
  : __isnanl (x))

(confirming the point that Eric just made: that the 3 functions may have
completely different names than 'isnan', 'isnanf', 'isnanl').

Bruno





Re: new module 'isnan-nolibm'

2007-02-24 Thread Ben Pfaff
Bruno Haible <[EMAIL PROTECTED]> writes:

> Ben Pfaff wrote:
>> I was under the impression that some platforms were missing isnan
>> entirely, so that this was worth more than just "isnan() without
>> libm".  But I can't confidently name a system that lacks it.
>
> The package I announced two days ago shows that most systems have isnan()
> as a function:

Clearly I should have paid better attention.  I've taken better
notice of that package now, so I'll check it before making more
noise in the future.
-- 
Ben Pfaff 
[EMAIL PROTECTED]
http://benpfaff.org




Re: conflicts between pathname.h and dirname.h

2007-02-24 Thread Ben Pfaff
Paul Eggert <[EMAIL PROTECTED]> writes:

> Ben Pfaff <[EMAIL PROTECTED]> writes:
>
>> pathname.h and dirname.h define macros with the same names, but
>> conflicting definitions.  Should they be merged?
>
> Well, if you want my biased opinion, pathname should go.  :-)
>
> The GNU Coding Standards say that one shouldn't use the word
> "pathname" to describe file names.
>
> This issue is controversial, though -- as I recall, Bruno doesn't
> think internals like gnulib need to follow those standards.

Here is my attempt at a minimally invasive resolution of the
differences, which should be good enough to let both headers be
included at once.  No code in gnulib/lib uses IS_ABSOLUTE_PATH or
IS_PATH_WITH_DIR from pathname.h, so it shouldn't affect anything
in gnulib.

I guess we'll see what Bruno thinks...

Index: lib/pathname.h
===
RCS file: /cvsroot/gnulib/gnulib/lib/pathname.h,v
retrieving revision 1.5
diff -u -p -r1.5 pathname.h
--- lib/pathname.h  14 May 2005 06:03:58 -  1.5
+++ lib/pathname.h  25 Feb 2007 06:24:29 -
@@ -1,5 +1,5 @@
 /* Pathname support.
-   Copyright (C) 2001-2004 Free Software Foundation, Inc.
+   Copyright (C) 2001-2004, 2007 Free Software Foundation, Inc.
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,35 +18,12 @@
 #ifndef _PATHNAME_H
 #define _PATHNAME_H
 
+#include "dirname.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-
-/* Pathname support.
-   ISSLASH(C)   tests whether C is a directory separator character.
-   IS_ABSOLUTE_PATH(P)  tests whether P is an absolute path.  If it is not,
-it may be concatenated to a directory pathname.
-   IS_PATH_WITH_DIR(P)  tests whether P contains a directory specification.
- */
-#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined 
__EMX__ || defined __DJGPP__
-  /* Win32, Cygwin, OS/2, DOS */
-# define ISSLASH(C) ((C) == '/' || (C) == '\\')
-# define HAS_DEVICE(P) \
-P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
- && (P)[1] == ':')
-# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P))
-# define IS_PATH_WITH_DIR(P) \
-(strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
-# define FILE_SYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0)
-#else
-  /* Unix */
-# define ISSLASH(C) ((C) == '/')
-# define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0])
-# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
-# define FILE_SYSTEM_PREFIX_LEN(P) 0
-#endif
-
 /* Concatenate a directory pathname, a relative pathname and an optional
suffix.  Return a freshly allocated pathname.  */
 extern char *concatenated_pathname (const char *directory,
Index: modules/pathname
===
RCS file: /cvsroot/gnulib/gnulib/modules/pathname,v
retrieving revision 1.2
diff -u -p -r1.2 pathname
--- modules/pathname22 Sep 2004 15:11:04 -  1.2
+++ modules/pathname25 Feb 2007 06:24:30 -
@@ -9,6 +9,7 @@ lib/concatpath.c
 Depends-on:
 xalloc
 stpcpy
+dirname
 
 configure.ac:
 

-- 
"J'avais trouv'e ma religion :
 rien ne me parut plus important qu'un livre.
 La biblioth`eque, j'y voyais un temple."
--Jean-Paul Sartre