Closed Bug 1201628 Opened 11 years ago Closed 5 years ago

Define MOZ_WARN_UNUSED_RESULT in MSVC

Categories

(Core :: MFBT, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: mccr8, Unassigned)

Details

(Keywords: sec-audit, sec-want)

Attachments

(1 file)

Apparently MSVC has had this _Check_return_ thing since MSVC 2012 [1]. I'll try and see how it works. I don't have MSVC running locally so this may get painful fast, but I'll try at least a few pushes. I've hidden this for now because it may reveal security issues in Windows-specific code. http://stackoverflow.com/questions/4226308/msvc-equivalent-of-attribute-warn-unused-result
froydnj points out that the MSVC version requires annotating both the declaration and definition, according to that Stack Overflow answer, so this may not really be viable for us.
The good news is that my try run is green. The bad news is that I think it shouldn't be. I'll try adding another intentional failure and see if that does anything. try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=26fb7e857b90
It sounds like maybe you have to run a different tool to get it to actually do something with these annotations, but I'm not entirely sure.
(In reply to Andrew McCreight [:mccr8] from comment #3) > It sounds like maybe you have to run a different tool to get it to actually > do something with these annotations, but I'm not entirely sure. You need to run the compiler with -analyze. It would be interesting to run things with -analyze as-is (I think some of the Windows headers are appropriately annotated) and see if anything turns up.
njn, I see you are on a bit of a warnings kick recently, and are messing with Windows, so I'm assuming you have a local way to build Windows. You may (or may not...) be interested in looking into seeing what this would turn up.
Flags: needinfo?(n.nethercote)
(In reply to Andrew McCreight [:mccr8] from comment #5) > njn, I see you are on a bit of a warnings kick recently, and are messing > with Windows, so I'm assuming you have a local way to build Windows. I have a VirtualBox VM running Windows 8.1 on my Linux box. It was surprisingly easy to set up. You should totally try it sometime :) I might take a look at this if I find some time, but I won't make any promises.
Flags: needinfo?(n.nethercote)
Group: core-security → dom-core-security

MSVC is no longer supported.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → INVALID
Group: dom-core-security
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: