Re: [PATCH] flock implementation (version 2)

2008-10-07 Thread Jim Meyering
Richard W.M. Jones [EMAIL PROTECTED] wrote:
 Thanks for the feedback.  The updated version attached should correct
 all those points.

Thanks!
I've merged in the patch below, adjusted the log message
to have a blank line after the summary, and pushed the result.

diff --git a/modules/flock-tests b/modules/flock-tests
index d43d10c..b546594 100644
--- a/modules/flock-tests
+++ b/modules/flock-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-flock.c

 Depends-on:
+unistd

 configure.ac:

diff --git a/tests/test-flock.c b/tests/test-flock.c
index e7dac2b..a1872cd 100644
--- a/tests/test-flock.c
+++ b/tests/test-flock.c
@@ -16,6 +16,7 @@

 #include stdio.h
 #include stdlib.h
+#include unistd.h
 #include errno.h

 #include sys/file.h




Re: lib/regex_internal.h on 1.4.11

2008-10-07 Thread Jonathan C. Patschke

On Mon, 6 Oct 2008, Eric Blake wrote:


minus_zerol is miscompiled on at least Irix 6.2.  So until we hear
feedback from Jonathan on what DOES allow us to compile -0.0L on
HP-UX/hppa, I'd rather go for consistency in the testsuite by always
using - -zerol as the common idiom.


I don't know if I'm the appropriate bottleneck for this.  Once I get back
to the United States in mid-October, I will likely be able to set up a
network-accessible HP-UX 10.20 system with HP's compilers for the purpose
of someone else exploring these portability problems, but my current
workload doesn't really permit me to return results in a timely manner.

--
Jonathan C. Patschke
Manufacturing Software Support
Centaur Technology




cyclomatic code complexity report for gnulib

2008-10-07 Thread Simon Josefsson
Using the pmccabe2html module I created a report for gnulib itself:

http://josefsson.org/gnulib-cyclo.html

Gnulib appears to trigger some bugs in the script on how the functions
are sorted, but the output may be interesting nonetheless.

/Simon




Re: tee logs no output if stdout is closed

2008-10-07 Thread Jim Meyering
Bruno Haible [EMAIL PROTECTED] wrote:
 Jim Meyering wrote:
...
 s/is/may be/
 Early reader termination may still deserve a diagnostic.
 Or it could be that POSIX requires the application to diagnose EPIPE,
 regardless ;-)

 I disagree here. If early reader termination leads to a diagnostic in this
 case, the diagnostic is timing dependent (depends which of the CPU cores
 executing the reader process and the writer process is more loaded); this
 is never what you want.

 POSIX does not specify anthing here, because it essentially says that during
 the operation specified by POSIX the SIGPIPE handler is set to SIG_DFL.

POSIX does specify the behavior of applications even when SIGPIPE is ignored.
It requires that they diagnose error conditions (which includes EPIPE).




Re: Project management and code quality tools

2008-10-07 Thread Alfred M. Szmidt
   The copyright notice said the FSF, I assumed you have papers on file.
   But it would be good to confirm this.

I don't think you can transfer code from one project to another like
that. So you you have to contact rms I think.

Yeah, it is painful... sighs

   * Stylesheets: should it be inlined into the generated HTML
 instead?  That is often easier.

Is the output also generating flat text?  That would rock...





Re: Project management and code quality tools

2008-10-07 Thread Simon Josefsson
Alfred M. Szmidt [EMAIL PROTECTED] writes:

The copyright notice said the FSF, I assumed you have papers on file.
But it would be good to confirm this.

 I don't think you can transfer code from one project to another like
 that. So you you have to contact rms I think.

 Yeah, it is painful... sighs

Indeed.  I asked RMS about it.

* Stylesheets: should it be inlined into the generated HTML
  instead?  That is often easier.

 Is the output also generating flat text?  That would rock...

The original pmccabe tool outputs flat text, and this pmccabe2html takes
it and generates HTML (or some Wiki-markup).  Although pmccabe2html
could be enhanced to support flat text output as well.

/Simon




Re: Project management and code quality tools

2008-10-07 Thread jemarch

