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)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: dholbert, Assigned: boris)

References

Details

Attachments

(1 file, 2 obsolete files)

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 (?)
Assignee: nobody → mtseng
Blocks: LayerScope
Assignee: mtseng → boris.chiou
Status: NEW → ASSIGNED
(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[]".
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
Attachment #8451287 - Flags: review?(dglastonbury)
Attachment #8451287 - Flags: review?(dglastonbury) → review+
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
nsAutoPtr can now be replaced by mozilla::UniquePtr
(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. :)
(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.
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
(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.
Blocks: 1030922
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: