Bug 18607 - binutils compilation fails with warning "right-hand operand of comma expression has no effect"
Summary: binutils compilation fails with warning "right-hand operand of comma expressi...
Status: RESOLVED INVALID
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-27 10:51 UTC by Hanno Boeck
Modified: 2015-07-08 04:03 UTC (History)
1 user (show)

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 Hanno Boeck 2015-06-27 10:51:14 UTC
The current git code of binutils fails to compile for me, likely a gcc 4.9 issue.

gcc -DHAVE_CONFIG_H -I.  -I. -I. -I../bfd -I./config -I./../include -I./.. -I./../bfd -DLOCALEDIR="\"/usr/local/share/locale\""  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT subsegs.o -MD -MP -MF .deps/subsegs.Tpo -c -o subsegs.o subsegs.c
In file included from as.h:95:0,
                 from subsegs.c:25:
subsegs.c: In function ‘subseg_change’:
../bfd/bfd.h:304:75: error: right-hand operand of comma expression has no effect [-Werror=unused-value]
 #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
                                                                           ^
subsegs.c:70:7: note: in expansion of macro ‘bfd_set_section_userdata’
       bfd_set_section_userdata (stdoutput, seg, seginfo);
       ^
subsegs.c: In function ‘subseg_get’:
../bfd/bfd.h:304:75: error: right-hand operand of comma expression has no effect [-Werror=unused-value]
 #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)


The -Werror=unused-value makes these warnings fatal and lets the compile fail.

I didn't do anything special, just ./configure; make on an up-to-date Gentoo system with gcc 4.9.2

I've seen that similar issues were already reported and fixed in January:
https://sourceware.org/ml/binutils/2014-01/msg00334.html
Comment 1 Alan Modra 2015-07-08 04:03:05 UTC
You are not compiling the current git code.  Please check that you are using the correct git url, and have checked out the master branch.