<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW " title="NEW --- - -Wmissing-braces warns on braces missing in initializers expanded from macros in system headers" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24007&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=Yatrx_U49GtbepEgnA6YhlV5RtC5evksOLQYyVBnAxA&s=RyjwMA_QlZ3IuaxcVq3V08EVk5kjaY3-aeuhcEaTq_I&e=">24007</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-Wmissing-braces warns on braces missing in initializers expanded from macros in system headers
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>