Bug 16873 - GDB 7.7 does not build with GCC 4.9
Summary: GDB 7.7 does not build with GCC 4.9
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: build (show other bugs)
Version: 7.7
: P2 normal
Target Milestone: ---
Assignee: Sergio Durigan Junior
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-24 22:43 UTC by Sergio Durigan Junior
Modified: 2014-04-24 23:18 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergio Durigan Junior 2014-04-24 22:43:33 UTC
This bug is about building GDB 7.7 with GCC 4.9.  Currently, this leads to some errors coming from BFD:

In file included from ../../gdb/defs.h:104:0,
                 from ../../gdb/cli/cli-dump.c:22:
../../gdb/cli/cli-dump.c: In function 'dump_bfd_file':
../bfd/bfd.h:302:108: error: right-hand operand of comma expression has no effect [-Werror=unused-value]
 #define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
                                                                                                            ^
../../gdb/cli/cli-dump.c:197:3: note: in expansion of macro 'bfd_set_section_vma'
   bfd_set_section_vma (obfd, osection, vaddr);
   ^
../bfd/bfd.h:303:83: error: right-hand operand of comma expression has no effect [-Werror=unused-value]
 #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
                                                                                   ^
../../gdb/cli/cli-dump.c:198:3: note: in expansion of macro 'bfd_set_section_alignment'
   bfd_set_section_alignment (obfd, osection, 0);

The fix already exists on the master branch:

commit 27b829ee701e29804216b3803fbaeb629be27491
Author: Nick Clifton <nickc@redhat.com>
Date:   Wed Jan 29 13:46:39 2014 +0000

It is just a matter of backporting it to the 7.7 branch before the 7.7.1 release.  I am creating this bug to document the issue.
Comment 1 Sourceware Commits 2014-04-24 23:16:06 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, gdb-7.7-branch has been updated
       via  8a90a4ef6a9c5acb6fd363c7c556682578aa9254 (commit)
      from  87a1630ead223311c409d19e98553c4fa363cb59 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

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

commit 8a90a4ef6a9c5acb6fd363c7c556682578aa9254
Author: Nick Clifton <nickc@redhat.com>
Date:   Wed Jan 29 13:46:39 2014 +0000

    Following up on Tom's suggestion I am checking in a patch to replace the various
    bfd_xxx_set macros with static inline functions, so that we can avoid compile time
    warnings about comma expressions with unused values.
    
    	PR build/16873
    	* bfd-in.h (bfd_set_section_vma): Delete.
    	(bfd_set_section_alignment): Delete.
    	(bfd_set_section_userdata): Delete.
    	(bfd_set_cacheable): Delete.
    	* bfd.c (bfd_set_cacheable): New static inline function.
    	* section.c (bfd_set_section_userdata): Likewise.
    	(bfd_set_section_vma): Likewise.
    	(bfd_set_section_alignment): Likewise.
    	* bfd-in2.h: Regenerate.

-----------------------------------------------------------------------

Summary of changes:
 bfd/ChangeLog |   14 ++++++++++++++
 bfd/bfd-in.h  |    5 -----
 bfd/bfd-in2.h |   41 +++++++++++++++++++++++++++++++++++------
 bfd/bfd.c     |    8 ++++++++
 bfd/section.c |   26 ++++++++++++++++++++++++++
 5 files changed, 83 insertions(+), 11 deletions(-)
Comment 2 Sergio Durigan Junior 2014-04-24 23:18:56 UTC
Fixed.