0001-scripts-dtc-Remove-redundant-YYLOC-global-declaratio.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From f9df4186c17d686f1ca38f973d7a3a49e8e37c01 Mon Sep 17 00:00:00 2001
  2. From: Dirk Mueller <dmueller@suse.com>
  3. Date: Tue, 14 Jan 2020 18:53:41 +0100
  4. Subject: [PATCH] scripts/dtc: Remove redundant YYLOC global declaration
  5. gcc 10 will default to -fno-common, which causes this error at link
  6. time:
  7. (.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here
  8. This is because both dtc-lexer as well as dtc-parser define the same
  9. global symbol yyloc. Before with -fcommon those were merged into one
  10. defintion. The proper solution would be to to mark this as "extern",
  11. however that leads to:
  12. dtc-lexer.l:26:16: error: redundant redeclaration of 'yylloc' [-Werror=redundant-decls]
  13. 26 | extern YYLTYPE yylloc;
  14. | ^~~~~~
  15. In file included from dtc-lexer.l:24:
  16. dtc-parser.tab.h:127:16: note: previous declaration of 'yylloc' was here
  17. 127 | extern YYLTYPE yylloc;
  18. | ^~~~~~
  19. cc1: all warnings being treated as errors
  20. which means the declaration is completely redundant and can just be
  21. dropped.
  22. Signed-off-by: Dirk Mueller <dmueller@suse.com>
  23. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
  24. [robh: cherry-pick from upstream]
  25. Cc: stable@vger.kernel.org
  26. Signed-off-by: Rob Herring <robh@kernel.org>
  27. Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
  28. ---
  29. scripts/dtc/dtc-lexer.l | 1 -
  30. 1 file changed, 1 deletion(-)
  31. diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
  32. index 06c040902444..d1b3810156c7 100644
  33. --- a/scripts/dtc/dtc-lexer.l
  34. +++ b/scripts/dtc/dtc-lexer.l
  35. @@ -38,7 +38,6 @@ LINECOMMENT "//".*\n
  36. #include "srcpos.h"
  37. #include "dtc-parser.tab.h"
  38. -YYLTYPE yylloc;
  39. extern bool treesource_error;
  40. /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
  41. --
  42. 2.25.1