Re: Warning at SLES build? What is the meaning of the Warning??

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Mon, 21 Apr 2014 22:50:40 -0600

On 04/21/2014 04:45 PM, Eliezer Croitoru wrote:

> Inquirer.cc:90: warning: 'auto_ptr' is deprecated (declared at
> /usr/include/c++/4.3/backward/auto_ptr.h:91)

> So first, What is the warning about and do you think we need to do
> something about it?

I think this deprecation warning is just like any other deprecation
warning: Some language or library feature may be going away in the
future and should not be used in new code.

Squid uses std::auto_ptr to avoid leaking local objects and to cleanup
global objects. We should rewrite the offending code to remove the
deprecated feature or make it conditional on the deprecated build
environment. Mgr::Inquirer::start() in trunk has a [poor] example of how
that can be done.

A better approach, IMO, would be to #define a single name (e.g.,
unique_pointer or squid_unique_ptr) that regular code can portably use
without the #if/#else/#endif noise.

An alternative approach would be to enhance Squid's own TidyPointer to
work with classes that use "delete" as a cleanup mechanism(**) and use
TidyPointer instead of std::auto_ptr. This approach would avoid alleged
GCC bugs that the #define unique_pointer solution above may hit:
https://groups.google.com/d/msg/comp.lang.c++.moderated/wQoM8nxyiLA/ktDB4SgxmtcJ

If you can write and test a patch to solve this problem, please post it
here as usual.

Thank you,

Alex.
(**) That mechanism can even become the default (there is currently no
default for the second TidyPointer template parameter), but that is a
separate question/decision.
Received on Tue Apr 22 2014 - 04:51:08 MDT

This archive was generated by hypermail 2.2.0 : Tue Apr 22 2014 - 12:00:14 MDT