Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Add ATTRIBUTE_PACKED to ansidecl.h
@ 2006-12-06 18:08 Nick Clifton
  2006-12-06 18:47 ` Ian Lance Taylor
  2006-12-06 23:40 ` Kaveh R. GHAZI
  0 siblings, 2 replies; 3+ messages in thread
From: Nick Clifton @ 2006-12-06 18:08 UTC (permalink / raw)
  To: gcc-patches; +Cc: gdb-patches

Hi Guys,

  I am applying the patch below to add a definition of
  ATTRIBUTE_PACKED to ansidecl.h along the lines of the other
  attributes defined in this file.  This definition is now needed by
  the binutils sources.

  Does anyone know when the packed attribute was actually introduced
  into gcc ?  I have not put a version number check into the patch
  because as far as I could tell it came in when support for
  __attribute__ was added.

Cheers
  Nick

include/ChangeLog
2006-12-06  Nick Clifton  <nickc@redhat.com>

	* ansidecl.h (ATTRIBUTE_PACKED): Define.
  
Index: include/ansidecl.h
===================================================================
--- include/ansidecl.h	(revision 119579)
+++ include/ansidecl.h	(working copy)
@@ -361,6 +361,12 @@ So instead we use the macro below and te
 # endif /* GNUC >= 3.0 */
 #endif /* ATTRIBUTE_ALIGNED_ALIGNOF */
 
+/* Useful for structures whoes layout must much some binary specification
+   regardless of the alignment and padding qualities of the compiler.  */
+#ifndef ATTRIBUTE_PACKED
+# define ATTRIBUTE_PACKED __attribute__ ((packed))
+#endif
+
 /* We use __extension__ in some places to suppress -pedantic warnings
    about GCC extensions.  This feature didn't work properly before
    gcc 2.8.  */


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Add ATTRIBUTE_PACKED to ansidecl.h
  2006-12-06 18:08 Add ATTRIBUTE_PACKED to ansidecl.h Nick Clifton
@ 2006-12-06 18:47 ` Ian Lance Taylor
  2006-12-06 23:40 ` Kaveh R. GHAZI
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Lance Taylor @ 2006-12-06 18:47 UTC (permalink / raw)
  To: Nick Clifton; +Cc: gcc-patches, gdb-patches

Nick Clifton <nickc@redhat.com> writes:

>   Does anyone know when the packed attribute was actually introduced
>   into gcc ?  I have not put a version number check into the patch
>   because as far as I could tell it came in when support for
>   __attribute__ was added.

Yes.  __attribute__ ((packed)) was added in gcc 2.7, which is also
when __attribute__ was added.

Ian


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Add ATTRIBUTE_PACKED to ansidecl.h
  2006-12-06 18:08 Add ATTRIBUTE_PACKED to ansidecl.h Nick Clifton
  2006-12-06 18:47 ` Ian Lance Taylor
@ 2006-12-06 23:40 ` Kaveh R. GHAZI
  1 sibling, 0 replies; 3+ messages in thread
From: Kaveh R. GHAZI @ 2006-12-06 23:40 UTC (permalink / raw)
  To: Nick Clifton; +Cc: gcc-patches, gdb-patches

On Wed, 6 Dec 2006, Nick Clifton wrote:

> +/* Useful for structures whoes layout must much some binary specification
> +   regardless of the alignment and padding qualities of the compiler.  */
> +#ifndef ATTRIBUTE_PACKED
> +# define ATTRIBUTE_PACKED __attribute__ ((packed))
> +#endif

Please consider using "__packed__" not "packed".  All the other ATTRIBUTE
macros use underscores to avoid conflicts with user-space macros.

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-12-06 23:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-06 18:08 Add ATTRIBUTE_PACKED to ansidecl.h Nick Clifton
2006-12-06 18:47 ` Ian Lance Taylor
2006-12-06 23:40 ` Kaveh R. GHAZI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox