Bug 30839 - ODR warnings in ada-exp.c.tmp/c-exp.c.tmp
Summary: ODR warnings in ada-exp.c.tmp/c-exp.c.tmp
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: build (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 14.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 22395
  Show dependency treegraph
 
Reported: 2023-09-11 20:02 UTC by Sam James
Modified: 2023-09-27 07:36 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
build.log.xz (59.71 KB, application/x-xz)
2023-09-11 20:03 UTC, Sam James
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James 2023-09-11 20:02:50 UTC
From today at commit 9a343d2bb57c4555dedad9b43907aeeda7b51dae:
```
ada-exp.c.tmp:1747:3: error: type 'struct YYSTACKDATA' violates the C++ One Definition Rule [-Werror=odr]
c-exp.c.tmp:3936:3: note: a different type is defined in another translation unit
ada-exp.c.tmp:1741:23: note: the first difference of corresponding definitions is field 'l_base'
c-exp.c.tmp:3930:21: note: a field of same name but different type is defined in another translation unit
ada-exp.c.tmp:1747:3: note: type name 'ada_exp_YYSTYPE' should match type name 'c_exp_YYSTYPE'
lto1: some warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/x86_64-pc-linux-gnu-g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
```
Comment 1 Sam James 2023-09-11 20:03:25 UTC
Created attachment 15108 [details]
build.log.xz
Comment 2 Tom de Vries 2023-09-11 20:48:05 UTC
Does adding a GDB_YY_REMAP line in gdb/yy-remap.h fix it?
Comment 3 Sam James 2023-09-11 21:17:14 UTC
(In reply to Tom de Vries from comment #2)
> Does adding a GDB_YY_REMAP line in gdb/yy-remap.h fix it?

Yeah, it does (this is with byacc, btw).

```
diff --git a/gdb/yy-remap.h b/gdb/yy-remap.h
index 33bee0fabdb..d0125b9ed45 100644
--- a/gdb/yy-remap.h
+++ b/gdb/yy-remap.h
@@ -85,6 +85,7 @@
 #define yystacksize    GDB_YY_REMAP (yystacksize)
 #define yyvs           GDB_YY_REMAP (yyvs)
 #define yyvsp          GDB_YY_REMAP (yyvsp)
+#define YYSTACKDATA    GDB_YY_REMAP (YYSTACKDATA)

 /* The following are common to all parsers.  */

```
seems to work?
Comment 4 Tom de Vries 2023-09-11 21:25:23 UTC
Cool.  Then(In reply to Sam James from comment #3)
> (In reply to Tom de Vries from comment #2)
> > Does adding a GDB_YY_REMAP line in gdb/yy-remap.h fix it?
> 
> Yeah, it does (this is with byacc, btw).
> 

Nice, thanks.  I guess you could commit as obvious.

> ```
> diff --git a/gdb/yy-remap.h b/gdb/yy-remap.h
> index 33bee0fabdb..d0125b9ed45 100644
> --- a/gdb/yy-remap.h
> +++ b/gdb/yy-remap.h
> @@ -85,6 +85,7 @@
>  #define yystacksize    GDB_YY_REMAP (yystacksize)
>  #define yyvs           GDB_YY_REMAP (yyvs)
>  #define yyvsp          GDB_YY_REMAP (yyvsp)
> +#define YYSTACKDATA    GDB_YY_REMAP (YYSTACKDATA)
> 
>  /* The following are common to all parsers.  */
> 
> ```
> seems to work?
Comment 6 Sourceware Commits 2023-09-27 07:35:25 UTC
The master branch has been updated by Sam James <sjames@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=df940f8bb348cf90445195ed4a34cddf9af634f6

commit df940f8bb348cf90445195ed4a34cddf9af634f6
Author: Sam James <sam@gentoo.org>
Date:   Tue Sep 12 01:46:51 2023 +0100

    gdb: Fix an ODR warning with byacc with GDB_YY_REMAP
    
    With byacc, we get an ODR warning with YYSTACKDATA between ada-exp.c.tmp
    and c-exp.c.tmp. Just include it in the list of symbols we rename.
    
    PR gdb/30839
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30839
    Approved-By: Tom de Vries <tdevries@suse.de>
    Copyright-paperwork-exempt: yes
Comment 7 Sam James 2023-09-27 07:36:35 UTC
Fixed for 14.