I think it is a really good idea. If the scripts are distributed in
gnulib more GNU packages will be using them and improving them.
   
   Thanks for feedback, I have pushed the module into gnulib.
   
Nice. Then we will start using the gnulib version :)

   Great. :)

   The copyright notice said the FSF, I assumed you have papers on file.
   But it would be good to confirm this.

Yes, of course. All the GNU PDF codebase is FSF copyrighted.

   There are some minor things that should probably be addressed
   eventually:

   * Stylesheets: should it be inlined into the generated HTML instead?
 That is often easier.

   * There seems to be hard-coded assumptions in the code, for example:
   cut_dir = /../
 I haven't yet understood the code fully though.

   * For some reason the outputs on my http://josefsson.org/cyclo/ page
 doesn't have inlined functions, and I get warnings when running the
 tool:

Yes, the code needs some polishing. I will look into it ASAP.





Re: Project management and code quality tools

2008-10-07 Thread Simon Josefsson
[EMAIL PROTECTED] writes:

 I think it is a really good idea. If the scripts are distributed in
 gnulib more GNU packages will be using them and improving them.

Thanks for feedback, I have pushed the module into gnulib.

 Nice. Then we will start using the gnulib version :)

Great. :)

The copyright notice said the FSF, I assumed you have papers on file.
But it would be good to confirm this.

 Yes, of course. All the GNU PDF codebase is FSF copyrighted.

Thanks for confirming.  Then the question is whether you need additional
assignments for gnulib too...

There are some minor things that should probably be addressed
eventually:

* Stylesheets: should it be inlined into the generated HTML instead?
  That is often easier.

* There seems to be hard-coded assumptions in the code, for example:
cut_dir = /../
  I haven't yet understood the code fully though.

* For some reason the outputs on my http://josefsson.org/cyclo/ page
  doesn't have inlined functions, and I get warnings when running the
  tool:

 Yes, the code needs some polishing. I will look into it ASAP.

Thanks!

One strange thing are the spurious green lines in the output:

http://josefsson.org/cyclo/cyclo-gsasl.html

Another concern:

* The headers for each column doesn't align well over the numbers in the
  column, it should probably use some td/td even for the column
  headers.  Or maybe it is my browser?  For example:

  http://josefsson.org/cyclo/cyclo-curl.html

  It is unclear which number goes with which header at quick glanze.

/Simon





Re: cyclomatic code complexity report for gnulib

2008-10-07 Thread Simon Josefsson
Bruno Haible [EMAIL PROTECTED] writes:

 Simon Josefsson wrote:
 Using the pmccabe2html module I created a report for gnulib itself:
 
 http://josefsson.org/gnulib-cyclo.html
 
 Gnulib appears to trigger some bugs in the script on how the functions
 are sorted, but the output may be interesting nonetheless.

 The legend talks about untestable functions, and indeed the coloring
 of the functions is related to the amount of testing that is needed to
 get a reasonable coverage of their operations. We see near the top

   function  module

   VASNPRINTFvasnprintf
   mem_cd_iconveh_internal   striconveh
   re_search_internalregex
   context::diag diffseq
   strtodstrtod

 and indeed these modules require a large testsuite. regex doesn't have a
 testsuite in gnulib, because we profit from glibc's testing. diffseq should
 better have a test as well, because GNU diff has no unit tests at all.

 However, the tool exaggerates the amount of testing needed for functions
 that have different implementations on different platforms, like

   function  module implementations

   create_pipe   pipe 3
   qcopy_acl acl  7
   execute   execute  3
   qset_acl  acl  7
   getloadavggetloadavg  15

Right, the tool is simple and has its shortcomings.  Possibly the
explanations should be improved.  A link to wikipedia may help:
http://en.wikipedia.org/wiki/Cyclomatic_complexity

Any objections to installing the module in gnulib?

/Simon




Re: Project management and code quality tools

2008-10-07 Thread jemarch

I think it is a really good idea. If the scripts are distributed in
gnulib more GNU packages will be using them and improving them.

   Thanks for feedback, I have pushed the module into gnulib.

Nice. Then we will start using the gnulib version :)





Re: Project management and code quality tools

2008-10-07 Thread jemarch

