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