[LLVMbugs] [Bug 24007] New: -Wmissing-braces warns on braces missing in initializers expanded from macros in system headers
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Jul 1 08:09:54 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=24007
Bug ID: 24007
Summary: -Wmissing-braces warns on braces missing in
initializers expanded from macros in system headers
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: nicolasweber at gmx.de
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Consider:
$ cat foo/a.h
#define REGISTRY_EXTENSION_GUID { 0x35378eac, 0x683f, 0x11d2, 0xa8, 0x9a, 0x00,
0xc0, 0x4f, 0xbb, 0xcf, 0xa2 }
$ cat test.cc
#include "a.h"
typedef struct _GUID {
unsigned Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
void f() {
GUID g = REGISTRY_EXTENSION_GUID;
}
$ bin/clang test.cc -c -isystem foo -Wall
test.cc:11:12: warning: suggest braces around initialization of subobject
[-Wmissing-braces]
GUID g = REGISTRY_EXTENSION_GUID;
^~~~~~~~~~~~~~~~~~~~~~~
foo/a.h:1:63: note: expanded from macro 'REGISTRY_EXTENSION_GUID'
#define REGISTRY_EXTENSION_GUID { 0x35378eac, 0x683f, 0x11d2, 0xa8, 0x9a, 0x00,
0xc0, 0x4f, 0xbb, 0xcf, 0xa2 }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.cc:11:8: warning: unused variable 'g' [-Wunused-variable]
GUID g = REGISTRY_EXTENSION_GUID;
^
2 warnings generated.
In real life, REGISTRY_EXTENSION_GUID comes from some Windows header, so
there's nothing the user can do about this. The warning shouldn't fire if the
rhs is a macro from a system header.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150701/4219ae61/attachment.html>
More information about the llvm-bugs
mailing list