public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix <bits/mathcalls.h> __BEGIN_NAMESPACE_C99/__END_NAMESPACE_C99 pairing
@ 2006-02-01 15:25 Jakub Jelinek
  2006-02-01 15:29 ` Jakub Jelinek
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2006-02-01 15:25 UTC (permalink / raw)
  To: Ulrich Drepper, Roland McGrath; +Cc: Glibc hackers

Hi!

In <bits/mathcalls.h>, __BEGIN_NAMESPACE_C99 is guarded with:
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
condition while the corresponding __END_NAMESPACE_C99 with:
#ifdef __USE_ISOC99.  So, if in C++, _GLIBCPP_USE_NAMESPACES
is defined, either __USE_MISC or __USE_XOPEN_EXTENDED and not
__USE_ISOC99, we have unclosed namespace.
Additionally, it seems that currently scalb{,l,f} prototype is only
provided
#if (defined __USE_MISC || defined __USE_XOPEN_EXTENDED) && defined __USE_ISOC99
while in revision 1.18 and older it was provided even if not
__USE_ISOC99 (after all, scalb{,l,f} is not in ISO C99).

2006-02-01  Jakub Jelinek  <jakub@redhat.com>

	* math/bits/mathcalls.h: Guard __END_NAMESPACE_C99 with the
	same #if condition as corresponding __BEGIN_NAMESPACE_C99.
	(scalb): Don't define only if __USE_ISOC99.

--- libc/math/bits/mathcalls.h.jj	2006-01-18 09:28:38.000000000 +0100
+++ libc/math/bits/mathcalls.h	2006-02-01 16:17:46.000000000 +0100
@@ -353,10 +353,13 @@ __MATHDECL_1 (int, __signbit,, (_Mdouble
 
 /* Multiply-add function computed as a ternary operation.  */
 __MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
+#endif /* Use ISO C99.  */
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
 __END_NAMESPACE_C99
+#endif
 
-# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
 /* Return X times (2 to the Nth power).  */
 __MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
-# endif
-#endif /* Use ISO C99.  */
+#endif

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix <bits/mathcalls.h> __BEGIN_NAMESPACE_C99/__END_NAMESPACE_C99 pairing
  2006-02-01 15:25 [PATCH] Fix <bits/mathcalls.h> __BEGIN_NAMESPACE_C99/__END_NAMESPACE_C99 pairing Jakub Jelinek
@ 2006-02-01 15:29 ` Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2006-02-01 15:29 UTC (permalink / raw)
  To: Ulrich Drepper, Roland McGrath; +Cc: Glibc hackers

On Wed, Feb 01, 2006 at 04:24:53PM +0100, Jakub Jelinek wrote:
> 2006-02-01  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* math/bits/mathcalls.h: Guard __END_NAMESPACE_C99 with the
> 	same #if condition as corresponding __BEGIN_NAMESPACE_C99.
> 	(scalb): Don't define only if __USE_ISOC99.

Forgot to add, I did some testing to see if similar problems aren't
elsewhere:
#!/bin/sh
for i in `rpm -ql glibc-headers`; do perl /usr/src/libc/scripts/begin-end-check.pl $i; done 2>&1 | grep -v OK
for i in `rpm -ql glibc-headers`; do
cat > /tmp/a.c <<EOF
#include <features.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#undef __BEGIN_NAMESPACE_STD
#undef __END_NAMESPACE_STD
#undef __BEGIN_NAMESPACE_C99
#undef __END_NAMESPACE_C99
#include <$i>
EOF
gcc -E /tmp/a.c -o /tmp/a.i > /dev/null 2>&1 || continue;
for flags in "" -D_GNU_SOURCE -D_ISOC99_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_SVID_SOURCE -D_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -ansi -D_POSIX_SOURCE -D_POSIX_C_SOURCE -D_POSIX_C_SOURCE=2 -D_POSIX_C_SOURCE=199309L -D_POSIX_C_SOURCE=199506L -D_POSIX_C_SOURCE=200112L; do
gcc $flags -E /tmp/a.c -o /tmp/a.i > /dev/null 2>&1;
perl /usr/src/libc/scripts/begin-end-check.pl /tmp/a.i | grep -v OK | sed "s~^~$i $flags: ~"
done
done

and math.h (plus tgmath.h that includes math.h) were the only 2 reported
headers.

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-02-01 15:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-01 15:25 [PATCH] Fix <bits/mathcalls.h> __BEGIN_NAMESPACE_C99/__END_NAMESPACE_C99 pairing Jakub Jelinek
2006-02-01 15:29 ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).