|
| 1 | +From 11647f99b4de6bc460e106e876f72fc7af3e54a6 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 | +commit e33a814e772cdc36436c8c188d8c42d019fda639 upstream. |
| 7 | + |
| 8 | +gcc 10 will default to -fno-common, which causes this error at link |
| 9 | +time: |
| 10 | + |
| 11 | + (.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here |
| 12 | + |
| 13 | +This is because both dtc-lexer as well as dtc-parser define the same |
| 14 | +global symbol yyloc. Before with -fcommon those were merged into one |
| 15 | +defintion. The proper solution would be to to mark this as "extern", |
| 16 | +however that leads to: |
| 17 | + |
| 18 | + dtc-lexer.l:26:16: error: redundant redeclaration of 'yylloc' [-Werror=redundant-decls] |
| 19 | + 26 | extern YYLTYPE yylloc; |
| 20 | + | ^~~~~~ |
| 21 | +In file included from dtc-lexer.l:24: |
| 22 | +dtc-parser.tab.h:127:16: note: previous declaration of 'yylloc' was here |
| 23 | + 127 | extern YYLTYPE yylloc; |
| 24 | + | ^~~~~~ |
| 25 | +cc1: all warnings being treated as errors |
| 26 | + |
| 27 | +which means the declaration is completely redundant and can just be |
| 28 | +dropped. |
| 29 | + |
| 30 | +Signed-off-by: Dirk Mueller <dmueller@suse.com> |
| 31 | +Signed-off-by: David Gibson <david@gibson.dropbear.id.au> |
| 32 | +[robh: cherry-pick from upstream] |
| 33 | +Cc: stable@vger.kernel.org |
| 34 | +Signed-off-by: Rob Herring <robh@kernel.org> |
| 35 | +[nc: Also apply to dtc-lexer.lex.c_shipped due to a lack of |
| 36 | + e039139be8c2, where dtc-lexer.l started being used] |
| 37 | +Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> |
| 38 | +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| 39 | +Change-Id: I7f299451e99aab09375883546e47505ec0937c26 |
| 40 | +--- |
| 41 | + scripts/dtc/dtc-lexer.l | 1 - |
| 42 | + scripts/dtc/dtc-lexer.lex.c_shipped | 1 - |
| 43 | + 2 files changed, 2 deletions(-) |
| 44 | + |
| 45 | +diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l |
| 46 | +index c600603044f..cf7707be43a 100644 |
| 47 | +--- a/scripts/dtc/dtc-lexer.l |
| 48 | ++++ b/scripts/dtc/dtc-lexer.l |
| 49 | +@@ -38,7 +38,6 @@ LINECOMMENT "//".*\n |
| 50 | + #include "srcpos.h" |
| 51 | + #include "dtc-parser.tab.h" |
| 52 | + |
| 53 | +-YYLTYPE yylloc; |
| 54 | + extern bool treesource_error; |
| 55 | + |
| 56 | + /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ |
| 57 | +diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped |
| 58 | +index 2c862bc86ad..e3663ce1af5 100644 |
| 59 | +--- a/scripts/dtc/dtc-lexer.lex.c_shipped |
| 60 | ++++ b/scripts/dtc/dtc-lexer.lex.c_shipped |
| 61 | +@@ -631,7 +631,6 @@ char *yytext; |
| 62 | + #include "srcpos.h" |
| 63 | + #include "dtc-parser.tab.h" |
| 64 | + |
| 65 | +-YYLTYPE yylloc; |
| 66 | + extern bool treesource_error; |
| 67 | + |
| 68 | + /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ |
0 commit comments