documentation. The scripts generating all the stuff are in the
'prmgt/' directory in the libgnupdf sources distribution.

   I have taken a closer look at your prmgt/ directory, and I really like
   your efforts.  I want to use this in my projects, and the simplest for
   me would be to move some of your scripts into gnulib.  What are your
   thoughts on that?

I think it is a really good idea. If the scripts are distributed in
gnulib more GNU packages will be using them and improving them.

   My next step is to propose a gnulib module for code coverage testing
   (lcov output) as well, or at least look into if that is a feasible
   approach.

Maybe maint.mk would be a good place where to put the 'make coverage'
target.





Re: cyclomatic code complexity report for gnulib

2008-10-07 Thread Bruno Haible
Simon Josefsson wrote:
 Using the pmccabe2html module I created a report for gnulib itself:
 
 http://josefsson.org/gnulib-cyclo.html
 
 Gnulib appears to trigger some bugs in the script on how the functions
 are sorted, but the output may be interesting nonetheless.

The legend talks about untestable functions, and indeed the coloring
of the functions is related to the amount of testing that is needed to
get a reasonable coverage of their operations. We see near the top

  function  module

  VASNPRINTFvasnprintf
  mem_cd_iconveh_internal   striconveh
  re_search_internalregex
  context::diag diffseq
  strtodstrtod

and indeed these modules require a large testsuite. regex doesn't have a
testsuite in gnulib, because we profit from glibc's testing. diffseq should
better have a test as well, because GNU diff has no unit tests at all.

However, the tool exaggerates the amount of testing needed for functions
that have different implementations on different platforms, like

  function  module implementations

  create_pipe   pipe 3
  qcopy_acl acl  7
  execute   execute  3
  qset_acl  acl  7
  getloadavggetloadavg  15

Bruno





Re: Project management and code quality tools

2008-10-07 Thread Simon Josefsson
[EMAIL PROTECTED] writes:

 I think it is a really good idea. If the scripts are distributed in
 gnulib more GNU packages will be using them and improving them.

Thanks for feedback, I have pushed the module into gnulib.

 Nice. Then we will start using the gnulib version :)

Great. :)

The copyright notice said the FSF, I assumed you have papers on file.
But it would be good to confirm this.

There are some minor things that should probably be addressed
eventually:

* Stylesheets: should it be inlined into the generated HTML instead?
  That is often easier.

* There seems to be hard-coded assumptions in the code, for example:
cut_dir = /../
  I haven't yet understood the code fully though.

* For some reason the outputs on my http://josefsson.org/cyclo/ page
  doesn't have inlined functions, and I get warnings when running the
  tool:

[EMAIL PROTECTED]:~/josefsson.org/cyclo$ make cyclo-libidn.html
(cd ~/src/libidn/src  pmccabe ../lib/*.c) | sort -nr | 
~/src/gnulib/build-aux/pmccabe2html -v lang=html -v name=GNU Libidn -v 
vcurl=http://git.savannah.gnu.org/gitweb/?p=libidn.git;a=blob;f=%FILENAME%;hb=HEAD;
 -v url=http://www.gnu.org/software/libidn/;  cyclo-libidn.html
rm: cannot remove `idna_to_ascii_4i_fn.txt': No such file or directory
rm: cannot remove `stringprep_4i_fn.txt': No such file or directory
rm: cannot remove `_g_utf8_normalize_wc_fn.txt': No such file or directory
rm: cannot remove `punycode_encode_fn.txt': No such file or directory
rm: cannot remove `punycode_decode_fn.txt': No such file or directory
rm: cannot remove `idna_to_ascii_4z_fn.txt': No such file or directory
rm: cannot remove `g_utf8_to_ucs4_fast_fn.txt': No such file or directory
rm: cannot remove `tld_get_4_fn.txt': No such file or directory
rm: cannot remove `idna_to_unicode_internal_fn.txt': No such file or directory
rm: cannot remove `combine_fn.txt': No such file or directory
rm: cannot remove `_tld_checkchar_fn.txt': No such file or directory
[EMAIL PROTECTED]:~/josefsson.org/cyclo$ 

/Simon




Re: Project management and code quality tools

2008-10-07 Thread Ludovic Courtès
Hi,

Simon Josefsson [EMAIL PROTECTED] writes:

 [EMAIL PROTECTED] writes:

 I think it is a really good idea. If the scripts are distributed in
 gnulib more GNU packages will be using them and improving them.

 Thanks for feedback, I have pushed the module into gnulib.

That's good news!  I'm also a big fan of GNU PDF's tools, so thank you!

Ludo'.




Re: bootstrap is broken

2008-10-07 Thread Paolo Bonzini
Debarshi Ray wrote:
 This particular change due to 29dd8b5548ce047ce51ff9a73d6c4b50c9886771
 has broken bootstrap for the particular use case where it is invoked
 using an absolute path (eg.,
 /devel/gnulib/git/gnulib/build-aux/bootstrap --skip-po
 --gnulib-srcdir=/devel/gnulib/git/gnulib):
 
 @@ -146,7 +146,13 @@ copy=false
  vc_ignore=auto
 
  # Override the default configuration, if necessary.
 -test -r bootstrap.conf  . ./bootstrap.conf
 +# Make sure that bootstrap.conf is sourced from the current directory
 +# if we were invoked as sh bootstrap.
 +case $0 in
 +  */*) test -r $0.conf  . $0.conf ;;
 +  *) test -r $0.conf  . ./$0.conf ;;
 +esac

