blob: d5b96c2d1b9331b9d02b616892ea51f6107b828d [file] [log] [blame]
Andrew Geisslerc60845c2021-01-29 15:55:05 -06001From e33a814e772cdc36436c8c188d8c42d019fda639 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>
33---
34 scripts/dtc/dtc-lexer.l | 1 -
35 1 file changed, 1 deletion(-)
36
37diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
38index 5c6c3fd557d7..b3b7270300de 100644
39--- a/scripts/dtc/dtc-lexer.l
40+++ b/scripts/dtc/dtc-lexer.l
41@@ -23,7 +23,6 @@ LINECOMMENT "//".*\n
42 #include "srcpos.h"
43 #include "dtc-parser.tab.h"
44
45-YYLTYPE yylloc;
46 extern bool treesource_error;
47
48 /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
49--
502.29.2
51