Add new __packed, __aligned and __nonnull attributes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/include/bsd/sys/cdefs.h b/include/bsd/sys/cdefs.h
index a1ea034..e91b660 100644
--- a/include/bsd/sys/cdefs.h
+++ b/include/bsd/sys/cdefs.h
@@ -65,6 +65,22 @@
# endif
#endif
+#ifndef __packed
+# if LIBBSD_GCC_VERSION >= 0x0207
+# define __packed __attribute__((__packed__))
+# else
+# define __packed
+# endif
+#endif
+
+#ifndef __aligned
+# if LIBBSD_GCC_VERSION >= 0x0207
+# define __aligned(x) __attribute__((__aligned__(x)))
+# else
+# define __aligned(x)
+# endif
+#endif
+
/* Linux headers define a struct with a member names __unused.
* Debian bugs: #522773 (linux), #522774 (libc).
* Disable for now. */
@@ -86,6 +102,14 @@
# endif
#endif
+#ifndef __nonnull
+# if LIBBSD_GCC_VERSION >= 0x0302
+# define __nonnull(x) __attribute__((__nonnull__(x)))
+# else
+# define __nonnull(x)
+# endif
+#endif
+
#ifndef __bounded__
# define __bounded__(x, y, z)
#endif