[LLVMbugs] [Bug 13413] New: -Wunused-private-field doesn't flag fields initialized to NULL

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 19 18:29:28 PDT 2012


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

             Bug #: 13413
           Summary: -Wunused-private-field doesn't flag fields initialized
                    to NULL
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nicolasweber at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


noname:Release thakis$ cat test.cc
#include <stddef.h>
class A {
  A() : p_(NULL) {}
  void* p_;
};
noname:Release thakis$ ../../third_party/llvm-build/Release+Asserts/bin/clang
-c test.cc -Wall
# Note: No warning

# Now with 0 instead of NULL:
noname:Release thakis$ cat test.cc
#include <stddef.h>
class A {
  A() : p_(0) {}
  void* p_;
};
noname:Release thakis$ ../../third_party/llvm-build/Release+Asserts/bin/clang
-c test.cc -Wall
test.cc:4:9: warning: private field 'p_' is not used [-Wunused-private-field]
  void* p_;
        ^
1 warning generated.


NULL expands to __null, which -Wunused-private-field probably doesn't recognize
as side-effect free.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list