[LLVMbugs] [Bug 14968] New: -Wunused-value should not warn about unused constant expanded from a macro
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Jan 16 10:53:15 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=14968
Bug #: 14968
Summary: -Wunused-value should not warn about unused constant
expanded from a macro
Product: clang
Version: 3.2
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: john at keeping.me.uk
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
In Git's source code, the following pattern is used to "Let callers be aware of
the constant return value; this can help gcc with -Wuninitialized analysis.":
int foo(int a);
#define foo(a) (foo(a), 1);
void bar(int a) {
foo(a);
}
With clang, this causes warnings of the form:
test.c:5:3: warning: expression result unused [-Wunused-value]
foo(a);
^~~~~~
test.c:2:28: note: expanded from macro 'foo'
#define foo(a) (foo(a), 1);
^
This seems similar to bug 13747, so is this considered to be a bug in clang or
is it a case of "don't do that"?
--
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