[mingw32-runtime] Fix float.h when gcc's float.h precedes it in the include path

Kalev Lember kalev at fedoraproject.org
Fri Aug 26 15:28:54 UTC 2011


commit 2ab1639460f4427ca6dafcba4bd7a314ccc20b88
Author: Kalev Lember <kalevlember at gmail.com>
Date:   Fri Aug 26 14:39:49 2011 +0300

    Fix float.h when gcc's float.h precedes it in the include path

 mingw32-runtime.spec |   11 +++++-
 mingwrt-float.patch  |   97 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 107 insertions(+), 1 deletions(-)
---
diff --git a/mingw32-runtime.spec b/mingw32-runtime.spec
index aaecd6e..837593f 100644
--- a/mingw32-runtime.spec
+++ b/mingw32-runtime.spec
@@ -6,13 +6,18 @@
 
 Name:           mingw32-runtime
 Version:        3.18
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        MinGW Windows cross-compiler runtime
 
 License:        Public Domain
 Group:          Development/Libraries
 URL:            http://www.mingw.org/
 Source0:        http://downloads.sourceforge.net/mingw/mingwrt-%{version}-mingw32-src.tar.gz
+
+# Backported from upstream,
+# fix float.h when gcc's float.h precedes it in the include path.
+Patch0:         mingwrt-float.patch
+
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildArch:      noarch
@@ -33,6 +38,7 @@ MinGW Windows cross-compiler runtime, base libraries.
 
 %prep
 %setup -q -n mingwrt-%{version}-mingw32
+%patch0 -p1 -b .float
 
 
 %build
@@ -68,6 +74,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Fri Aug 26 2011 Kalev Lember <kalevlember at gmail.com> - 3.18-4
+- Fix float.h when gcc's float.h precedes it in the include path
+
 * Tue May 10 2011 Kalev Lember <kalev at smartlink.ee> - 3.18-3
 - Build without -fexceptions (#629209)
 
diff --git a/mingwrt-float.patch b/mingwrt-float.patch
new file mode 100644
index 0000000..d9253b9
--- /dev/null
+++ b/mingwrt-float.patch
@@ -0,0 +1,97 @@
+From 295d06c847db4db6ca71463d9da6f6436eec1c3f Mon Sep 17 00:00:00 2001
+From: keithmarshall <keithmarshall>
+Date: Sun, 25 Jul 2010 20:20:46 +0000
+Subject: [PATCH] Accept that mingwrt headers are not guaranteed to precede
+ GCC's in the system include search path; (issue reported by
+ Mark Brand).
+
+---
+ ChangeLog       |   14 ++++++++++++++
+ include/float.h |   36 ++++++++++++++++++++++++++----------
+ 2 files changed, 40 insertions(+), 10 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index fe84a51..5f106e6 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,17 @@
++2010-07-25  Keith Marshall  <keithmarshall at users.sourceforge.net>
++
++	Accept that mingwrt headers are not guaranteed to precede GCC's in the
++	system include search path; (issue reported by Mark Brand).
++
++	* include/float.h: Add multiple inclusion guard around...
++	[! defined _FLOAT_H___]: ...include_next <float.h> for GCC's version,
++	only when this define does not indicate that it has already been seen;
++	update comments to document rationale; move it within the scope of...
++	[! defined _MINGW_FLOAT_H_]: ...this multiple inclusion guard, so that
++	GCC's float.h, after an appropriate complementary modification, need
++	not perform a further include path search when this implementation
++	specific extension has already been processed.
++
+ 2010-03-06 Chris Sutcliffe <ir0nh34d at users.sourceforge.net>
+ 
+ 	* include/_mingw.h: Increment version to 3.18.
+diff --git a/include/float.h b/include/float.h
+index 97a2c1c..d5f2215 100644
+--- a/include/float.h
++++ b/include/float.h
+@@ -1,5 +1,7 @@
++#ifndef _MINGW_FLOAT_H_
+ /* 
+  * float.h
++ *
+  * This file has no copyright assigned and is placed in the Public Domain.
+  * This file is a part of the mingw-runtime package.
+  * No warranty is given; refer to the file DISCLAIMER within the package.
+@@ -9,17 +11,31 @@
+  * Also included here are some non-ANSI bits for accessing the floating
+  * point controller.
+  *
+- * NOTE: GCC provides float.h, but it doesn't include the non-standard
+- *       stuff for accessing the fp controller. We include_next the
+- *       GCC-supplied header and just define the MS-specific extensions
+- *       here.     
+- *
+  */
+-
+-#include_next<float.h>
+-
+-#ifndef _MINGW_FLOAT_H_
+ #define _MINGW_FLOAT_H_
++/*
++ * NOTE:
++ *
++ * GCC provides float.h, but it doesn't include the non-standard stuff for
++ * accessing the fp controller.  We parse the GCC-supplied header, for its
++ * standard content, and then define the MS-specific extensions here.
++ *
++ * In a MinGW standard Win32 hosted environment, this should be the float.h
++ * found by a system include path search, but this can't be guaranteed; for
++ * a cross-compiler setup, the GCC-supplied header, which is guarded by the
++ * _FLOAT_H___ macro, may be found first, thus...
++ *
++ */
++#ifndef _FLOAT_H___
++ /*
++  * ...when we didn't find the GCC-supplied header first, we want to pull
++  * it in now; include_next should achieve this, (and we must rely on the
++  * GCC header maintainers to extend us the same courtesy, to get this one
++  * pulled in, when the GCC-supplied header is found first).
++  *
++  */
++# include_next <float.h>
++#endif
+ 
+ /* All the headers include this file. */
+ #include <_mingw.h>
+@@ -148,5 +164,5 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _isnan (double);
+ 
+ #endif	/* Not __STRICT_ANSI__ */
+ 
+-#endif /* _FLOAT_H_ */
++#endif /* _MINGW_FLOAT_H_ */
+ 
+-- 
+1.7.6
+


More information about the mingw mailing list