[LLVMbugs] [Bug 9824] New: add -Wunused-but-set-variable
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun May 1 18:59:50 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9824
Summary: add -Wunused-but-set-variable
Product: clang
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: nicholas at mxc.ca
CC: llvmbugs at cs.uiuc.edu
GCC 4.6 has a nice warning part of -Wall which warns on variables that are used
by being set, but never read or have their address taken. We should add
-Wunused-but-set-variable to clang.
Here's a few examples of how the warning behaves in GCC:
void test1() {
int i = 0; // -Wunused-but-set-variable warning
i = 1;
}
void test2() {
int i = 0; // no warning
i = 1;
&i; // -Wunused-value warning
}
void test3() {
int i = 1; // -Wunused-variable warning, not -Wunused-but-set-variable.
}
void use(int);
void test4() {
int i = 0; // no warning
use1(i);
}
which seems eminently sane to me.
--
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