From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 92CF6395A41A; Thu, 2 Jun 2022 15:28:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92CF6395A41A Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] ODR warnings for struct symloc X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 57ebc9901305133000100fa7764dac94b4208a3b X-Git-Newrev: 77845a9ac6871b2480b1533b70831db320233885 Message-Id: <20220602152858.92CF6395A41A@sourceware.org> Date: Thu, 2 Jun 2022 15:28:58 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2022 15:28:58 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D77845a9ac687= 1b2480b1533b70831db320233885 commit 77845a9ac6871b2480b1533b70831db320233885 Author: Tom Tromey Date: Tue May 10 08:56:26 2022 -0600 ODR warnings for struct symloc =20 "struct symloc" is defined in multiple spots in gdb, causing ODR warnings. This patch renames these. =20 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D22395 Diff: --- gdb/mdebugread.c | 10 +++++----- gdb/xcoffread.c | 28 ++++++++++++++-------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index ca7c15ee63f..a2280c3ba8d 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -86,7 +86,7 @@ static struct objfile *mdebugread_objfile; /* We put a pointer to this structure in the read_symtab_private field of the psymtab. */ =20 -struct symloc +struct md_symloc { /* Index of the FDR that this psymtab represents. */ int fdr_idx; @@ -102,7 +102,7 @@ struct symloc enum language pst_language; }; =20 -#define PST_PRIVATE(p) ((struct symloc *)(p)->read_symtab_private) +#define PST_PRIVATE(p) ((struct md_symloc *)(p)->read_symtab_private) #define FDR_IDX(p) (PST_PRIVATE(p)->fdr_idx) #define CUR_BFD(p) (PST_PRIVATE(p)->cur_bfd) #define DEBUG_SWAP(p) (PST_PRIVATE(p)->debug_swap) @@ -2604,8 +2604,8 @@ parse_partial_symbols (minimal_symbol_reader &reader, textlow =3D 0; pst =3D new legacy_psymtab (fdr_name (fh), partial_symtabs, objfile->per_bfd, textlow); - pst->read_symtab_private =3D XOBNEW (&objfile->objfile_obstack, syml= oc); - memset (pst->read_symtab_private, 0, sizeof (struct symloc)); + pst->read_symtab_private =3D XOBNEW (&objfile->objfile_obstack, md_s= ymloc); + memset (pst->read_symtab_private, 0, sizeof (struct md_symloc)); =20 save_pst =3D pst; FDR_IDX (pst) =3D f_idx; @@ -4649,7 +4649,7 @@ new_psymtab (const char *name, psymtab_storage *parti= al_symtabs, /* Keep a backpointer to the file's symbols. */ =20 psymtab->read_symtab_private - =3D OBSTACK_ZALLOC (&objfile->objfile_obstack, symloc); + =3D OBSTACK_ZALLOC (&objfile->objfile_obstack, md_symloc); CUR_BFD (psymtab) =3D cur_bfd; DEBUG_SWAP (psymtab) =3D debug_swap; DEBUG_INFO (psymtab) =3D debug_info; diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index d8735d29ede..9adc841b1f1 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -59,7 +59,7 @@ /* We put a pointer to this structure in the read_symtab_private field of the psymtab. */ =20 -struct symloc +struct xcoff_symloc { =20 /* First symbol number for this file. */ @@ -598,7 +598,7 @@ process_linenos (CORE_ADDR start, CORE_ADDR end) unsigned *firstLine; =20 offset =3D - ((struct symloc *) this_symtab_psymtab->read_symtab_private)->lineno_o= ff; + ((struct xcoff_symloc *) this_symtab_psymtab->read_symtab_private)->li= neno_off; if (offset =3D=3D 0) goto return_after_cleanup; =20 @@ -966,9 +966,9 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psym= tab *pst) start_compunit_symtab (objfile, filestring, NULL, file_start_addr, pst_symtab_language); record_debugformat (debugfmt); - symnum =3D ((struct symloc *) pst->read_symtab_private)->first_symnum; + symnum =3D ((struct xcoff_symloc *) pst->read_symtab_private)->first_sym= num; max_symnum =3D - symnum + ((struct symloc *) pst->read_symtab_private)->numsyms; + symnum + ((struct xcoff_symloc *) pst->read_symtab_private)->numsyms; first_object_file_end =3D 0; =20 raw_symbol =3D xcoff->symtbl + symnum * local_symesz; @@ -1747,7 +1747,7 @@ xcoff_expand_psymtab (legacy_psymtab *pst, struct obj= file *objfile) /* Read in all partial symtabs on which this one is dependent. */ pst->expand_dependencies (objfile); =20 - if (((struct symloc *) pst->read_symtab_private)->numsyms !=3D 0) + if (((struct xcoff_symloc *) pst->read_symtab_private)->numsyms !=3D 0) { /* Init stuff necessary for reading in symbols. */ stabsread_init (); @@ -1767,7 +1767,7 @@ xcoff_read_symtab (legacy_psymtab *self, struct objfi= le *objfile) { gdb_assert (!self->readin); =20 - if (((struct symloc *) self->read_symtab_private)->numsyms !=3D 0 + if (((struct xcoff_symloc *) self->read_symtab_private)->numsyms !=3D 0 || self->number_of_dependencies) { next_symbol_text_func =3D xcoff_next_symbol_text; @@ -1892,8 +1892,8 @@ xcoff_start_psymtab (psymtab_storage *partial_symtabs, objfile->per_bfd, 0); =20 result->read_symtab_private =3D - XOBNEW (&objfile->objfile_obstack, struct symloc); - ((struct symloc *) result->read_symtab_private)->first_symnum =3D first_= symnum; + XOBNEW (&objfile->objfile_obstack, struct xcoff_symloc); + ((struct xcoff_symloc *) result->read_symtab_private)->first_symnum =3D = first_symnum; result->legacy_read_symtab =3D xcoff_read_symtab; result->legacy_expand_psymtab =3D xcoff_expand_psymtab; =20 @@ -1922,10 +1922,10 @@ xcoff_end_psymtab (struct objfile *objfile, psymtab= _storage *partial_symtabs, int i; =20 if (capping_symbol_number !=3D -1) - ((struct symloc *) pst->read_symtab_private)->numsyms =3D + ((struct xcoff_symloc *) pst->read_symtab_private)->numsyms =3D capping_symbol_number - - ((struct symloc *) pst->read_symtab_private)->first_symnum; - ((struct symloc *) pst->read_symtab_private)->lineno_off =3D + - ((struct xcoff_symloc *) pst->read_symtab_private)->first_symnum; + ((struct xcoff_symloc *) pst->read_symtab_private)->lineno_off =3D first_fun_line_offset; first_fun_line_offset =3D 0; =20 @@ -1947,9 +1947,9 @@ xcoff_end_psymtab (struct objfile *objfile, psymtab_s= torage *partial_symtabs, legacy_psymtab *subpst =3D new legacy_psymtab (include_list[i], partial_symtabs, objfile->per_bfd); =20 - subpst->read_symtab_private =3D XOBNEW (&objfile->objfile_obstack, s= ymloc); - ((struct symloc *) subpst->read_symtab_private)->first_symnum =3D 0; - ((struct symloc *) subpst->read_symtab_private)->numsyms =3D 0; + subpst->read_symtab_private =3D XOBNEW (&objfile->objfile_obstack, x= coff_symloc); + ((struct xcoff_symloc *) subpst->read_symtab_private)->first_symnum = =3D 0; + ((struct xcoff_symloc *) subpst->read_symtab_private)->numsyms =3D 0; =20 /* We could save slight bits of space by only making one of these, shared by the entire set of include files. FIXME-someday. */