014-Kbuild-suppress-packed-not-aligned-warning-for-defau.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From: Xiongfeng Wang <xiongfeng.wang@linaro.org>
  2. Date: Thu, 11 Jan 2018 17:22:29 +0800
  3. Subject: [PATCH] Kbuild: suppress packed-not-aligned warning for default
  4. setting only
  5. gcc-8 reports many -Wpacked-not-aligned warnings. The below are some
  6. examples.
  7. ./include/linux/ceph/msgr.h:67:1: warning: alignment 1 of 'struct
  8. ceph_entity_addr' is less than 8 [-Wpacked-not-aligned]
  9. } __attribute__ ((packed));
  10. ./include/linux/ceph/msgr.h:67:1: warning: alignment 1 of 'struct
  11. ceph_entity_addr' is less than 8 [-Wpacked-not-aligned]
  12. } __attribute__ ((packed));
  13. ./include/linux/ceph/msgr.h:67:1: warning: alignment 1 of 'struct
  14. ceph_entity_addr' is less than 8 [-Wpacked-not-aligned]
  15. } __attribute__ ((packed));
  16. This patch suppresses this kind of warnings for default setting.
  17. Signed-off-by: Xiongfeng Wang <xiongfeng.wang@linaro.org>
  18. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
  19. ---
  20. --- a/scripts/Makefile.extrawarn
  21. +++ b/scripts/Makefile.extrawarn
  22. @@ -10,6 +10,8 @@
  23. # are not supported by all versions of the compiler
  24. # ==========================================================================
  25. +KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
  26. +
  27. ifeq ("$(origin W)", "command line")
  28. export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
  29. endif
  30. @@ -25,6 +27,7 @@ warning-1 += -Wold-style-definition
  31. warning-1 += $(call cc-option, -Wmissing-include-dirs)
  32. warning-1 += $(call cc-option, -Wunused-but-set-variable)
  33. warning-1 += $(call cc-option, -Wunused-const-variable)
  34. +warning-1 += $(call cc-option, -Wpacked-not-aligned)
  35. warning-1 += $(call cc-disable-warning, missing-field-initializers)
  36. warning-1 += $(call cc-disable-warning, sign-compare)