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

RESOLVED FIXED in 4.10.7

Status

NSPR
NSPR
P2
normal
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: Ehsan, Assigned: Ehsan)

Tracking

other
4.10.7
All
Windows 7

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Comment hidden (empty)
(Assignee)

Comment 1

4 years ago
Created attachment 8440912 [details] [diff] [review]
Replace some manual declarations of MSVC intrinsics with #include <intrin.h>
(Assignee)

Comment 2

4 years ago
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: 752004
Component: General → NSPR
Product: Core → NSPR
Version: unspecified → other
(Assignee)

Updated

4 years ago
Attachment #8440912 - Flags: review?(wtc)
(Assignee)

Comment 3

4 years ago
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)
(Assignee)

Comment 4

4 years ago
Ping?

Comment 5

4 years ago
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+

Comment 6

4 years ago
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
(Assignee)

Comment 7

4 years ago
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
Last Resolved: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.