[LLVMbugs] [Bug 4700] New: "operation has no effect" for macros that expand to 0 << 1
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Sat Aug 8 11:24:59 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=4700
Summary: "operation has no effect" for macros that expand to 0 <<
1
Product: clang
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Semantic Analyzer
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: ssen at apple.com
CC: llvmbugs at cs.uiuc.edu
llvm/clang r78480
The following is typical for code that generates enums or error codes where the
top bits are a subsystem ID and the low bits are an individual error code:
[ssen at virgon]$ cat foo.c
#define errcode(x, y) (x << 16 | y)
int a = errcode(0, 0);
int b = errcode(1, 0);
[ssen at virgon]$ clang -c foo.c -Wall
foo.c:2:9: warning: operation has no effect [-Wall]
int a = errcode(0, 0);
^~~~~~~~~~~~~
foo.c:1:26: note: instantiated from:
#define errcode(x, y) (x << 16 | y)
^ ~~
1 diagnostic generated.
[ssen at virgon]$
This code should not warn. It's expected behavior that sometimes there will be
0 in the top bits.
--
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