From: Greg C. <chi...@mi...> - 2002-11-03 00:59:10
|
The wxWindows makefiles specify -fno-pcc-struct-return because of a problem with gcc-2.8.1 . This seems to be fixed in later versions (2.95.2-1 and 3.2, at least), so they don't need to specify it for those later versions. [Substantiated below] I'd like to write a patch that removes this unneeded option depending on mingw gcc version. Can anyone say for which version -fno-pcc-struct-return became the default? I realize this isn't required for correctness: it's not an error to specify a default option explicitly. But it is confusing, and a little scary: the gcc manual says to specify -f[whatever]-struct-return only "to conform to a non-default application binary interface", so specifying it makes it appear (contrary to reality) that wxWindows changes the default ABI. The rest of this message is just substantiation for the claims made in the first paragraph above. C:/tmp[0]$/msys/1.0/bin/cat div_test.cpp /* wxWindows file wx/src/makeg95.env says: # According to Guillermo Rodriguez Garcia <gu...@ii...>, the # -fno-pcc-struct-return option is needed to make the standard div() # function work - otherwise it returns absolutely incorrect results # which breaks the wxImage class. This is true at least for # mingw32-gcc2.8.1, don't know about others. */ #include <cstdlib> #include <iostream> int main() { std::div_t d = std::div(13,3); std::cout << "Dividing 13 by three yields\n" << " quotient: " << d.quot << '\n' << " remainder: " << d.rem << '\n' ; } C:/tmp[0]$g++ div_test.cpp C:/tmp[0]$./a Dividing 13 by three yields quotient: 4 remainder: 1 C:/tmp[0]$g++ --version g++.EXE (GCC) 3.2 (mingw special 20020817-1) [...] C:/tmp[0]$g++ div_test.cpp C:/tmp[0]$./a Dividing 13 by three yields quotient: 4 remainder: 1 C:/tmp[0]$g++ -fpcc-struct-return div_test.cpp C:/tmp[0]$./a Dividing 13 by three yields quotient: 65536 remainder: 575 C:/tmp[0]$g++ --version 2.95.2 C:/tmp[0]$g++ div_test.cpp C:/tmp[0]$./a Dividing 13 by three yields quotient: 4 remainder: 1 C:/tmp[0]$g++ -fpcc-struct-return div_test.cpp C:/tmp[0]$./a Dividing 13 by three yields quotient: 4370432 remainder: 4370436 C:/tmp[0]$g++ --version g++.EXE (GCC) 3.2 (mingw special 20020817-1) |
From: <dan...@ya...> - 2002-11-03 01:24:49
|
--- Greg Chicares <chi...@mi...> wrote: > The wxWindows makefiles specify -fno-pcc-struct-return > because of a problem with gcc-2.8.1 . This seems to be > fixed in later versions (2.95.2-1 and 3.2, at least), > so they don't need to specify it for those later > versions. [Substantiated below] > Fri Aug 14 01:45:06 1998 Mumit Khan <kh...@xr...> * i386/cygwin32 (DEFAULT_PCC_STRUCT_RETURN): Define. I don't know what gcc version that was applied to (I think it was an egcs branch) , but at least: Sun Jul 25 23:40:51 PDT 1999 Jeff Law (la...@cy...) * gcc-2.95 Released. CVS should give you answer. Danny http://careers.yahoo.com.au - Yahoo! Careers - 1,000's of jobs waiting online for you! |