scripts/dtc: Remove redundant YYLOC global declaration 13/292813/1 accepted/tizen_unified accepted/tizen_unified_dev tizen accepted/tizen/unified/20230531.034425 accepted/tizen/unified/dev/20230726.115334
authorDirk Mueller <dmueller@suse.com>
Tue, 14 Jan 2020 17:53:41 +0000 (18:53 +0100)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 15 May 2023 06:14:09 +0000 (15:14 +0900)
commit e33a814e772cdc36436c8c188d8c42d019fda639 upstream.

gcc 10 will default to -fno-common, which causes this error at link
time:

  (.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here

This is because both dtc-lexer as well as dtc-parser define the same
global symbol yyloc. Before with -fcommon those were merged into one
defintion. The proper solution would be to to mark this as "extern",
however that leads to:

  dtc-lexer.l:26:16: error: redundant redeclaration of 'yylloc' [-Werror=redundant-decls]
   26 | extern YYLTYPE yylloc;
      |                ^~~~~~
In file included from dtc-lexer.l:24:
dtc-parser.tab.h:127:16: note: previous declaration of 'yylloc' was here
  127 | extern YYLTYPE yylloc;
      |                ^~~~~~
cc1: all warnings being treated as errors

which means the declaration is completely redundant and can just be
dropped.

Signed-off-by: Dirk Mueller <dmueller@suse.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[robh: cherry-pick from upstream]
Cc: stable@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
[nc: Also apply to dtc-lexer.lex.c_shipped due to a lack of
     e039139be8c2, where dtc-lexer.l started being used]
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[sw0312.kim: backport upstream commit 8e8ab8554aa4 to resolve gcc-12 build issue]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I05bbd91ea85995f1539bd1fb9b3a0cfe812fdb13

scripts/dtc/dtc-lexer.l
scripts/dtc/dtc-lexer.lex.c_shipped
scripts/dtc/dtc-parser.tab.h_shipped

index 3b41bfca636cea743e575cf3c7dfcb95967e915e..50fa3bda19bfe1ff8b93624f99e84c17eb09c8b3 100644 (file)
@@ -39,8 +39,6 @@ LINECOMMENT   "//".*\n
 #include "srcpos.h"
 #include "dtc-parser.tab.h"
 
-YYLTYPE yylloc;
-
 /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
 #define        YY_USER_ACTION \
        { \
index 2d30f41778b7270b074798b4439952dca28d9c53..eb403e08a74387d8f13beb8119dbc4cffe9abeb4 100644 (file)
@@ -637,8 +637,6 @@ char *yytext;
 #include "srcpos.h"
 #include "dtc-parser.tab.h"
 
-YYLTYPE yylloc;
-
 /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
 #define        YY_USER_ACTION \
        { \
index 25d3b88c61320bb2525341a66ec2fc556a2fc800..246fb0e994c6923f48be40fc1af00b731cedf074 100644 (file)
@@ -101,5 +101,6 @@ typedef union YYSTYPE
 #endif
 
 extern YYSTYPE yylval;
+extern YYLTYPE yylloc;