Closed
Bug 991227
Opened 11 years ago
Closed 11 years ago
clang 3.5 build warning: gfx/layers/LayerScope.cpp:460:35: warning: 'auto_ptr' is deprecated [-Wdeprecated-declarations]
Categories
(Core :: Graphics: Layers, defect)
Tracking
()
RESOLVED
FIXED
mozilla33
People
(Reporter: dholbert, Assigned: boris)
References
Details
Attachments
(1 file, 2 obsolete files)
3.43 KB,
patch
|
u480271
:
review+
|
Details | Diff | Splinter Review |
Build warning, with clang 3.5:
gfx/layers/LayerScope.cpp:460:35: warning: 'auto_ptr' is deprecated [-Wdeprecated-declarations]
Some googling for "auto_ptr" and "deprecated" confirms that it indeed is deprecated in favor of C++11 unique_ptr. e.g.:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1856.html#20.4.5%20-%20Class%20template%20auto_ptr
Anyway -- auto_ptr is deprecated, and unique_ptr probably isn't avaiable everywhere yet, so I suspect we should be using nsAutoPtr here (?)
Blocks: LayerScope
Assignee | ||
Updated•11 years ago
|
Assignee: mtseng → boris.chiou
Assignee | ||
Updated•11 years ago
|
Status: NEW → ASSIGNED
Comment hidden (obsolete) |
Assignee | ||
Comment 2•11 years ago
|
||
(In reply to Boris Chiou [:boris] from comment #1)
> Created attachment 8445711 [details] [diff] [review]
> [WIP] Replace std::auto_ptr with nsAutoPtr in LayerScope (v1)
>
> std::auto_ptr causes clang 3.5 build warnings because we shouldn't use
> std::auto_ptr in C++ 11 anymore. auto_ptr is deprecated in clang 3.5.
> Therefore I replaced all the std::auto_ptrs in LayerScope.cpp.
I found a problem. We shouldn't use auto_ptr<> or nsAutoPtr<> with moz_malloc() because the destructor of nsAutoPtr/auto_ptr calls "delete", not "free()", so I will upload a patch to use nsAutoArrayPtr<> and "new char[]".
Comment hidden (obsolete) |
Assignee | ||
Comment 4•11 years ago
|
||
std::auto_ptr causes clang 3.5 build warnings because we shouldn't use
std::auto_ptr in C++ 11 anymore. auto_ptr is deprecated in clang 3.5.
Therefore I replaced all the std::auto_ptrs in LayerScope.cpp.
Note: nsAuto(Array)Ptr should use "new" operator in C++, instead of
moz_malloc() because the destructor of nsAuto(Array)Ptr will call
delete(delete []).
try result:
https://tbpl.mozilla.org/?tree=Try&rev=9aad4d949d9e
Attachment #8448516 -
Attachment is obsolete: true
Assignee | ||
Updated•11 years ago
|
Attachment #8451287 -
Flags: review?(dglastonbury)
Attachment #8451287 -
Flags: review?(dglastonbury) → review+
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 5•11 years ago
|
||
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
Comment 7•11 years ago
|
||
nsAutoPtr can now be replaced by mozilla::UniquePtr
Assignee | ||
Comment 8•11 years ago
|
||
(In reply to Jeff Muizelaar [:jrmuizel] from comment #7)
> nsAutoPtr can now be replaced by mozilla::UniquePtr
Great! Thanks for your comment, Jeff. I will replace them in other bug. :)
Assignee | ||
Comment 9•11 years ago
|
||
(In reply to Boris Chiou [:boris] from comment #8)
> (In reply to Jeff Muizelaar [:jrmuizel] from comment #7)
> > nsAutoPtr can now be replaced by mozilla::UniquePtr
>
> Great! Thanks for your comment, Jeff. I will replace them in other bug. :)
By the way, Do you have any reference link? I cannot find mozilla::UniquePtr or mozilla:unique_ptr in dxr right now. Thanks.
Comment 10•11 years ago
|
||
It looks like dxr hasn't been updated yet.
Take a look at http://hg.mozilla.org/mozilla-central/file/75f66f8cb99f/mfbt/UniquePtr.h
The semantics should be basically the same as std::unique_ptr
Assignee | ||
Comment 11•11 years ago
|
||
(In reply to Jeff Muizelaar [:jrmuizel] from comment #10)
> It looks like dxr hasn't been updated yet.
>
> Take a look at
> http://hg.mozilla.org/mozilla-central/file/75f66f8cb99f/mfbt/UniquePtr.h
>
> The semantics should be basically the same as std::unique_ptr
So cool. Thank you very much. It's really a good news.
You need to log in
before you can comment on or make changes to this bug.
Description
•