Closed Bug 155666 Opened 24 years ago Closed 24 years ago

[PATCH] nscore.h has unreachable MSVC #defines (mutually exclusive nested #if)

Categories

(Core :: XPCOM, defect)

x86
Other
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: timwatt, Assigned: dougt)

References

Details

Attachments

(1 file, 2 obsolete files)

This is from CVS trunk: http://lxr.mozilla.org/seamonkey/source/xpcom/base/nscore.h#195 contains the following block: 186 #if defined(_MSC_VER) && (_MSC_VER>=1100) (... still within 186's #if) 195 #if (_MSC_VER<1100) (...) 198 #elif (_MSC_VER==1100) (...) 206 #endif Obviously, the block from 195 to 197 (which #undefs a symbol) is impossible to reach in any circumstance (barring a broken preprocessor). I'm not 100% sure XPCOM is the right place for this; it seems like it could also go in Build Config.
Attached patch Patch to correct the problem (obsolete) — Splinter Review
Keywords: patch
*** Bug 155665 has been marked as a duplicate of this bug. ***
Summary: nscore.h has unreachable MSVC #defines (mutually exclusive nested #if) → [PATCH] nscore.h has unreachable MSVC #defines (mutually exclusive nested #if)
The only thing that's going to define HAVE_CPP_EXPLICIT for windows is the code just a few lines above, so why isn't it sufficient to just remove the four lines: #if (_MSC_VER<1100) /* before 5.0, VC++ couldn't handle explicit */ #undef HAVE_CPP_EXPLICIT #elif (_MSC_VER==1100) and replace with: #if (_MSC_VER==1100) ? Not that we support building on MSVC before 5.0 anyway...
Attached patch Reduced patch (obsolete) — Splinter Review
This patch reduces the changes to the original code while achieving the same effect.
Attachment #90123 - Attachment is obsolete: true
I didn't reload the bug until after posting my last patch, so I didn't see dbaron's comment.
Attachment #90253 - Attachment is obsolete: true
Comment on attachment 90254 [details] [diff] [review] Patch addressing dbaron's comments This patch seems fine with me, although: * dougt should review * I question whether it's worth bothering causing everyone a full rebuild, so if you land it, please land it the same time someone else triggers a full rebuild.
Comment on attachment 90254 [details] [diff] [review] Patch addressing dbaron's comments Add a better comment similar to what is done here: http://lxr.mozilla.org/seamonkey/source/configure.in#2351 Make sure scc also review or sr's this.
Attachment #90254 - Flags: review+
I'm not sure I understand what I'm supposed to be commenting. The change removes code that is impossible to reach. Additionally, it is redundant because HAVE_CPP_EXPLICIT would only be #defined in the situation where _MSC_VER>=1100, in which case _MSC_VER would not be <1100. If _MSC_VER were <1100, it would have never entered the block where HAVE_CPP_EXPLICIT was defined. If you're asking me to comment as to why we don't define HAVE_CPP_EXPLICIT if _MSC_VER<1100, I have no idea. I don't know of the peculiarities of the various versions of VC++.
Comment on attachment 90254 [details] [diff] [review] Patch addressing dbaron's comments yeah, it's unreachable. This patch gives the functionally reachable equivalent. sr=scc
Attachment #90254 - Flags: superreview+
Comment on attachment 90254 [details] [diff] [review] Patch addressing dbaron's comments a=asa (on behalf of drivers) for checkin to the 1.1 trunk.
Attachment #90254 - Flags: approval+
Fixed. Checking in nscore.h; /cvsroot/mozilla/xpcom/base/nscore.h,v <-- nscore.h new revision: 1.51; previous revision: 1.50 done Thanks all.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: