Closed Bug 669972 Opened 10 years ago Closed 10 years ago

use jswin.h to clean up from windows.h crapping on STRICT

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla8

People

(Reporter: sfink, Assigned: sfink)

References

Details

Attachments

(1 file)

json.h includes jsbuiltins.h includes nanojit/nanojit.h indirectly includes windows.h, which #defines STRICT. json.h uses STRICT in a DecodingMode enum. Because json.h also #undefs STRICT, it's normally ok.

But then, I modify jsprobes.h to include jswin.h which includes windows.h. Now jsonparser.cpp ends up including json.h first, then jsprobes.h. Mysteriously, windows.h seems to redefine STRICT the second time it's included, too, so jsonparse.cpp ends up compiling with STRICT #defined to something else. (Which happens to compile, but produces the wrong results.)

This seems bizarre, since I would expect windows.h to have protection from multiple inclusion, but that's the observed behavior. And I've fled my Windows dev environment purgatory for now, so I can't dig into it further at the moment. Plus, I don't really care why it was happening.
Use jswin.h to deal with windows.h. It'd be nice to replace nanojit's windows.h include with jswin.h to catch it at the source, but I don't understand the rules of the nanojit subtree.

Also, this patch could be expanded to handle jstracer.cpp's include of nanojit.h, but that looked like a slippery slope -- to do it right, it seems like jswin.h should also take over the alloca stuff from jstracer.cpp, but that involves

  #ifdef SOLARIS

so it would make jswin.h broader than just Windows, and that starts to feel messy.
Attachment #544576 - Flags: review?(jwalden+bmo)
Blocks: 588537
Comment on attachment 544576 [details] [diff] [review]
Move more windows.h handling to jswin.h

Review of attachment 544576 [details] [diff] [review]:
-----------------------------------------------------------------
Attachment #544576 - Flags: review?(jwalden+bmo) → review+
http://hg.mozilla.org/integration/mozilla-inbound/rev/4d7f75359cc4
Assignee: general → sphink
Status: NEW → ASSIGNED
Whiteboard: [inbound]
http://hg.mozilla.org/mozilla-central/rev/4d7f75359cc4
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla8
You need to log in before you can comment on or make changes to this bug.