delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/02/11/16:06:44

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3C682BBD.12967A63@phekda.freeserve.co.uk>
Date: Mon, 11 Feb 2002 20:38:21 +0000
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: GCC-3.1 related patches for DJGPP CVS version
References: <3C6811F1 DOT 25868 DOT 10A3D21 AT localhost>
Reply-To: djgpp-workers AT delorie DOT com

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.

> -  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?

>    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?

[snip]

Bye, Rich =]

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019