-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modules: Do not serialize #pragma pack state
The modules side of r299226, which serializes #pragma pack state, doesn't work well. The main purpose was to make -include and -include-pch match semantics (the PCH side). We also started serializing #pragma pack in PCMs, in the hopes of making modules and non-modules builds more consistent. But consider: $ cat a.h $ cat b.h #pragma pack(push, 2) $ cat module.modulemap module M { module a { header "a.h" } module b { header "b.h" } } $ cat t.cpp #include "a.h" #pragma pack(show) As of r299226, the #pragma pack(show) gives "2", even though we've only included "a.h". - With -fmodules-local-submodule-visibility, this is clearly wrong. We should get the default state (8 on x86_64). - Without -fmodules-local-submodule-visibility, this kind of matches how other things work (as if include-the-whole-module), but it's still really terrible, and it doesn't actually make modules and non-modules builds more consistent. This commit disables the serialization for modules, essentially a partial revert of r299226. Going forward: 1. Having this #pragma pack stuff escape is terrible design (or, more often, a horrible bug). We should prioritize adding warnings (maybe -Werror by default?). 2. If we eventually reintroduce this for modules, it should only apply to -fmodules-local-submodule-visibility, and it should be tracked on a per-submodule basis. llvm-svn: 300380
- Loading branch information
1 parent
044f956
commit 03df14c
Showing
6 changed files
with
33 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// RUN: rm -rf %t.cache %tlocal.cache | ||
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fmodules \ | ||
// RUN: -fimplicit-module-maps -x c++ -emit-module \ | ||
// RUN: -fmodules-cache-path=%t.cache \ | ||
// RUN: -fmodule-name=pragma_pack %S/Inputs/module.map | ||
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fmodules \ | ||
// RUN: -fimplicit-module-maps -x c++ -verify \ | ||
// RUN: -fmodules-cache-path=%t.cache \ | ||
// RUN: -I%S/Inputs %s | ||
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fmodules \ | ||
// RUN: -fmodules-local-submodule-visibility \ | ||
// RUN: -fimplicit-module-maps -x c++ -emit-module \ | ||
// RUN: -fmodules-cache-path=%tlocal.cache \ | ||
// RUN: -fmodule-name=pragma_pack %S/Inputs/module.map | ||
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fmodules \ | ||
// RUN: -fmodules-local-submodule-visibility \ | ||
// RUN: -fimplicit-module-maps -x c++ -verify \ | ||
// RUN: -fmodules-cache-path=%tlocal.cache \ | ||
// RUN: -I%S/Inputs %s | ||
|
||
// Check that we don't serialize pragma pack state until/unless including an | ||
// empty file from the same module (but different submodule) has no effect. | ||
#pragma pack (show) // expected-warning {{value of #pragma pack(show) == 8}} | ||
#include "empty.h" | ||
#pragma pack (show) // expected-warning {{value of #pragma pack(show) == 8}} |