This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: Problems with <tgmath.h>
>>>>> Ulrich Drepper writes:
Uli> Andreas Jaeger <aj@suse.de> writes:
>> Here's a patch for glibc 2.2. glibc 2.1 needs the same patch.
Uli> This patch isn't ok. You cannot even compile glibc with it. A global
:-( You're right.
Uli> protection is not working. It has to be made finer grained.
Btw. why do we include it at all in <complex.h> ?
We have on all platforms a most things bracked by:
#if defined __USE_ISOC9X && defined _MATH_H
#endif
and also on the the following piece of code:
#ifndef __NO_LONG_DOUBLE_MATH
/* Signal that we do not really have a `long double'. The disables the
declaration of all the `long double' function variants. */
# define __NO_LONG_DOUBLE_MATH 1
#endif
The latter is the one we need for <complex.h> and <math.h> - the
former only for <math.h>. Shouldn't we put the __NO_LONG_DOUBLE_MATH
declaration in an extra file and include this one in <math.h> and
<complex.h> ? The alternative would be to use (see the appended patch
for details - this patch works ;-):
#if defined __USE_ISOC9X && defined _MATH_H && !defined _BITS_MATH_H
# define _BITS_MATH_H 1
...
#endif /* ISO C 9X */
I can send a patch for all platforms - just tell me which solution you
prefer.
Btw. the test program for this problem is:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define _GNU_SOURCE 1
#include <math.h>
#include <complex.h>
int
main (void)
{
return 0;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The output from gcc is:
In file included from /usr/include/complex.h:29,
from /tmp/headers.c:3:
/usr/include/bits/mathdef.h:27: warning: redefinition of `float_t'
/usr/include/bits/mathdef.h:27: warning: `float_t' previously declared here
/usr/include/bits/mathdef.h:29: warning: redefinition of `double_t'
/usr/include/bits/mathdef.h:29: warning: `double_t' previously declared here
Andreas
1999-12-17 Andreas Jaeger <aj@suse.de>
* sysdeps/i386/fpu/bits/mathdef.h: Avoid double declaration.
============================================================
Index: sysdeps/i386/fpu/bits/mathdef.h
--- sysdeps/i386/fpu/bits/mathdef.h 1999/10/31 17:31:10 1.5
+++ sysdeps/i386/fpu/bits/mathdef.h 1999/12/17 16:23:01
@@ -20,7 +20,8 @@
# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
#endif
-#if defined __USE_ISOC99 && defined _MATH_H
+#if defined __USE_ISOC99 && defined _MATH_H && !defined _BITS_MATH_H
+# define _BITS_MATH_H 1
/* The ix87 FPUs evaluate all values in the 80 bit floating-point format
which is also available for the user as `long double'. Therefore we
define: */
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.rhein-neckar.de