How does it fail?  It works here at least...

Paolo





Re: [PATCH] implement full-blown select(2) for winsock

2008-10-07 Thread Paolo Bonzini
Bruno Haible wrote:
 And this implements the modules for most of the functions from sys/socket.h.
 
 The functions 'ioctl' and 'close' are not handled in this patch; they are a
 little more complicated.

I'll take care of close.

Paolo




[PATCH] use gnulib modules close (new) and open to hook into open/close

2008-10-07 Thread Paolo Bonzini
This patch replaces the two separate replacements of close in winsock.c
and fchdir.c with a module close that knows how to weave the two
preexisting pieces of code.  Likewise, it changes the open replacement
of fchdir.c into a small function called by the generic open function.

As a nice side effect, knowledge of fchdir disappears from the fcntl_h
module, and so does duplicated code between open.c and fchdir.c

The Winsock replacement of close is triggered by the socket and accept
modules.  It could be possible to make it always trigger on mingw, but
that would make fchdir dependent on sys_socket_h and winsock.c, which I
explicitly wanted to avoid.  I also wanted to avoid other ugly solutions
such as making a close-impl module on which fchdir depends and making
close trigger the Winsock replacement.  Hints on how to fix this, and
whether it is worth it, are welcome.

Most of the code is just boring setup for the new things to work
properly.  In particular, whenever I need to force the replacement of
open and close I use a macro gl_REPLACE_{OPEN,CLOSE} to avoid breaking
encapsulation of m4/{open,close}.m4.

Ok?

Paolo
2008-10-07  Paolo Bonzini  [EMAIL PROTECTED]

* lib/fchdir.c (gl_free_fd): New, from part of rpl_close.
(_gl_register_fd): New, from part of rpl_open.
(rpl_opendir, rpl_closedir): Use them.
* lib/winsock.c (_gl_close_fd): New name of rpl_close.
* lib/close.c: New.
* lib/open.c: Include the function independent of FCHDIR_REPLACEMENT.
Use _gl_register_fd if needed.
* lib/fcntl.in.h: Do not check FCHDIR_REPLACEMENT to check whether
open should be replaced.
* lib/sys_socket.in.h: Do not replace close.
* lib/unistd.in.h: Add separate if-ology for close, instead of having
it as part of the fchdir replacement.

* m4/close.m4: New.
* m4/fchdir.m4: Force replacing open and close if fchdir.c is needed.
* m4/open.m4: Provide and use gl_REPLACE_OPEN.  Add a : to make the
body of gl_PREREQ_OPEN non-empty.
* m4/unistd_h.m4: Add substed variables for close.

* modules/close: New.
* modules/accept: Depend on close and force its replacement if Winsock.
* modules/fchdir: Depend on close.
* modules/socket: Depend on close and force its replacement if Winsock.
* modules/unistd: Replace substed variables for close in unistd.h.

