Fix C99-ism in gas/subsegs.c

Hans-Peter Nilsson
Thu Aug 11 16:22:00 GMT 2005

Found with an apparently old-enough gcc (RH 7.3):

gcc -DHAVE_CONFIG_H -I. -I/h/hp/binutils/cvs_latest/src/gas -I. -D_GNU_SOURCE -I. -I/h/hp/binutils/cvs_latest/src/gas -I../bfd -I/h/hp/binutils/cvs_latest/src/gas/config -I/h/hp/binutils/cvs_latest/src/gas/../include -I/h/hp/binutils/cvs_latest/src/gas/.. -I/h/hp/binutils/cvs_latest/src/gas/../bfd -I/h/hp/binutils/cvs_latest/src/gas/../intl -I../intl -DLOCALEDIR="\"/usr/local/share/locale\""   -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c /h/hp/binutils/cvs_latest/src/gas/subsegs.c
/h/hp/binutils/cvs_latest/src/gas/subsegs.c: In function `subseg_change':
/h/hp/binutils/cvs_latest/src/gas/subsegs.c:80: parse error before `*'
/h/hp/binutils/cvs_latest/src/gas/subsegs.c:85: `seginfo' undeclared (first use in this function)
/h/hp/binutils/cvs_latest/src/gas/subsegs.c:85: (Each undeclared identifier is reported only once
/h/hp/binutils/cvs_latest/src/gas/subsegs.c:85: for each function it appears in.)
cc1: warnings being treated as errors
/h/hp/binutils/cvs_latest/src/gas/subsegs.c:99: warning: left-hand operand of comma expression has no effect
/h/hp/binutils/cvs_latest/src/gas/subsegs.c:99: warning: statement with no effect

I thought there were have warnings enabled that should catch this?
Committed as obvious.

	* subsegs.c (subseg_change): Move declaration of seginfo to before
	first statement.

Index: subsegs.c
RCS file: /cvs/src/src/gas/subsegs.c,v
retrieving revision 1.26
diff -u -p -r1.26 subsegs.c
--- subsegs.c	11 Aug 2005 01:25:20 -0000	1.26
+++ subsegs.c	11 Aug 2005 16:16:31 -0000
@@ -75,9 +75,9 @@ subsegs_begin (void)
 subseg_change (register segT seg, register int subseg)
+  segment_info_type *seginfo;
   now_seg = seg;
   now_subseg = subseg;
-  segment_info_type *seginfo;
   if (now_seg == absolute_section)

brgds, H-P

More information about the Binutils mailing list