r308441 - Recommit r308327: Add a warning for missing '#pragma pack (pop)'

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 19 05:31:48 PDT 2017


On Wed, Jul 19, 2017 at 2:26 PM, Hans Wennborg <hans at chromium.org> wrote:
> On Wed, Jul 19, 2017 at 1:30 PM, Alex Lorenz via cfe-commits
> <cfe-commits at lists.llvm.org> wrote:
>> Author: arphaman
>> Date: Wed Jul 19 04:30:41 2017
>> New Revision: 308441
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=308441&view=rev
>> Log:
>> Recommit r308327: Add a warning for missing '#pragma pack (pop)'
>> and suspicious uses of '#pragma pack' in included files
>>
>> This commit adds a new -Wpragma-pack warning. It warns in the following cases:
>>
>> - When a translation unit is missing terminating #pragma pack (pop) directives.
>> - When entering an included file if the current alignment value as determined
>>   by '#pragma pack' directives is different from the default alignment value.
>> - When leaving an included file that changed the state of the current alignment
>>   value.
>>
>> rdar://10184173
>>
>> Differential Revision: https://reviews.llvm.org/D35484
>
> This buildbot is unhappy:
> http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/2963
>
> From the build log:
>
> [ 67%] Building CXX object
> lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o
> In file included from
> /mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp:15:
> In file included from
> /mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/include/llvm/ProfileData/Coverage/CoverageMappingWriter.h:20:
> /mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h:517:10:
> error: non-default #pragma pack value might change the alignment of
> struct or union members in the included file [-Werror,-Wpragma-pack]
> #include "llvm/ProfileData/InstrProfData.inc"
>          ^
> /mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h:513:1:
> note: previous '#pragma pack' directive that modifies alignment is
> here
> LLVM_PACKED_START
> ^
> /mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/include/llvm/Support/Compiler.h:349:28:
> note: expanded from macro 'LLVM_PACKED_START'
> # define LLVM_PACKED_START _Pragma("pack(push, 1)")
>                            ^
> <scratch space>:14:2: note: expanded from here
>  pack(push, 1)
>  ^

I've reverted in r308455 in the meantime.


More information about the cfe-commits mailing list