Closed Bug 1026129 Opened 10 years ago Closed 10 years ago

Replace some manual declarations of MSVC intrinsics with #include <intrin.h>

Categories

(NSPR :: NSPR, defect, P2)

All
Windows 7
defect

Tracking

(Not tracked)

RESOLVED FIXED
4.10.7

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

Details

Attachments

(1 file)

      No description provided.
We need this because clang-cl maps these intirnsics to LLVM ones in its own intrin.h header, so trying to link against calls to those functions with clang-cl would fail with linking errors.
Assignee: nobody → ehsan
Blocks: winclang
Component: General → NSPR
Product: Core → NSPR
Version: unspecified → other
Attachment #8440912 - Flags: review?(wtc)
Comment on attachment 8440912 [details] [diff] [review]
Replace some manual declarations of MSVC intrinsics with #include <intrin.h>

Requesting review from Ted as well in case he can review this sooner.  I'd like to get this landed sooner than later.
Attachment #8440912 - Flags: review?(ted)
Ping?
Comment on attachment 8440912 [details] [diff] [review]
Replace some manual declarations of MSVC intrinsics with #include <intrin.h>

Review of attachment 8440912 [details] [diff] [review]:
-----------------------------------------------------------------

r=wtc. Sorry about the delay.

Patch checked in: https://hg.mozilla.org/projects/nspr/rev/ce8a360b2f8f

There was a reason why we declared the intrinsic functions manually, but
I don't remember why. I suspect the most likely reason was that MinGW or
older versions of MSVC don't have the <intrin.h> header.

I just did some research and found that Visual Studio .NET 2003 doesn't
have <intrin.h>. Its example code for _InterlockedDecrement says:
http://msdn.microsoft.com/en-us/library/f24ya7ct(v=vs.71).aspx

// To declare an interlocked function for use as an intrinsic,
// First, the function must be declared with the leading underscore.
// Second, the new function must appear in a #pragma intrinsic statement.

In contrast, the example code for _InterlockedDecrement in Visual Studio
2005 says:
http://msdn.microsoft.com/en-us/library/f24ya7ct(v=vs.80).aspx

// To declare an interlocked function for use as an intrinsic,
// include intrin.h and put the function in a #pragma intrinsic 
// statement.
Attachment #8440912 - Flags: review?(wtc)
Attachment #8440912 - Flags: review+
Attachment #8440912 - Flags: checked-in+
Patch pushed to mozilla-inbound:
https://hg.mozilla.org/integration/mozilla-inbound/rev/b8ed1bc7528b
Status: NEW → ASSIGNED
OS: All → Windows 7
Priority: -- → P2
Target Milestone: --- → 4.10.7
Comment on attachment 8440912 [details] [diff] [review]
Replace some manual declarations of MSVC intrinsics with #include <intrin.h>

Thanks, Wan-Teh!
Attachment #8440912 - Flags: review?(ted)
https://hg.mozilla.org/mozilla-central/rev/b8ed1bc7528b
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: