Andrew Geissler | c60845c | 2021-01-29 15:55:05 -0600 | [diff] [blame^] | 1 | From e33a814e772cdc36436c8c188d8c42d019fda639 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 | |
| 6 | gcc 10 will default to -fno-common, which causes this error at link |
| 7 | time: |
| 8 | |
| 9 | (.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here |
| 10 | |
| 11 | This is because both dtc-lexer as well as dtc-parser define the same |
| 12 | global symbol yyloc. Before with -fcommon those were merged into one |
| 13 | defintion. The proper solution would be to to mark this as "extern", |
| 14 | however that leads to: |
| 15 | |
| 16 | dtc-lexer.l:26:16: error: redundant redeclaration of 'yylloc' [-Werror=redundant-decls] |
| 17 | 26 | extern YYLTYPE yylloc; |
| 18 | | ^~~~~~ |
| 19 | In file included from dtc-lexer.l:24: |
| 20 | dtc-parser.tab.h:127:16: note: previous declaration of 'yylloc' was here |
| 21 | 127 | extern YYLTYPE yylloc; |
| 22 | | ^~~~~~ |
| 23 | cc1: all warnings being treated as errors |
| 24 | |
| 25 | which means the declaration is completely redundant and can just be |
| 26 | dropped. |
| 27 | |
| 28 | Signed-off-by: Dirk Mueller <dmueller@suse.com> |
| 29 | Signed-off-by: David Gibson <david@gibson.dropbear.id.au> |
| 30 | [robh: cherry-pick from upstream] |
| 31 | Cc: stable@vger.kernel.org |
| 32 | Signed-off-by: Rob Herring <robh@kernel.org> |
| 33 | --- |
| 34 | scripts/dtc/dtc-lexer.l | 1 - |
| 35 | 1 file changed, 1 deletion(-) |
| 36 | |
| 37 | diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l |
| 38 | index 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 | -- |
| 50 | 2.29.2 |
| 51 | |