Patchwork [objc] : Fix issue about LLP64 and -Wpadded

login
register
mail settings
Submitter Nicola Pero
Date Sept. 30, 2010, 8:57 a.m.
Message ID <1285837039.83211158@192.168.2.227>
Download mbox | patch
Permalink /patch/66140/
State New
Headers show

Comments

Nicola Pero - Sept. 30, 2010, 8:57 a.m.
> Does this comment looks ok for you? If so, ok for apply?

Yes, it does look Ok, but I'd change the comment a bit (mostly grammar
changes).  In fact, to avoid the back-and-forth about the comment, I 
rewrote the comment for you in a way that seems Ok to me --

/* We pad the structure manually to prevent warning when -Wpadded
   is used.  The compiler automatically pads the structures that it 
   generates, so this manually padded structure still matches the one 
   generated by the compiler, but if we don't pad manually, -Wpadded 
   detects that padding is being added and generates annoying warnings.
   This hack is necessary as on LLP64 targets sizeof (long) isn't equal 
   to sizeof (void *).  */

So, Ok to apply with this reworked comment (or if you don't like it, feel free
to propose another one). ;-)

Thanks

                                                 variables in the class
@@ -42,3 +49,4 @@
   struct objc_protocol_list *protocols;              /* Protocols 
conformed to
*/
   void* gc_object_type;
 };
+
Kai Tietz - Sept. 30, 2010, 9:03 a.m.
2010/9/30 Nicola Pero <nicola.pero@meta-innovation.com>:
>
>> Does this comment looks ok for you? If so, ok for apply?
>
> Yes, it does look Ok, but I'd change the comment a bit (mostly grammar
> changes).  In fact, to avoid the back-and-forth about the comment, I
> rewrote the comment for you in a way that seems Ok to me --
>
> /* We pad the structure manually to prevent warning when -Wpadded
>   is used.  The compiler automatically pads the structures that it
>   generates, so this manually padded structure still matches the one
>   generated by the compiler, but if we don't pad manually, -Wpadded
>   detects that padding is being added and generates annoying warnings.
>   This hack is necessary as on LLP64 targets sizeof (long) isn't equal
>   to sizeof (void *).  */
>
> So, Ok to apply with this reworked comment (or if you don't like it, feel free
> to propose another one). ;-)
>
> Thanks

Ok, I like your version more and applied your comment here ;)
Committed at revision 164746.

Thanks,
Kai

Patch

--- struct_objc_class.h (revision 164743)
+++ struct_objc_class.h (working copy)
@@ -24,6 +24,13 @@ 
                                                 The sum of the class
                                                definition and all super
                                                class definitions. */
+#ifdef _WIN64
+  /* We do here structure padding manual.  This is done by compiler
+     automatically, but would lead in combination with -Wpadded to
+     annoying warnings.  This padding is necessary as on LLP64 targets
+     sizeof (long) isn't equal to sizeof (void *).  */
+  long pad;
+#endif
   struct objc_ivar_list* ivars;               /* Pointer to a structure 
that
                                                 describes the instance