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