<div dir="ltr">That's an interesting case. I'll tweak the warning to diagnose this scenario better today.</div><div class="gmail_extra"><br><div class="gmail_quote">On 29 July 2017 at 00:56, Hans Wennborg <span dir="ltr"><<a href="mailto:hans@chromium.org" target="_blank">hans@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Fri, Jul 28, 2017 at 7:41 AM, Alex Lorenz via cfe-commits<br>
<<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br>
> Author: arphaman<br>
> Date: Fri Jul 28 07:41:21 2017<br>
> New Revision: 309386<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=309386&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=309386&view=rev</a><br>
> Log:<br>
> Recommit r308327 3rd time: Add a warning for missing<br>
> '#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files<br>
><br>
> The second recommit (r309106) was reverted because the "non-default #pragma<br>
> pack value chages the alignment of struct or union members in the included file"<br>
> warning proved to be too aggressive for external projects like Chromium<br>
> (<a href="https://bugs.chromium.org/p/chromium/issues/detail?id=749197" rel="noreferrer" target="_blank">https://bugs.chromium.org/p/<wbr>chromium/issues/detail?id=<wbr>749197</a>). This recommit<br>
> makes the problematic warning a non-default one, and gives it the<br>
> -Wpragma-pack-suspicious-<wbr>include warning option.<br>
><br>
> The first recommit (r308441) caused a "non-default #pragma pack value might<br>
> change the alignment of struct or union members in the included file" warning<br>
> in LLVM itself. This recommit tweaks the added warning to avoid warnings for<br>
> #includes that don't have any records that are affected by the non-default<br>
> alignment. This tweak avoids the previously emitted warning in LLVM.<br>
><br>
> Original message:<br>
><br>
> This commit adds a new -Wpragma-pack warning. It warns in the following cases:<br>
><br>
> - When a translation unit is missing terminating #pragma pack (pop) directives.<br>
> - When entering an included file if the current alignment value as determined<br>
>   by '#pragma pack' directives is different from the default alignment value.<br>
> - When leaving an included file that changed the state of the current alignment<br>
>   value.<br>
><br>
> rdar://10184173<br>
><br>
> Differential Revision: <a href="https://reviews.llvm.org/D35484" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D35484</a><br>
<br>
</div></div>We did get warnings with this version too, but this time it looks like<br>
a real bug :-)<br>
<br>
C:\b\c\builder\ClangToTWin_<wbr>dll_\src\third_party\usrsctp\<wbr>usrsctplib\usrsctplib\netinet\<wbr>sctp.h(51,9):<br>
 error: unterminated '#pragma pack (push, ...)' at end of file<br>
[-Werror,-Wpragma-pack]<br>
<br>
The interesting thing is that the file does reset the alignment, but<br>
it does it with a "#pragma pack()" which doesn't pop the stack, but<br>
just resets to the default value.<br>
<br>
It might be worth tweaking the warning to give a better message for<br>
this. A "#pragma pack(push, ..)" followed by "#pragma pack()" seems<br>
pretty dodgy since there's no point in pushing if the code isn't going<br>
to pop.<br>
</blockquote></div><br></div>