Fix C99-ism in gas/subsegs.c

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Fix C99-ism in gas/subsegs.c

Hans-Peter Nilsson
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.

gas:
        * 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)
 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)
     return;

brgds, H-P
Reply | Threaded
Open this post in threaded view
|

Re: Fix C99-ism in gas/subsegs.c

Alan Modra
On Thu, Aug 11, 2005 at 06:22:37PM +0200, Hans-Peter Nilsson wrote:
> I thought there were have warnings enabled that should catch this?

Oops, that was me ripping out non BFD_ASSEMBLER code.

> Committed as obvious.
>
> gas:
> * subsegs.c (subseg_change): Move declaration of seginfo to before
> first statement.

--
Alan Modra
IBM OzLabs - Linux Technology Centre