[llvm-bugs] [Bug 36307] New: -Wpragma-pack fires incorrectly in header with #pragma options align which gets reset in the end

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Feb 8 13:16:33 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36307

            Bug ID: 36307
           Summary: -Wpragma-pack fires incorrectly in header with #pragma
                    options align which gets reset in the end
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arphaman at gmail.com
                CC: llvm-bugs at lists.llvm.org

-Wpragma-pack is a new warning in Clang 6 that warns about #pragma pack and
#pragma options align directives that leak outside their headers.

Clang currently incorrectly emits a warning for the alignment value modified in
a header in the following scenario:

$ cat header.h
#pragma options align=mac68k

struct S { int x; };

#pragma options align=reset
$ cat file.c
#include "header.h"
$ clang file.c
file.c:1:10: warning: the current #pragma pack aligment value is modified in
the included file
      [-Wpragma-pack]
#include "header.h"
         ^
./header.h:1:9: note: previous '#pragma pack' directive that modifies alignment
is here
#pragma options align=mac68k
        ^
1 warning generated.

We should not emit this warning as header correctly resets the alignment value.
This happens only when "#pragma options align=reset" is the last non-PP token
in the 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/20180208/4540c175/attachment.html>


More information about the llvm-bugs mailing list