diff --git a/lib/close.c b/lib/close.c
new file mode 100644
index 000..e87a32f
--- /dev/null
+++ b/lib/close.c
@@ -0,0 +1,47 @@
+/* close replacement.
+   Copyright (C) 2008 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 3 of the License, 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, see http://www.gnu.org/licenses/.  */
+
+#include config.h
+#include unistd.h
+
+#if (defined _WIN32 || defined __WIN32__)  ! defined __CYGWIN__
+# if defined GNULIB_SOCKET || defined GNULIB_ACCEPT
+#  define GNULIB_NEED_CLOSE_FD 1
+# endif
+#endif
+
+/* Override close() to call into other gnulib modules.  */
+
+int
+rpl_close (int fd)
+#undef close
+{
+#ifdef GNULIB_NEED_CLOSE_FD
+  extern int _gl_close_fd (int fd);
+  int retval = _gl_close_fd (fd);
+#else
+  int retval = close (fd);
+#endif
+
+#ifdef FCHDIR_REPLACEMENT
+  if (retval = 0)
+{
+  extern int _gl_free_fd (int fd);
+  _gl_free_fd (fd);
+}
+#endif
+  return retval;
+}
diff --git a/lib/fchdir.c b/lib/fchdir.c
index 246987c..eb06aed 100644
--- a/lib/fchdir.c
+++ b/lib/fchdir.c
@@ -75,64 +75,39 @@ ensure_dirs_slot (size_t fd)
 }
 }
 
-/* Override open() and close(), to keep track of the open file descriptors.  */
+/* Hook into the gnulib replacements for open() and close() to keep track
+   of the open file descriptors.  */
+
+/* We do not want to declare these anywhere, but we want prototypes to
+   shut up -Wimplicit.  */
+extern int _gl_free_fd (int fd);
+extern void _gl_register_fd (int fd, const char *filename);
 
 int
-rpl_close (int fd)
-#undef close
+_gl_free_fd (int fd)
 {
-  int retval = close (fd);
-
-  if (retval = 0  fd = 0  fd  dirs_allocated)
+  if (fd = 0  fd  dirs_allocated)
 {
   if (dirs[fd].name != NULL)
free (dirs[fd].name);
   dirs[fd].name = NULL;
   dirs[fd].saved_errno = ENOTDIR;
 }
-  return retval;
 }
 
