0001-eventtable.h-use-correct-array-sizes-to-fix-building.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. From d3cfa80631a7e314fee9b2e0822e403fcf2a5c5c Mon Sep 17 00:00:00 2001
  2. From: Peter Korsgaard <peter@korsgaard.com>
  3. Date: Sun, 31 Jul 2016 10:28:43 +0200
  4. Subject: [PATCH] eventtable.h: use correct array sizes to fix building against
  5. 4.7+ headers
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. During the 4.7 development cycle, commit 9a9b6aa6a8 (Input: add
  10. SW_PEN_INSERTED define) got added, which has the same numerical value as
  11. SW_MAX:
  12. +#define SW_PEN_INSERTED 0x0f /* set = pen inserted */
  13. +#define SW_MAX 0x0f
  14. This breaks the build as the SW_NAME array is sized using the SW_MAX macro:
  15. In file included from eventtable.h:21:0,
  16. from eventnames.c:11:
  17. evtable_SW.inc:17:1: error: array index in initializer exceeds array bounds
  18. EV_MAP(SW_PEN_INSERTED),
  19. ^
  20. evtable_SW.inc:17:1: error: (near initialization for ‘SW_NAME’)
  21. The arrays should be sized using the <foo>_CNT (which is MAX+1) macros
  22. instead of <foo>_MAX. These got added during the 2.6.24 development cycle,
  23. so it should be safe to do so unconditially:
  24. commit 7b19ada2ed3c1eccb9fe94d74b05e1428224663d
  25. Author: Jiri Slaby <jirislaby@gmail.com>
  26. Date: Thu Oct 18 23:40:32 2007 -0700
  27. get rid of input BIT* duplicate defines
  28. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  29. ---
  30. eventtable.h | 6 +++---
  31. 1 file changed, 3 insertions(+), 3 deletions(-)
  32. diff --git a/eventtable.h b/eventtable.h
  33. index 349d9d7..7cd99aa 100644
  34. --- a/eventtable.h
  35. +++ b/eventtable.h
  36. @@ -8,15 +8,15 @@
  37. #define EV_MAP( N ) [ N ] = #N
  38. -static const char *EV_NAME[EV_MAX] = {
  39. +static const char *EV_NAME[EV_CNT] = {
  40. #include "evtable_EV.inc"
  41. };
  42. -static const char *KEY_NAME[KEY_MAX] = {
  43. +static const char *KEY_NAME[KEY_CNT] = {
  44. #include "evtable_KEY.inc"
  45. #include "evtable_BTN.inc"
  46. };
  47. -static const char *SW_NAME[SW_MAX] = {
  48. +static const char *SW_NAME[SW_CNT] = {
  49. #include "evtable_SW.inc"
  50. };
  51. --
  52. 2.8.1