Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Oct 2001 01:19:01 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Dag-Erling Smorgrav <des@FreeBSD.org>
Cc:        <cvs-committers@FreeBSD.org>, <cvs-all@FreeBSD.org>
Subject:   Re: cvs commit: src/lib/libfetch Makefile common.c common.h ftp.c  http.c
Message-ID:  <20011019010459.L25252-100000@delplex.bde.org>
In-Reply-To: <200110180829.f9I8TQj26821@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 18 Oct 2001, Dag-Erling Smorgrav wrote:

> des         2001/10/18 01:29:26 PDT
>
>   Modified files:
>     lib/libfetch         Makefile common.c common.h ftp.c http.c
>   Log:
>   Tons of type, style and warning fixes that have been rotting in my tree for
>   ages - some of which wouldn't be necessary if gcc wasn't broken or TPTB were
>   willing to do something (-fno-builtin) about it.
>
>   Revision  Changes    Path
>   1.23      +31 -9     src/lib/libfetch/Makefile
>   1.21      +8 -5      src/lib/libfetch/common.c
>   1.16      +11 -11    src/lib/libfetch/common.h
>   1.71      +29 -29    src/lib/libfetch/ftp.c
>   1.45      +24 -18    src/lib/libfetch/http.c

This adds lots of digusting gcc-specific-hacks which have been rejected in
other source files.  E.g.:

> Index: common.c
> ===================================================================
> RCS file: /home/ncvs/src/lib/libfetch/common.c,v
> retrieving revision 1.20
> retrieving revision 1.21
> diff -c -1 -r1.20 -r1.21
> *** common.c	30 Sep 2001 21:36:08 -0000	1.20
> --- common.c	18 Oct 2001 08:29:26 -0000	1.21
> ***************
> *** 29,31 ****
>   #include <sys/cdefs.h>
> ! __FBSDID("$FreeBSD: src/lib/libfetch/common.c,v 1.20 2001/09/30 21:36:08 dillon Exp $");
>
> --- 29,31 ----
>   #include <sys/cdefs.h>
> ! __FBSDID("$FreeBSD: src/lib/libfetch/common.c,v 1.21 2001/10/18 08:29:26 des Exp $");
>
> ***************
> *** 342,350 ****
>       /* XXX should enforce timeout */
> !     iov[0].iov_base = (char *)str;
>       iov[0].iov_len = len;
> !     iov[1].iov_base = (char *)ENDL;
>       iov[1].iov_len = sizeof ENDL;
>       wlen = writev(fd, iov, 2);
>       DEBUG(fprintf(stderr, "\033[1m>>> %s\n\033[m", str));
> !     return (wlen != len);
>   }
> --- 342,353 ----
>       /* XXX should enforce timeout */
> !     (const char *)iov[0].iov_base = str; /* XXX */

Casts are not lvalues in C.

>       iov[0].iov_len = len;
> !     (const char *)iov[1].iov_base = ENDL; /* XXX */

Another.

>       iov[1].iov_len = sizeof ENDL;
> +     len += sizeof ENDL;
>       wlen = writev(fd, iov, 2);
> +     if (wlen < 0 || (size_t)wlen != len)
> + 	return -1;
>       DEBUG(fprintf(stderr, "\033[1m>>> %s\n\033[m", str));
> !     return 0;
>   }

C compilers don't get far with this.  E.g.:

$ make CC='tcc -Ysystem'
Warning: Using /usr/src/lib/libfetch/obj as object directory instead of canonical /usr/obj/usr/src/lib/libfetch
tcc -Ysystem -O -pipe  -I. -DINET6 -DNDEBUG -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Werror -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow  -c /usr/src/lib/libfetch/fetch.c -o fetch.o
tcc: Warning: Unknown option, -pipe.
tcc: Warning: Unknown option, -W.
tcc: Warning: Unknown option, -Wall.
tcc: Warning: Unknown option, -Wstrict-prototypes.
tcc: Warning: Unknown option, -Wmissing-prototypes.
tcc: Warning: Unknown option, -Wpointer-arith.
tcc: Warning: Unknown option, -Wno-uninitialized.
tcc: Warning: Unknown option, -Werror.
tcc: Warning: Unknown option, -Wreturn-type.
tcc: Warning: Unknown option, -Wcast-qual.
tcc: Warning: Unknown option, -Wwrite-strings.
tcc: Warning: Unknown option, -Wswitch.
tcc: Warning: Unknown option, -Wshadow.
tcc -Ysystem -O -pipe  -I. -DINET6 -DNDEBUG -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Werror -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow  -c /usr/src/lib/libfetch/common.c -o common.o
tcc: Warning: Unknown option, -pipe.
tcc: Warning: Unknown option, -W.
tcc: Warning: Unknown option, -Wall.
tcc: Warning: Unknown option, -Wstrict-prototypes.
tcc: Warning: Unknown option, -Wmissing-prototypes.
tcc: Warning: Unknown option, -Wpointer-arith.
tcc: Warning: Unknown option, -Wno-uninitialized.
tcc: Warning: Unknown option, -Werror.
tcc: Warning: Unknown option, -Wreturn-type.
tcc: Warning: Unknown option, -Wcast-qual.
tcc: Warning: Unknown option, -Wwrite-strings.
tcc: Warning: Unknown option, -Wswitch.
tcc: Warning: Unknown option, -Wshadow.
"/usr/src/lib/libfetch/common.c", line 343: Error:
  [Syntax]: Parse error before '='.
  [Syntax]: Can't recover from this error.

*** Error code 1

Stop in /usr/src/lib/libfetch.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011019010459.L25252-100000>