[LLVMbugs] [Bug 17238] New: clang++, -Wno-Unused-private-field, and field used in constructor initializer

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 13 13:07:24 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17238

            Bug ID: 17238
           Summary: clang++, -Wno-Unused-private-field, and field used in
                    constructor initializer
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: noloader at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

I'm attempting to build Squid using Clang to get analysis tools on the program.
The program configures with -Werror, which should not be a problem.

$ cd squid-3.3.9
$ ./configure --prefix=/usr/local/squid
$ make all CXX='/usr/local/bin/clang++ -fsanitize=address -fsanitize=undefined
-fno-sanitize=vptr' 
...

libtool: compile:  /usr/local/bin/clang++ -fsanitize=address
-fsanitize=undefined -fno-sanitize=vptr -DHAVE_CONFIG_H -I../.. -I../../include
-I../../lib -I../../src -I../../include -I/opt/local/include
-I/opt/local/include -I../../libltdl -I/opt/local/include -I/opt/local/include
-Wall -Wpointer-arith -Wwrite-strings -Wcomments -Werror -pipe -D_REENTRANT -g
-O2 -MT Intercept.lo -MD -MP -MF .deps/Intercept.Tpo -c Intercept.cc 
-fno-common -DPIC -o .libs/Intercept.o
In file included from Intercept.cc:35:
../../src/ip/Intercept.h:146:12: error: private field 'lastReported_' is not
      used [-Werror,-Wunused-private-field]
    time_t lastReported_; /**< Time of last error report. Throttles NAT ...
           ^
1 error generated.
make[3]: *** [Intercept.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

When I examine Intercept.h, the constructor initializes the filed, so it
appears the variable is used:

    Intercept() : transparentActive_(0), interceptActive_(0), lastReported_(0)
{};

Additionally, specifying -Wno-unused-private-field does not suppress the
warning

I found I can work around with:

    Intercept() : transparentActive_(0), interceptActive_(0), lastReported_(0)
{ (void)lastReported_; };

However, it appears this one-off solution does not scale since there's lots of
these problems.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130913/620fe698/attachment.html>


More information about the llvm-bugs mailing list