Closed Bug 1167834 Opened 5 years ago Closed 5 years ago

widget/cocoa/nsCocoaDebugUtils.mm:151:21 [-Wwritable-strings] ISO C++11 does not allow conversion from string literal to 'char *'

Categories

(Core :: Widget: Cocoa, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox39 --- unaffected
firefox40 --- wontfix
firefox41 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

clang warns about assigning string constant "unknown" to a non-const char pointer:

widget/cocoa/nsCocoaDebugUtils.mm:151:21 [-Wwritable-strings] ISO C++11 does not allow conversion from string literal to 'char *'
widget/cocoa/nsCocoaDebugUtils.mm:152:25 [-Wwritable-strings] ISO C++11 does not allow conversion from string literal to 'char *'

However, these string pointers can't be made const because (C++'s but not C's!) free() requires a non-const pointer parameter. This patch removes the stringsNeedRelease flag and saves the malloc'd strings, if any, in dedicated non-const pointers.
Attachment #8609718 - Flags: review?(spohl.mozilla.bugs)
Comment on attachment 8609718 [details] [diff] [review]
Wwritable-strings_nsCocoaDebugUtils.patch

Forwarding review request to get faster turnaround on this during my PTO.
Attachment #8609718 - Flags: review?(spohl.mozilla.bugs) → review?(smichaud)
Comment on attachment 8609718 [details] [diff] [review]
Wwritable-strings_nsCocoaDebugUtils.patch

Looks fine to me.  Thanks for the fix.
Attachment #8609718 - Flags: review?(smichaud) → review+
https://hg.mozilla.org/mozilla-central/rev/c7b2ecf508e6
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.