llvm-project/clang/lib/Parse
Alex Lorenz 45b4014711 Recommit r308327 3rd time: Add a warning for missing
'#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files

The second recommit (r309106) was reverted because the "non-default #pragma
pack value chages the alignment of struct or union members in the included file"
warning proved to be too aggressive for external projects like Chromium
(https://bugs.chromium.org/p/chromium/issues/detail?id=749197). This recommit
makes the problematic warning a non-default one, and gives it the
-Wpragma-pack-suspicious-include warning option.

The first recommit (r308441) caused a "non-default #pragma pack value might
change the alignment of struct or union members in the included file" warning
in LLVM itself. This recommit tweaks the added warning to avoid warnings for
#includes that don't have any records that are affected by the non-default
alignment. This tweak avoids the previously emitted warning in LLVM.

Original message:

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

llvm-svn: 309386
2017-07-28 14:41:21 +00:00
..
CMakeLists.txt [CMake] Reorder libdeps by alphabetical order. 2014-07-14 04:59:27 +00:00
ParseAST.cpp C++ Modules TS: add frontend support for building pcm files from module 2016-08-26 00:14:38 +00:00
ParseCXXInlineMethods.cpp fix typos in comments; NFC 2017-07-13 06:51:20 +00:00
ParseDecl.cpp fix trivial typos in comments; NFC 2017-07-02 06:12:49 +00:00
ParseDeclCXX.cpp [Modules] Implement ODR-like semantics for tag types in C/ObjC 2017-07-01 00:06:47 +00:00
ParseExpr.cpp fix trivial typos in comments; NFC 2017-07-02 06:12:49 +00:00
ParseExprCXX.cpp [NFC, Refactor] Modernize TemplateIdAnnotation using TrailingObjects 2017-05-23 01:07:12 +00:00
ParseInit.cpp Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC. 2017-06-01 21:23:52 +00:00
ParseObjc.cpp [index] Objective-C method declarations and message sends with 2017-07-13 10:50:21 +00:00
ParseOpenMP.cpp [OPENMP] Initial support for 'in_reduction' clause. 2017-07-21 18:48:21 +00:00
ParsePragma.cpp Recommit r308327 3rd time: Add a warning for missing 2017-07-28 14:41:21 +00:00
ParseStmt.cpp Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC. 2017-06-01 21:28:26 +00:00
ParseStmtAsm.cpp Spelling mistakes in comments. NFCI. (PR27635) 2017-03-30 14:13:19 +00:00
ParseTemplate.cpp [Sema] Fix a crash-on-invalid when a template parameter list has a class 2017-06-26 18:46:12 +00:00
ParseTentative.cpp Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC. 2017-06-01 21:29:45 +00:00
Parser.cpp Fix invalid warnings for header guards in preambles 2017-07-05 09:44:07 +00:00