X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f Date: Tue, 12 Feb 2002 08:30:06 +0200 (WET) From: Andris Pavenis X-Sender: pavenis AT ieva06 To: Richard Dawe Cc: djgpp-workers AT delorie DOT com Subject: Re: GCC-3.1 related patches for DJGPP CVS version In-Reply-To: <3C682BBD.12967A63@phekda.freeserve.co.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Mon, 11 Feb 2002, Richard Dawe wrote: > Hello. > > pavenis AT lanet DOT lv wrote: > > Tried to compile DJGPP today's CVS version with GCC-3.1 20020210. > > To get it to compile applied included patches. > > > > 1) internal representation of __builtin_va_list changed to char *, as result > > many breakages. Mostly added some ugly type casts > > > > 2) warning were generated about snprintf with empty format. > > > > Perhaps changes which only requires using va_list of something more ugly > > but not explicit casts from (or to) va_list can be applied. I don't know > > about other ones though > > These look OK to me, apart from a couple of things. See my comments inline > below. > > [snip] > > diff -ur3 djgpp.orig/src/libc/ansi/stdio/fscanf.c > > djgpp/src/libc/ansi/stdio/fscanf.c > > --- djgpp.orig/src/libc/ansi/stdio/fscanf.c Mon Dec 26 22:34:48 1994 > > +++ djgpp/src/libc/ansi/stdio/fscanf.c Mon Feb 11 17:49:18 2002 > > @@ -9,7 +9,7 @@ > > int r; > > va_list a=0; > > va_start(a, fmt); > > I don't think that 'a' needs initialising in its definition. You're right of course. It somehow slipped in ... > > > - r = _doscan(f, fmt, a); > > + r = _doscan(f, fmt, (void **) a); > > Yuck. Wouldn't it be better to modify _doscan to work on a va_list too? > Perhaps > > va_end(a); > > return r; > > } > > [snip] > > diff -ur3 djgpp.orig/src/libc/ansi/stdio/scanf.c > > djgpp/src/libc/ansi/stdio/scanf.c > > --- djgpp.orig/src/libc/ansi/stdio/scanf.c Mon Dec 26 22:34:54 1994 > > +++ djgpp/src/libc/ansi/stdio/scanf.c Mon Feb 11 17:49:38 2002 > > @@ -9,7 +9,7 @@ > > int r; > > va_list a=0; > > va_start(a, fmt); > > - r = _doscan(stdin, fmt, a); > > + r = _doscan(stdin, fmt, (void **) a); > > va_end(a); > > return r; > > } > > See the comments for fscanf.c. > > [snip] > > diff -ur3 djgpp.orig/src/libc/posix/unistd/confstr.c > > djgpp/src/libc/posix/unistd/confstr.c > > --- djgpp.orig/src/libc/posix/unistd/confstr.c Wed Jun 20 02:00:46 2001 > > +++ djgpp/src/libc/posix/unistd/confstr.c Mon Feb 11 18:17:28 2002 > > @@ -43,7 +43,9 @@ > > case _CS_POSIX_V6_ILP32_OFF32_LDFLAGS: > > case _CS_POSIX_V6_ILP32_OFF32_LIBS: > > { > > - out_len = snprintf(buf, len, ""); > > +/* out_len = snprintf(buf, len, ""); */ > > + if (len>0) *buf=0; > > + out_len=0; > > ++out_len; > > break; > > } > > Why not just set out_len to 1? Also, presumably the comment will be removed > too? snprintf should output number of outputted chars not including trailing \0 AFAIK, so 0 is correct. gcc-3.1 20020210 emitted warning about empty format string. Maybe it will not be so later, so I left snprintf in comment. We could also revert this change when (if) we'll need some real snprintf there. Andris