[LLVMbugs] [Bug 10111] New: nonnull attribute generates a warning for transparent unions
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jun 9 08:24:07 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10111
Summary: nonnull attribute generates a warning for transparent
unions
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: tim.nieradzik at gmx.de
CC: llvmbugs at cs.uiuc.edu
typedef struct {
char *str;
} Class;
typedef union {
Class *object;
} Instance __attribute__((transparent_union));
__attribute__((nonnull(1))) void Class_init(Instance this, char *str) {
this.object->str = str;
}
int main(void) {
Class obj;
Class_init(0, "Hello World");
}
Clang reports: "nonnull attribute only applies to pointer arguments". However,
as transparent unions are guaranteed to contain only pointers, using nonnull is
safe.
--
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