This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] cooperation between gcc's and mingw's float.h
- From: Mark Brand <mabrand at mabrand dot nl>
- To: MinGW Users List <mingw-users at lists dot sourceforge dot net>, gcc-patches at gcc dot gnu dot org
- Cc: mingw-cross-env-list at nongnu dot org
- Date: Sat, 05 Jun 2010 13:06:52 +0200
- Subject: [patch] cooperation between gcc's and mingw's float.h
Hi,
I'm reluctantly cross-posting because this issue requires cooperation
between gcc and mingw.
Both mingw and gcc have a float.h. The mingw version supplements the gcc
version, declaring _clear87 and _control87 among other things. The mingw
version has an #include_next which is meant to include the gcc version.
This works only when the mingw include dir is first in the header search
path, which may not be correct.
When the header search list is ordered with the mingw include directory
after the gcc's, a common symptom is that _clear87 and _control87 are
undeclared.
A web search for "mingw gcc float.h _clear87" turns up lots of
references to this problem, one of which is here:
http://bugreports.qt.nokia.com/browse/QTBUG-7576.
An easy (and correct?) solution is to move the #include_next<float.h>
from the mingw version into the gcc version regards. The attached
patches do this. But I imagine some discussion might be needed.
These patches are against tarballs gcc-4.5.0.tar.bz2 and
mingwrt-3.18-mingw32-dev.tar.gz
Mark
diff -urN a/gcc/ginclude/float.h b/gcc/ginclude/float.h
--- a/gcc/ginclude/float.h 2009-04-09 17:00:19.000000000 +0200
+++ b/gcc/ginclude/float.h 2010-06-05 12:03:41.887724045 +0200
@@ -236,3 +236,7 @@
#endif /* __STDC_WANT_DEC_FP__ */
#endif /* _FLOAT_H___ */
+
+#ifdef __MINGW32__
+#include_next<float.h>
+#endif
diff -urN a/include/float.h b/include/float.h
--- a/include/float.h 2010-03-07 04:31:41.000000000 +0100
+++ b/include/float.h 2010-06-05 12:29:08.899723741 +0200
@@ -16,8 +16,6 @@
*
*/
-#include_next<float.h>
-
#ifndef _MINGW_FLOAT_H_
#define _MINGW_FLOAT_H_