Mail Archives: cygwin/1999/04/23/22:33:49
--1915750185-1610392959-924921191=:2983
Content-Type: TEXT/PLAIN; charset=US-ASCII
Just for kicks, I tried to build a small analysis program with -U_WIN32;
this tool is essentially a filter and doesn't use any win32 specific
features, so it should be pretty safe, right?
Looks like certain typedefs are *WRONG* when you undefine _WIN32 and it
causes amazingly subtle bugs! Any code using stat for example will be
subtly but surely broken.
I'm attaching a small trivial program that should illustrate this. Here's
the header comments from the file.
This is with stock B20.1. Compiler version is no relevant here.
//
// A simple program to show the pitfall of using -U_WIN32 in your code
// under Cygwin b20.1!
//
// To build:
// $ c++ -U_WIN32 -o cyg-stat-bug cyg-stat.cc
// $ c++ -o cyg-stat-ok cyg-stat.cc
//
// Now run it giving a filename on command line:
//
// $ ./cyg-stat-bug ./cyg-stat.cc
// $ ./cyg-stat-ok ./cyg-stat.cc
//
// To find the cause of the problem (after you notice it in the output
// of course!), you need to look at the preprocessed files.
//
// $ c++ -save-temps -U_WIN32 -o cyg-stat-bug cyg-stat.cc
// $ mv cyg-stat.ii cyg-stat-bug.ii
// $ c++ -save-temps -o cyg-stat-ok cyg-stat.cc
// $ mv cyg-stat.ii cyg-stat-ok.ii
// $ diff -u3p cyg-stat-bug.ii cyg-stat-ok.ii
//
// Look for ino_t.
//
Regards,
Mumit
--1915750185-1610392959-924921191=:2983
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="cyg-stat.cc"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine DOT SUN DOT 3 DOT 93 DOT 990423213311 DOT 2983B AT modi DOT xraylith DOT wisc DOT edu>
Content-Description: Test program to show pitfall.
Ly8NCi8vIEEgc2ltcGxlIHByb2dyYW0gdG8gc2hvdyB0aGUgcGl0ZmFsbCBv
ZiB1c2luZyAtVV9XSU4zMiBpbiB5b3VyIGNvZGUNCi8vIHVuZGVyIEN5Z3dp
biBiMjAuMSENCi8vDQovLyBUbyBidWlsZDoNCi8vICAkIGMrKyAtVV9XSU4z
MiAtbyBjeWctc3Rhd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ogICAgIHsNCiAgICAgICBzdHJ1Y3Qg
c3RhdCBidWY7DQogICAgICAgY29uc3QgY2hhciAqcGF0aCA9IGFyZ3ZbaV07
DQogICAgICAgaW50IHJlc3VsdCA9IHN0YXQgKHBhdGgsICZidWYpOw0KDQog
ICAgICAgaWYgKHJlc3VsdCA9PSAwKQ0KCSB7DQoJICAgY2VyciA8PCAic3Rf
ZGV2ID0gIiA8PCBidWYuc3RfZGV2IDw8IGVuZGw7DQoJICAgY2VyciA8PCAi
c3RfaW5vID0gIiA8PCBidWYuc3RfaW5vIDw8IGVuZGw7DQoJICAgY2VyciA8
PCAic3RfbW9kZSA9ICIgPDwgYnVmLnN0X21vZGUgPDwgZW5kbDsNCgkgICBj
ZXJyIDw8ICJzdF9ubGluayA9ICIgPDwgYnVmLnN0X25saW5rIDw8IGVuZGw7
DQoJICAgY2VyciA8PCAic3RfdWlkID0gIiA8PCBidWYuc3RfdWlkIDw8IGVu
ZGw7DQoJICAgY2VyciA8PCAic3RfZ2lkID0gIiA8PCBidWYuc3RfZ2lkIDw8
IGVuZGw7DQoJICAgY2VyciA8PCAic3RfcmRldiA9ICIgPDwgYnVmLnN0X3Jk
ZXYgPDwgZW5kbDsNCgkgICBjZXJyIDw8ICJzdF9zaXplID0gIiA8PCBidWYu
c3Rfc2l6ZSA8PCBlbmRsOw0KCSB9DQogICAgICAgZWxzZQ0KCSB7DQoJICAg
Y2VyciA8PCAiY2Fubm90IHN0YXQgIiA8PCBwYXRoOw0KCSAgIHBlcnJvciAo
IiIpOw0KCSB9DQogICAgIH0NCiAgcmV0dXJuIDA7DQp9DQo=
--1915750185-1610392959-924921191=:2983
Content-Type: text/plain; charset=us-ascii
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
--1915750185-1610392959-924921191=:2983--
- Raw text -