http://llvm.org/bugs/show_bug.cgi?id=8752
Summary: Clang -Wunused should warn on unusable (member)
functions.
Product: new-bugs
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: new bugs
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
-Wunused (or -Wunused-function) should produce warnings for (member) functions
that can't possibly be used, for instance because their return value or one of
their parameters (including 'this') contains a class type declared in an
anonymous namespace. (extern "C" functions should probably be exempt)
Some examples:
=====
// From some .h file.
class Bar {
public:
virtual void frob();
};
// From some .cpp file.
namespace {
// Because Foo is in an anonymous namespace, newly-introduced members
// can't be used from different translation units.
class Foo : public Bar {
virtual void frob() {
// May be used externally.
}
int quux() {
// Unused, but doesn't produce warning.
return 1;
}
static int baz() {
// Unused, but doesn't produce warning.
return 2;
}
};
// Unused, produces warning.
Bar* getAnonNSBar() { return new Foo; }
}
// Unused, produces warning.
static Bar* getStaticBar() { return new Foo; }
// Unused, but doesn't produce warning.
Foo* getFoo() { return new Foo; }
// May be used externally.
Bar* getBar() { return new Foo; }
=====
--
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs