Closed Bug 989676 Opened 6 years ago Closed 6 years ago

nsCookieService.h:75:15: error: 'const' qualifier on reference type 'KeyType' (aka 'const nsCookieKey &') has no effect [-Werror,-Wignored-qualifiers]

Categories

(Core :: Networking, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Build warning in clang 3.5 (treated as an error in builds with --enable-warnings-as-errors):
{
netwerk/cookie/nsCookieService.h:75:15: error: 'const' qualifier on reference type 'KeyType' (aka 'const nsCookieKey &') has no effect [-Werror,-Wignored-qualifiers]
}

Code snippet:
57   typedef const nsCookieKey& KeyType;
58   typedef const nsCookieKey* KeyTypePointer;
[...]
69   nsCookieKey(const KeyTypePointer other)
[...]
75   nsCookieKey(const KeyType other)
http://mxr.mozilla.org/mozilla-central/source/netwerk/cookie/nsCookieService.h#57

The "const" in the constructor signatures there is redundant.
Blocks: buildwarning
(Looks like this code was added in
 http://hg.mozilla.org/mozilla-central/rev/156bdf05dd97#l9.15
for bug 756648)
Depends on: 756648
Attached patch drops the redundant 'const' qualifiers.

(I'm actually not 100% sure whether the 'const' is technically redundant in the "const KeyTypePointer" one -- I didn't get a build warning for that one, at least. So I think the const qualifier there is making the *pointer* const, which isn't really useful anyway in this context (it's not protecting anything), so no harm in removing it for consistency.)
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #8399040 - Flags: review?(jduell.mcbugs)
(Patch has extra-large context to include the typedefs at the top, to demonstrate that the typedefs already include 'const' labels.)
Comment on attachment 8399040 [details] [diff] [review]
fix v1: drop redundant 'const' qualifiers

Actually, looks like Jason might be out this week. Tagging hurley instead.
Attachment #8399040 - Flags: review?(jduell.mcbugs) → review?(hurley)
Comment on attachment 8399040 [details] [diff] [review]
fix v1: drop redundant 'const' qualifiers

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

const const const
Attachment #8399040 - Flags: review?(hurley) → review+
https://hg.mozilla.org/mozilla-central/rev/f2d191e24dbf
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.