-int
-rpl_open (const char *filename, int flags, ...)
-#undef open
+void
+_gl_register_fd (int fd, const char *filename)
 {
-  mode_t mode;
-  int fd;
   

Re: Project management and code quality tools

2008-10-07 Thread Simon Josefsson
[EMAIL PROTECTED] writes:

 documentation. The scripts generating all the stuff are in the
 'prmgt/' directory in the libgnupdf sources distribution.

I have taken a closer look at your prmgt/ directory, and I really like
your efforts.  I want to use this in my projects, and the simplest for
me would be to move some of your scripts into gnulib.  What are your
thoughts on that?

 I think it is a really good idea. If the scripts are distributed in
 gnulib more GNU packages will be using them and improving them.

Thanks for feedback, I have pushed the module into gnulib.

Btw, I have blogged about this:
http://blog.josefsson.org/2008/10/07/cyclomatic-code-complexity/

My next step is to propose a gnulib module for code coverage testing
(lcov output) as well, or at least look into if that is a feasible
approach.

 Maybe maint.mk would be a good place where to put the 'make coverage'
 target.

Hm, yes, possibly.  There is a problem about where to place the output
in though.  In libidn I chose to use a doc/prmgt/ sub-directory and to
distribute the generated HTML file with every distribution.  Then the
path for the filename is always well-known, and it always built.

/Simon




User-visible changes to lib-link.m4 and lib-prefix.m4

2008-10-07 Thread Roberto Bagnara


Hi there,

we have been using the AC_LIB_LINKFLAGS for years without any problem.
A few days ago, that is, a few days before the release of the Parma
Polyhedra Library (http://www.cs.unipr.it/ppl/) we thought it was a good
idea to update lib-link.m4 and lib-prefix.m4, since we were still using the
version distributed with Gettext 0.14.6.  However, this update broke
the build.  Looking at config.log it seems that, despite using the
--with-lib-prefix option, no -I option is added to the compiler options.
We tried to understand what was changed in lib-link.m4 and lib-prefix.m4,
but we failed.  We discovered, though, that things stop working for us
in passing from the versions distributed with with Gettext 0.14.6
to the versions distributed with Gettext 0.15.  We have looked
in the sources and at the NEWS file to understand whether the
AC_LIB_LINKFLAGS should be used differently with the newer versions,
but we failed again.

Here is how we use the AC_LIB_LINKFLAGS macro in an Autoconf macro
by ourselves:

AC_DEFUN([AC_CHECK_GMP],
[
dnl Since libgmp and libgmpxx are usually installed in the same location,
dnl let the prefixes default from each other.
if test -n $with_libgmpxx_prefix  test -z $with_libgmp_prefix; then
  with_libgmp_prefix=$with_libgmpxx_prefix
else
  if test -n $with_libgmp_prefix  test -z $with_libgmpxx_prefix; then
with_libgmpxx_prefix=$with_libgmp_prefix
  fi
fi

dnl Check how to link with libgmp.
AC_LIB_LINKFLAGS([gmp])

dnl Check how to link with libgmpxx.
AC_LIB_LINKFLAGS([gmpxx], [gmp])
...

What are we missing?  Is there some documentation on how to properly
use these macros?
All the best,

   Roberto

--
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:[EMAIL PROTECTED]




Re: Project management and code quality tools

2008-10-07 Thread Alfred M. Szmidt
   * Stylesheets: should it be inlined into the generated HTML
 instead?  That is often easier.
   
Is the output also generating flat text?  That would rock...

   The original pmccabe tool outputs flat text, and this pmccabe2html
   takes it and generates HTML (or some Wiki-markup).  Although
   pmccabe2html could be enhanced to support flat text output as well.

Nice, I like that.




Re: Project management and code quality tools

2008-10-07 Thread Richard M. Stallman
Richard, an issue came up related to gnulib: I want to move a module
from GNUPDF written by Jose E. Marchesi [EMAIL PROTECTED] (I have his
permission to do so).  The code is copyrighted by the FSF, Jose signed
papers for GNUPDF but not gnulib.  Does he need to sign papers again for
gnulib?

The code he has written is already assigned to the FSF; once that is
the case, we can put it wherever we want, and it will remain copyright
FSF.

In regard to his future changes, if he makes them for GNU PDF, they
will also be assigned by the assignment he signed for GNU PDF, so we
can put them wherever we want and they will remain copyright FSF.

If he sends you a change to that code for GNUlib, please ask him to
put it in GNUPDF first, so that his assignment will cover it.  Then
you can get it out of GNUPDF.  He could also sign an assignment for
GNUlib and then he could send you changes specifically for GNUlib.




Re: lib/regex_internal.h on 1.4.11

2008-10-07 Thread Bruno Haible
Eric Blake wrote:
  Indeed, we're in a maze of twisty little HP cc compiler bugs:
http://lists.gnu.org/archive/html/bug-gnulib/2008-04/msg00179.html
http://lists.gnu.org/archive/html/bug-gnulib/2008-08/msg0.html
 
 minus_zerol is miscompiled on at least Irix 6.2.  So until we hear
 feedback from Jonathan on what DOES allow us to compile -0.0L on
 HP-UX/hppa ...

I just happened to get access to a HP-UX 10.20 machine today. It was
installed in 1997, i.e. 11 years ago! That counts as museumware to me,
not as a reasonable portability target any more. We are putting into gnulib
code for Windows that will not work on Windows98 and WindowsME, released
in 1998 and 2000, respectively. Then why should we care about systems that
were put together in 1996 and shipped in 1997?

The test programs from
  http://lists.gnu.org/archive/html/bug-gnulib/2008-09/msg00118.html
yield the following results, after replacing 0.1L with LDBL_MIN (otherwise
the y may be a negative denormalized number rather than a minus zero).
The '?' mean that signbit() is not available natively on that platform.

fool.c =
inf
0
?
0
inf
0
?
0
inf
0
?
0
-inf
1
?
1
-inf
1
?
1

food.c =
-inf
1
?
1
-inf
1
?
0
-inf
1
?
1
-inf
1
?
1
-inf
1
?
1

So, to get a negative 'long double' zero, neither of
  long double minus_zerol = -0.0L;
  -0.0L
  -zerol
are usable. Instead, only expressions like (-0.1L * LDBL_MIN) and
(-0.1L / LDBL_MAX) work.

For 'double', the situation is more relaxed, the only form we need to
avoid is the literal -0.0; using a global variable works. (I don't want
to divide by ±0.0 to test its sign; this relies on IEEE and is outside
ISO C.)

I'm applying this:

2008-10-07  Bruno Haible  [EMAIL PROTECTED]

Use a more portable replacement expression for -0.0L.
* m4/signbit.m4 (gl_SIGNBIT_TEST_PROGRAM): Use -LDBL_MIN * LDBL_MIN
instead of -0.0L. Fix m4 quotation.

* tests/test-signbit.c: Include float.h.
(minus_zero): New variable.
(test_signbitl): Use minus_zero instead of -zero.
* modules/signbit-tests (Depends-on): Add float.

* tests/test-ceill.c: Include float.h.
(zero): Remove variable.
(minus_zero): New variable.
(main): Use minus_zero instead of -zero.
* modules/ceill-tests (Depends-on): Add float.

* tests/test-floorl.c: Include float.h.
(zero): Remove variable.
(minus_zero): New variable.
(main): Use minus_zero instead of -zero.
* modules/floorl-tests (Depends-on): Add float.

* tests/test-roundl.c: Include float.h.
(zero): Remove variable.
(minus_zero): New variable.
(main): Use minus_zero instead of -zero.
* modules/roundl-tests (Depends-on): Add float.

* tests/test-truncl.c: Include float.h.
(zero): Remove variable.
(minus_zero): New variable.
(main): Use minus_zero instead of -zero.
* modules/truncl-tests (Depends-on): Add float.

* tests/test-frexpl.c (zero): Remove variable.
(minus_zero): New variable.
(main): Use minus_zero instead of -zero.
* modules/frexpl-tests (Depends-on): Add float.

* tests/test-isnan.c (zerol): Remove variable.
(minus_zerol): New variable.
(test_long_double): Use minus_zerol instead of -zerol.
* modules/isnan-tests (Depends-on): Add float.

* tests/test-isnanl.h (zero): Remove variable.
(minus_zero): New variable.
(main): Use minus_zero instead of -zero.
* modules/isnanl-nolibm-tests (Depends-on): Add float.
* modules/isnanl-tests (Depends-on): Add float.

* tests/test-ldexpl.c (zero): Remove variable.
(minus_zero): New variable.
(main): Use minus_zero instead of -zero.
* modules/ldexpl-tests (Depends-on): Add float.

* tests/test-snprintf-posix.h (zerol): Remove variable.
(minus_zerol): New variable.
(test_function): Use minus_zerol instead of -zerol.
* modules/snprintf-posix-tests (Depends-on): Add float.
* modules/vsnprintf-posix-tests (Depends-on): Add float.

* tests/test-sprintf-posix.h (zerol): Remove variable.
(minus_zerol): New variable.
(test_function): Use minus_zerol instead of -zerol.
* modules/sprintf-posix-tests (Depends-on): Add float.
* modules/vsprintf-posix-tests (Depends-on): Add float.

* tests/test-vasnprintf-posix.c (zerol): Remove variable.
(minus_zerol): New variable.
(test_function): Use minus_zerol instead of -zerol.
* modules/vasnprintf-posix-tests (Depends-on): Add float.

* tests/test-vasprintf-posix.c (zerol): Remove variable.
(minus_zerol): New variable.
(test_function): Use minus_zerol instead of -zerol.
* modules/vasprintf-posix-tests (Depends-on): Add float.

--- m4/signbit.m4.orig  2008-10-08 01:48:15.0 +0200
+++ m4/signbit.m4   2008-10-08