0002-Provide-fallback-definition-for-__packed.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From bc2cd89715155fe1fead19338dac5f4059917dfe Mon Sep 17 00:00:00 2001
  2. From: Michael Forney <mforney@mforney.org>
  3. Date: Thu, 20 Jun 2019 13:52:22 -0700
  4. Subject: [PATCH] Provide fallback definition for __packed
  5. Otherwise, systems that don't support it will treat it as a name for a
  6. global `struct ntp_msg` variable.
  7. [Retrieved from:
  8. https://github.com/openntpd-portable/openntpd-portable/commit/bc2cd89715155fe1fead19338dac5f4059917dfe]
  9. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  10. ---
  11. include/sys/types.h | 4 ++++
  12. m4/check-os-options.m4 | 1 +
  13. 2 files changed, 5 insertions(+)
  14. diff --git a/include/sys/types.h b/include/sys/types.h
  15. index 86821c7..5492e20 100644
  16. --- a/include/sys/types.h
  17. +++ b/include/sys/types.h
  18. @@ -22,6 +22,10 @@
  19. # define __bounded__(x, y, z)
  20. #endif
  21. +#if !defined(HAVE_ATTRIBUTE__PACKED) && !defined(__packed)
  22. +# define __packed __attribute__((__packed__))
  23. +#endif
  24. +
  25. /*
  26. * Define BSD-style unsigned bits types for systems that do not have them.
  27. */
  28. diff --git a/m4/check-os-options.m4 b/m4/check-os-options.m4
  29. index d4d02d9..4883d1f 100644
  30. --- a/m4/check-os-options.m4
  31. +++ b/m4/check-os-options.m4
  32. @@ -69,6 +69,7 @@ case $host_os in
  33. HOST_ABI=elf
  34. AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD gcc has bounded])
  35. AC_DEFINE([HAVE_ATTRIBUTE__DEAD], [1], [OpenBSD gcc has __dead])
  36. + AC_DEFINE([HAVE_ATTRIBUTE__PACKED], [1], [OpenBSD gcc has __packed])
  37. ;;
  38. *solaris*)
  39. HOST_OS=solaris