Problem including float.h with gcc -mno-cygwin
Paul Stodghill
stodghil@cs.cornell.edu
Thu Mar 17 18:41:00 GMT 2005
If a program includes <float.h> and is compiled with gcc -mno-cygwin, it
appears to include the wrong instance of float.h. More specifically,
"/usr/i686-pc-mingw32/include/float.h" is written assuming that it will
be included before "/usr/lib/gcc/i686-pc-cygwin/3.4.1/include/float.h"
and uses #include_next to pick up the compiler provided definitions.
However, this does not appear to be happening.
The reasons appears to be that the
"/usr/lib/gcc/i686-pc-cygwin/3.4.1/include" appears on the search path
before "/usr/i686-pc-mingw32/include". Adding
"-I/usr/i686-pc-mingw32/include" to the command line does not work
because it is suppressed as a duplicate entry.
I have reproduced this problem with Current and Experimental versions of
gcc and gcc-mingw (ie, 3.3.3 and 3.4.1).
Below is a script illustrating the problem. I believe that I have
provide everything necessary to reproduce the problem. Please let me
know if anything additional is required.
barney-xp$ cat example.c
#include <float.h>
#ifndef _EM_DENORMAL
#error Where is _EM_DENORMAL?
#endif
barney-xp$
barney-xp$
barney-xp$ fgrep _EM_DENORMAL /usr/i686-pc-mingw32/include/float.h
#define _EM_DENORMAL 0x00080000
barney-xp$
barney-xp$
barney-xp$ uname -a
CYGWIN_NT-5.1 barney-xp 1.5.13(0.122/4/2) 2005-03-01 11:01 i686 unknown
unknown Cygwin
barney-xp$ gcc --version
gcc (GCC) 3.4.1 (cygming special)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
barney-xp$
barney-xp$
barney-xp$ gcc -v -E -mno-cygwin example.c
Reading specs from /usr/lib/gcc/i686-pc-mingw32/3.4.1/specs
Configured with: /gcc/3.4/gcc-3.4.1-1/configure --verbose --prefix=/usr
--exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--enable-languages=c,ada,c++,f77,java,objc --enable-nls
--without-included-gettext --enable-libgcj --with-system-zlib
--enable-interpreter --enable-threads=posix --enable-java-gc=boehm
--enable-sjlj-exceptions --disable-version-specific-runtime-libs
--disable-win32-registry
Thread model: posix
gcc version 3.4.1 (cygming special)
/usr/lib/gcc/i686-pc-mingw32/3.4.1/cc1.exe -E -quiet -v -D__MSVCRT__
-D__MINGW32__ -DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ -DWINNT -idirafter
/usr/lib/gcc/i686-pc-mingw32/3.4.1/../../../../include/w32api -idirafter
/usr/lib/gcc/i686-pc-mingw32/3.4.1/../../../../i686-pc-mingw32/lib/../../include/w32api
example.c -mno-cygwin -mtune=pentiumpro
ignoring nonexistent directory "/usr/local/include/mingw"
ignoring duplicate directory "/usr/include/mingw"
ignoring duplicate directory
"/usr/lib/gcc/i686-pc-mingw32/3.4.1/../../../../i686-pc-mingw32/lib/../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/i686-pc-cygwin/3.4.1/include
/usr/lib/gcc/i686-pc-mingw32/3.4.1/../../../../i686-pc-mingw32/include
/usr/lib/gcc/i686-pc-mingw32/3.4.1/../../../../include/w32api
End of search list.
# 1 "example.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "example.c"
# 1 "/usr/lib/gcc/i686-pc-cygwin/3.4.1/include/float.h" 1 3 4
# 2 "example.c" 2
example.c:4:2: #error Where is _EM_DENORMAL?
barney-xp$
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20050317/e633f038/attachment.ksh>
-------------- next part --------------
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list