Date: Tue, 12 Jun 2001 15:53:18 +0300 From: Ruslan Ermilov <ru@FreeBSD.org> To: current@FreeBSD.org Cc: Bruce Evans <bde@FreeBSD.org>, Garrett Wollman <wollman@FreeBSD.org>, Warner Losh <imp@FreeBSD.org> Subject: Patch to restore WARNS feature Message-ID: <20010612155318.B79617@sunbay.com> In-Reply-To: <20010611212628.A37954@sunbay.com>; from ru@FreeBSD.org on Mon, Jun 11, 2001 at 09:26:28PM %2B0300
next in thread | previous in thread | raw e-mail | index | archive | help
--KN5l+BnMqAQyZLvT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi! The attached patch enables us to restore the -Werror bit of the WARNS feature by fixing relevant headers and adding one new header, complex.h, aligned with the POSIX.1-200x draft. I did not fix the CSRG's libm (-DWANT_CSRG_LIBM) because it does not compile with the current sources for the reason of missing library functions. Also, the -traditional-cpp bit in games/adventure/Makefile correlares badly with -nostdinc and WARNS=2. Please review (tested). Cheers, -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --KN5l+BnMqAQyZLvT Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Index: Makefile.inc1 =================================================================== RCS file: /home/ncvs/src/Makefile.inc1,v retrieving revision 1.203 diff -u -p -r1.203 Makefile.inc1 --- Makefile.inc1 2001/06/11 18:09:08 1.203 +++ Makefile.inc1 2001/06/12 12:39:19 @@ -200,7 +200,7 @@ WMAKEENV= ${CROSSENV} \ DESTDIR=${WORLDTMP} \ INSTALL="sh ${.CURDIR}/tools/install.sh" \ PATH=${TMPPATH} -WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 -DNO_WERROR +WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 # install stage IMAKEENV= ${CROSSENV} \ Index: games/adventure/Makefile =================================================================== RCS file: /home/ncvs/src/games/adventure/Makefile,v retrieving revision 1.10 diff -u -p -r1.10 Makefile --- games/adventure/Makefile 2001/05/20 05:37:46 1.10 +++ games/adventure/Makefile 2001/06/12 12:39:19 @@ -4,7 +4,6 @@ PROG= adventure SRCS= main.c init.c done.c save.c subr.c vocab.c wizard.c io.c data.c crc.c MAN= adventure.6 -CFLAGS+=-traditional-cpp HIDEGAME=hidegame CLEANFILES=data.c setup setup.o Index: include/Makefile =================================================================== RCS file: /home/ncvs/src/include/Makefile,v retrieving revision 1.146 diff -u -p -r1.146 Makefile --- include/Makefile 2001/06/07 05:04:53 1.146 +++ include/Makefile 2001/06/12 12:39:19 @@ -8,7 +8,8 @@ CLEANFILES= osreldate.h version vers.c SUBDIR= rpcsvc rpc -FILES= a.out.h ar.h assert.h bitstring.h ctype.h db.h dirent.h disktab.h \ +FILES= a.out.h ar.h assert.h bitstring.h complex.h ctype.h db.h \ + dirent.h disktab.h \ dlfcn.h elf.h elf-hints.h err.h fnmatch.h fstab.h \ fts.h glob.h grp.h strhash.h \ hesiod.h histedit.h ieeefp.h ifaddrs.h iso646.h langinfo.h \ Index: include/complex.h =================================================================== RCS file: complex.h diff -N complex.h --- /dev/null Tue Jun 12 03:18:33 2001 +++ complex.h Tue Jun 12 15:39:19 2001 @@ -0,0 +1,60 @@ +/*- + * Copyright (c) 2001 The FreeBSD Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _COMPLEX_H +#define _COMPLEX_H + +#ifdef __GNUC__ +#define _Complex __complex__ +#define _Complex_I 1.0fi +#endif + +#define complex _Complex +#define I _Complex_I + +#include <sys/cdefs.h> + +__BEGIN_DECLS + +double cabs __P((double complex)); +float cabsf __P((float complex)); +double cimag __P((double complex)); +float cimagf __P((float complex)); +double creal __P((double complex)); +float crealf __P((float complex)); + +__END_DECLS + +#ifdef __GNUC__ +#define cimag(z) (__imag__ (z)) +#define cimagf(z) (__imag__ (z)) +#define creal(z) (__real__ (z)) +#define crealf(z) (__real__ (z)) +#endif + +#endif /* _COMPLEX_H */ Index: include/fts.h =================================================================== RCS file: /home/ncvs/src/include/fts.h,v retrieving revision 1.3 diff -u -p -r1.3 fts.h --- include/fts.h 1997/05/07 19:59:58 1.3 +++ include/fts.h 2001/06/12 12:39:19 @@ -45,7 +45,8 @@ typedef struct { int fts_rfd; /* fd for root */ int fts_pathlen; /* sizeof(path) */ int fts_nitems; /* elements in the sort array */ - int (*fts_compar)(); /* compare function */ + int (*fts_compar) /* compare function */ + __P((const struct _ftsent **, const struct _ftsent **)); #define FTS_COMFOLLOW 0x001 /* follow command line symlinks */ #define FTS_LOGICAL 0x002 /* logical walk */ Index: lib/libc/gen/fts.c =================================================================== RCS file: /home/ncvs/src/lib/libc/gen/fts.c,v retrieving revision 1.18 diff -u -p -r1.18 fts.c --- lib/libc/gen/fts.c 2001/06/01 21:53:50 1.18 +++ lib/libc/gen/fts.c 2001/06/12 12:39:20 @@ -936,7 +936,8 @@ fts_sort(sp, head, nitems) } for (ap = sp->fts_array, p = head; p; p = p->fts_link) *ap++ = p; - qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), sp->fts_compar); + qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), + (int (*) __P((const void *, const void *)))sp->fts_compar); for (head = *(ap = sp->fts_array); --nitems; ++ap) ap[0]->fts_link = ap[1]; ap[0]->fts_link = NULL; Index: lib/msun/src/math.h =================================================================== RCS file: /home/ncvs/src/lib/msun/src/math.h,v retrieving revision 1.9 diff -u -p -r1.9 math.h --- lib/msun/src/math.h 2000/03/27 02:04:45 1.9 +++ lib/msun/src/math.h 2001/06/12 12:39:20 @@ -174,7 +174,6 @@ extern double scalbn __P((double, int)); /* * BSD math library entry points */ -extern double cabs(); extern double drem __P((double, double)); extern double expm1 __P((double)); extern double log1p __P((double)); @@ -257,7 +256,6 @@ extern float scalbnf __P((float, int)); /* * float versions of BSD math library entry points */ -extern float cabsf (); extern float dremf __P((float, float)); extern float expm1f __P((float)); extern float log1pf __P((float)); Index: lib/msun/src/w_cabs.c =================================================================== RCS file: /home/ncvs/src/lib/msun/src/w_cabs.c,v retrieving revision 1.3 diff -u -p -r1.3 w_cabs.c --- lib/msun/src/w_cabs.c 1995/05/30 05:50:47 1.3 +++ lib/msun/src/w_cabs.c 2001/06/12 12:39:20 @@ -5,23 +5,24 @@ * Placed into the Public Domain, 1994. */ -#include <math.h> +#ifndef lint +static const char rcsid[] = + "$FreeBSD$"; +#endif /* not lint */ -struct complex { - double x; - double y; -}; +#include <complex.h> +#include <math.h> double cabs(z) - struct complex z; + double complex z; { - return hypot(z.x, z.y); + return hypot(creal(z), cimag(z)); } double z_abs(z) - struct complex *z; + double complex *z; { - return hypot(z->x, z->y); + return hypot(creal(*z), cimag(*z)); } Index: lib/msun/src/w_cabsf.c =================================================================== RCS file: /home/ncvs/src/lib/msun/src/w_cabsf.c,v retrieving revision 1.2 diff -u -p -r1.2 w_cabsf.c --- lib/msun/src/w_cabsf.c 1995/05/30 05:50:48 1.2 +++ lib/msun/src/w_cabsf.c 2001/06/12 12:39:20 @@ -5,17 +5,19 @@ * Placed into the Public Domain, 1994. */ -#include "math.h" -#include "math_private.h" +#ifndef lint +static const char rcsid[] = + "$FreeBSD$"; +#endif /* not lint */ -struct complex { - float x; - float y; -}; +#include <complex.h> +#include <math.h> +#include "math_private.h" float cabsf(z) - struct complex z; + float complex z; { - return hypotf(z.x, z.y); + + return hypotf(crealf(z), cimagf(z)); } --KN5l+BnMqAQyZLvT-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010612155318.B79617>