If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

compiler spam: bug 374336 added 139 instances of warning "nsIdentityChecking.cpp:418: warning: deprecated conversion from string constant to ‘char*’"

RESOLVED FIXED

Status

()

Core
Security: PSM
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: dholbert, Assigned: kaie)

Tracking

Trunk
x86
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [build_warning])

Attachments

(1 attachment)

(Reporter)

Description

8 years ago
As mentioned in bug 374336 comment 42, that bug's patch removed some 'const' keywords and subsequently triggered 139 new g++ compiler warnings, all of the form:
> nsIdentityChecking.cpp:418: warning: deprecated conversion from string constant
to ‘char*’

I'm filing this bug on fixing those warnings, for reduced compiler-spam.
(Reporter)

Comment 1

8 years ago
Created attachment 382933 [details] [diff] [review]
fix: restore const-ness, and cast it away for 'free' call

Note that in bug 374336, the 'const' keyword was removed in response to a suggestion in bug 374336 comment 30, because the newly-introduced free() calls expect a 'void*' argument (rather than a 'const void*').

I'm attaching a patch that restores the const keyword, and works around the 'free()' issue by using const_cast to remove the 'const' solely for the 'free' calls.

IMHO this is a cleaner solution than the existing situation. The idea here is this:
 - At the superclass level (for "struct nsMyTrustedEVInfo"), our char-pointers may be pointing to mutable or immutable memory, so it's safest & most correct to make them "const".
 - In the subclass ("class nsMyTrustedEVInfoClass : public nsMyTrustedEVInfo"), we know that all of its instances will have char-pointers directed at mutable (heap-allocated) memory, so we can allow ourselves to explicitly cast away the constness when we need to. (in just one place -- the destructor)
Attachment #382933 - Flags: review?(neil)
I love reducing compiler spam - is there a reason you didn't tag kaie for the review, since he wrote the orginal code, iinm?

Updated

8 years ago
Attachment #382933 - Flags: review?(neil) → review+

Comment 3

8 years ago
Comment on attachment 382933 [details] [diff] [review]
fix: restore const-ness, and cast it away for 'free' call

I am not a PSM peer, but I agree that this seems the simplest solution.
(Reporter)

Comment 4

8 years ago
Comment on attachment 382933 [details] [diff] [review]
fix: restore const-ness, and cast it away for 'free' call

> is there a reason you didn't tag kaie for the
> review, since he wrote the orginal code, iinm?

No, no good reasons. :) (It was late, and I tagged neil because wrote bug 374336 comment 30 and posted the final copy of the patch on that bug.)

Thanks for the suggestion -- tagging kaie for additional review.
Attachment #382933 - Flags: review?(kaie)
(Assignee)

Updated

8 years ago
Attachment #382933 - Flags: review?(kaie) → review+
(Reporter)

Comment 5

8 years ago
Patch pushed to mozilla-central:
http://hg.mozilla.org/mozilla-central/rev/f7e29a820cc0
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
(Reporter)

Updated

8 years ago
Whiteboard: [build_warning]
You need to log in before you can comment on or make changes to this bug.