Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-08-21 Thread H.J. Lu
On Mon, Aug 21, 2017 at 3:59 AM, Szabolcs Nagy wrote: > On 17/08/17 15:56, H.J. Lu wrote: >> On Thu, Aug 17, 2017 at 6:52 AM, Joseph Myers >> wrote: >>> On Sat, 8 Jul 2017, H.J. Lu wrote: >>> +@item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)} +@opindex W

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-08-21 Thread Szabolcs Nagy
On 17/08/17 15:56, H.J. Lu wrote: > On Thu, Aug 17, 2017 at 6:52 AM, Joseph Myers wrote: >> On Sat, 8 Jul 2017, H.J. Lu wrote: >> >>> +@item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)} >>> +@opindex Wpacked-not-aligned >>> +@opindex Wno-packed-not-aligned >>> +Warn if a s

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-08-17 Thread Jason Merrill
On Thu, Aug 17, 2017 at 7:56 AM, H.J. Lu wrote: > On Thu, Aug 17, 2017 at 6:52 AM, Joseph Myers wrote: >> On Sat, 8 Jul 2017, H.J. Lu wrote: >> >>> +@item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)} >>> +@opindex Wpacked-not-aligned >>> +@opindex Wno-packed-not-aligned >

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-08-17 Thread H.J. Lu
On Thu, Aug 17, 2017 at 6:52 AM, Joseph Myers wrote: > On Sat, 8 Jul 2017, H.J. Lu wrote: > >> +@item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)} >> +@opindex Wpacked-not-aligned >> +@opindex Wno-packed-not-aligned >> +Warn if a structure field with explicitly specified a

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-08-17 Thread Joseph Myers
On Sat, 8 Jul 2017, H.J. Lu wrote: > +@item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)} > +@opindex Wpacked-not-aligned > +@opindex Wno-packed-not-aligned > +Warn if a structure field with explicitly specified alignment in a > +packed struct or union is misaligned. For e

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-07-08 Thread H.J. Lu
On Thu, Jul 06, 2017 at 03:44:57PM +, Joseph Myers wrote: > On Fri, 16 Jun 2017, H.J. Lu wrote: > > > +@code{warning: alignment 8 of 'struct foo' is less than 16}. > > I think @samp is better than @code for warnings, throughout, since they > aren't pieces of program code. Done. > > > +Thi

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-07-06 Thread Joseph Myers
On Fri, 16 Jun 2017, H.J. Lu wrote: > +@code{warning: alignment 8 of 'struct foo' is less than 16}. I think @samp is better than @code for warnings, throughout, since they aren't pieces of program code. > +This warning can be disabled by @option{-Wno-if-not-aligned}. > +The @code{warn_if_not_al

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-06-16 Thread H.J. Lu
On Thu, Jun 15, 2017 at 05:31:34PM +, Joseph Myers wrote: > On Thu, 15 Jun 2017, H.J. Lu wrote: > > > On Thu, Jun 15, 2017 at 8:38 AM, Martin Sebor wrote: > > >> > > >> Where do we go from here? > > > > > > > > > Other than the C and C++ maintainers needing to approve the patch > > > I can't

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-06-15 Thread Joseph Myers
On Thu, 15 Jun 2017, H.J. Lu wrote: > On Thu, Jun 15, 2017 at 8:38 AM, Martin Sebor wrote: > >> > >> Where do we go from here? > > > > > > Other than the C and C++ maintainers needing to approve the patch > > I can't think of anything else. > > Hi Joseph, Jason, > > The complete patch is at >

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-06-15 Thread H.J. Lu
On Thu, Jun 15, 2017 at 8:38 AM, Martin Sebor wrote: >> >> Where do we go from here? > > > Other than the C and C++ maintainers needing to approve the patch > I can't think of anything else. Hi Joseph, Jason, The complete patch is at https://gcc.gnu.org/ml/gcc-patches/2017-06/msg00541.html Is

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-06-15 Thread Martin Sebor
On 06/09/2017 07:31 AM, H.J. Lu wrote: On Thu, Jun 8, 2017 at 12:13 PM, Martin Sebor wrote: On 06/08/2017 11:00 AM, H.J. Lu wrote: On Wed, Jun 7, 2017 at 6:30 AM, H.J. Lu wrote: On Tue, Jun 6, 2017 at 5:11 PM, Martin Sebor wrote: On 06/06/2017 04:57 PM, H.J. Lu wrote: On Tue, Jun 6,

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-06-09 Thread H.J. Lu
On Thu, Jun 8, 2017 at 12:13 PM, Martin Sebor wrote: > On 06/08/2017 11:00 AM, H.J. Lu wrote: >> >> On Wed, Jun 7, 2017 at 6:30 AM, H.J. Lu wrote: >>> >>> On Tue, Jun 6, 2017 at 5:11 PM, Martin Sebor wrote: On 06/06/2017 04:57 PM, H.J. Lu wrote: > > > On Tue, Jun 6, 2017 at

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-06-08 Thread Martin Sebor
On 06/08/2017 11:00 AM, H.J. Lu wrote: On Wed, Jun 7, 2017 at 6:30 AM, H.J. Lu wrote: On Tue, Jun 6, 2017 at 5:11 PM, Martin Sebor wrote: On 06/06/2017 04:57 PM, H.J. Lu wrote: On Tue, Jun 6, 2017 at 10:34 AM, Martin Sebor wrote: On 06/06/2017 10:59 AM, H.J. Lu wrote: On Tue, Jun 6, 2

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-06-08 Thread H.J. Lu
On Wed, Jun 7, 2017 at 6:30 AM, H.J. Lu wrote: > On Tue, Jun 6, 2017 at 5:11 PM, Martin Sebor wrote: >> On 06/06/2017 04:57 PM, H.J. Lu wrote: >>> >>> On Tue, Jun 6, 2017 at 10:34 AM, Martin Sebor wrote: On 06/06/2017 10:59 AM, H.J. Lu wrote: > > > On Tue, Jun 6, 2017 at 9:

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-06-07 Thread H.J. Lu
On Tue, Jun 6, 2017 at 5:11 PM, Martin Sebor wrote: > On 06/06/2017 04:57 PM, H.J. Lu wrote: >> >> On Tue, Jun 6, 2017 at 10:34 AM, Martin Sebor wrote: >>> >>> On 06/06/2017 10:59 AM, H.J. Lu wrote: On Tue, Jun 6, 2017 at 9:10 AM, Martin Sebor wrote: > > > On 06/06/201

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-06-06 Thread Martin Sebor
On 06/06/2017 04:57 PM, H.J. Lu wrote: On Tue, Jun 6, 2017 at 10:34 AM, Martin Sebor wrote: On 06/06/2017 10:59 AM, H.J. Lu wrote: On Tue, Jun 6, 2017 at 9:10 AM, Martin Sebor wrote: On 06/06/2017 10:07 AM, Martin Sebor wrote: On 06/05/2017 11:45 AM, H.J. Lu wrote: On Mon, Jun 5, 201

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-06-06 Thread H.J. Lu
On Tue, Jun 6, 2017 at 10:34 AM, Martin Sebor wrote: > On 06/06/2017 10:59 AM, H.J. Lu wrote: >> >> On Tue, Jun 6, 2017 at 9:10 AM, Martin Sebor wrote: >>> >>> On 06/06/2017 10:07 AM, Martin Sebor wrote: On 06/05/2017 11:45 AM, H.J. Lu wrote: > > > On Mon, Jun 5, 2017 a

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-06-06 Thread Martin Sebor
On 06/06/2017 10:59 AM, H.J. Lu wrote: On Tue, Jun 6, 2017 at 9:10 AM, Martin Sebor wrote: On 06/06/2017 10:07 AM, Martin Sebor wrote: On 06/05/2017 11:45 AM, H.J. Lu wrote: On Mon, Jun 5, 2017 at 8:11 AM, Joseph Myers wrote: The new attribute needs documentation. Should the test be in

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-06-06 Thread H.J. Lu
On Tue, Jun 6, 2017 at 9:10 AM, Martin Sebor wrote: > On 06/06/2017 10:07 AM, Martin Sebor wrote: >> >> On 06/05/2017 11:45 AM, H.J. Lu wrote: >>> >>> On Mon, Jun 5, 2017 at 8:11 AM, Joseph Myers >>> wrote: The new attribute needs documentation. Should the test be in c-c++-common

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-06-06 Thread Martin Sebor
On 06/06/2017 10:07 AM, Martin Sebor wrote: On 06/05/2017 11:45 AM, H.J. Lu wrote: On Mon, Jun 5, 2017 at 8:11 AM, Joseph Myers wrote: The new attribute needs documentation. Should the test be in c-c++-common This feature does support C++. But C++ compiler issues a slightly different warni

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-06-06 Thread Martin Sebor
On 06/05/2017 11:45 AM, H.J. Lu wrote: On Mon, Jun 5, 2017 at 8:11 AM, Joseph Myers wrote: The new attribute needs documentation. Should the test be in c-c++-common This feature does support C++. But C++ compiler issues a slightly different warning at a different location. or does this fe

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-06-05 Thread H.J. Lu
On Mon, Jun 5, 2017 at 8:11 AM, Joseph Myers wrote: > The new attribute needs documentation. Should the test be in c-c++-common This feature does support C++. But C++ compiler issues a slightly different warning at a different location. > or does this feature not support C++? > Here is the up

Re: RFC: [PATCH] Add warn_if_not_aligned attribute

2017-06-05 Thread Joseph Myers
The new attribute needs documentation. Should the test be in c-c++-common or does this feature not support C++? -- Joseph S. Myers jos...@codesourcery.com

RFC: [PATCH] Add warn_if_not_aligned attribute

2017-06-04 Thread H.J. Lu
__attribute__((warn_if_not_aligned(N))) issues a warning if the field in a struct or union is not aligned to N: typedef unsigned long long __u64 __attribute__((aligned(4),warn_if_not_aligned(8))); struct foo { int i1; int i2; __u64 x; }; __u64 is aligned to 4 bytes. But inside struct fo