summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/warn-padded-packed.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [clang] Change the condition of unnecessary packed warningYan Wang2017-08-011-8/+85
| | | | | | | | | | | | | | | | | | | | Summary: Change the condition of this unnecessary packed warning. The packed is unnecessary when 1. the alignment of the struct/class won't alter. 2. the size is unchanged. 3. the offset of each field is the same. Remove all field-level warning. Reviewers: chh, akyrtzi, rtrieu Reviewed By: chh Subscribers: rsmith, srhines, cfe-commits, xazax.hun Differential Revision: https://reviews.llvm.org/D34114 llvm-svn: 309750
* Remove warning on over-wide bit-field of boolean type; there's no risk thatRichard Smith2015-09-231-1/+1
| | | | | | | | | | someone thought all the bits would be value bits in this case. Also fix the wording of the warning -- it claimed that the width of 'bool' is 8, which is not correct; the width is 1 bit, whereas the size is 8 bits in our implementation. llvm-svn: 248435
* C11 _Bool bitfield diagnosticRachel Craik2015-09-141-1/+1
| | | | | | | | | | | | Summary: Implement DR262 (for C). This patch will mainly affect bitfields of type _Bool Reviewers: fraggamuffin, rsmith Subscribers: hubert.reinterpretcast, cfe-commits Differential Revision: http://reviews.llvm.org/D10018 llvm-svn: 247618
* Use -emit-llvm-only in the test.Argyrios Kyrtzidis2010-09-231-1/+1
| | | | llvm-svn: 114636
* Implement -Wpadded and -Wpacked.Argyrios Kyrtzidis2010-09-221-0/+76
-Wpadded warns when undesired padding is introduced in a struct. (rdar://7469556) -Wpacked warns if a struct is given the packed attribute, but the packed attribute has no effect on the layout or the size of the struct. Such structs may be mis-aligned for little benefit. The warnings are emitted at the point where layout is calculated, that is at RecordLayoutBuilder. To avoid calculating the layouts of all structs regardless of whether they are needed or not, I let the layouts be lazily constructed when needed. This has the disadvantage that the above warnings will be emitted only when they are used for IR gen, and not e.g with -fsyntax-only: $ cat t.c struct S { char c; int i; }; void f(struct S* s) {} $ clang -fsyntax-only -Wpadded t.c $ clang -c -Wpadded t.c -o t.o t.c:3:7: warning: padding struct 'struct S' with 3 bytes to align 'i' [-Wpadded] int i; ^ 1 warning generated. This is a good tradeoff between providing the warnings and not calculating layouts for all structs in case the user has enabled a couple of rarely used warnings. llvm-svn: 114544
OpenPOWER on IntegriCloud