[squid-dev] [PATCH] g++ -Woverloaded-virtual
Alex Rousskov
rousskov at measurement-factory.com
Sat Mar 12 06:41:04 UTC 2016
Hello,
I accidentally discovered that Squid does not use
-Woverloaded-virtual when compiled with GCC. I found that warning useful
in other projects. Enabling it for Squid exposes one bug-in-the-making:
It looks like an 3rd Ftp::Relay::failed() argument was forgotten. The
attached patch enables the warning and probably fixes Ftp::Relay::failed().
Do we want to add this warning?
Disclaimer: The Ftp::Relay::failed() fix is correct from removing the
warning point of view, but I have not checked whether the patched code
handles non-nil ftpErr correctly. AFAICT, this method is never called
with non-nil ftpErr today, but that may change.
Thank you,
Alex.
P.S. Here is GCC's documentation for this warning, but I think its
primary value in Squid context is in detecting unintended, hidden
changes in method profiles, not avoiding compilation errors:
> -Woverloaded-virtual (C++ and Objective-C++ only)
> Warn when a function declaration hides virtual functions from a
> base class. For example, in:
>
> struct A {
> virtual void f();
> };
>
> struct B: public A {
> void f(int);
> };
>
> the "A" class version of "f" is hidden in "B", and code like:
>
> B* b;
> b->f();
>
> fails to compile.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: overloaded-virtual-t1.patch
Type: text/x-diff
Size: 5263 bytes
Desc: not available
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20160311/a3f279ca/attachment.patch>
More information about the squid-dev
mailing list