From owner-freebsd-arch@FreeBSD.ORG Sat Jun 14 08:27:07 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0AD4437B401 for ; Sat, 14 Jun 2003 08:27:07 -0700 (PDT) Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7114643F93 for ; Sat, 14 Jun 2003 08:27:06 -0700 (PDT) (envelope-from des@ofug.org) Received: by flood.ping.uio.no (Postfix, from userid 2602) id 2F164530E; Sat, 14 Jun 2003 17:27:05 +0200 (CEST) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: arch@freebsd.org From: Dag-Erling Smorgrav Date: Sat, 14 Jun 2003 17:27:04 +0200 Message-ID: User-Agent: Gnus/5.1001 (Gnus v5.10.1) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Subject: unbreaking alloca X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jun 2003 15:27:07 -0000 --=-=-= David's latest commit to cdefs.h breaks the build by causing lint to fail for every source file that directly or indirectly includes ; it will similarly cause non-GNU compilers to fail on the same files. This is entirely unnecessary as the patch was only meant to add alloca(3) support on compilers that support it. I'd like to commit the attached patch (after suitable testing of course). It removes all mention of alloca(3) from cdefs.h, and instead modifies the declaration in stdlib.h so that GNU compilers see alloca(sz) defined to __builtin_alloca(sz) while other compilers (and linters) see a regular prototype. I would also like to add (at some future date) a link-time warning for alloca(3) similar to what we already have for gets(), mktemp() etc. DES -- Dag-Erling Smorgrav - des@ofug.org --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=alloca.diff Index: sys/sys/cdefs.h =================================================================== RCS file: /home/ncvs/src/sys/sys/cdefs.h,v retrieving revision 1.70 diff -u -r1.70 cdefs.h --- sys/sys/cdefs.h 14 Jun 2003 06:01:35 -0000 1.70 +++ sys/sys/cdefs.h 14 Jun 2003 15:04:29 -0000 @@ -142,11 +142,6 @@ #define __section(x) __attribute__((__section__(x))) #endif #endif -#ifdef __GNUC__ -#define alloca(sz) __builtin_alloca(sz) -#else -#error FreeBSD alloca support needed for this compiler -#endif /* XXX: should use `#if __STDC_VERSION__ < 199901'. */ #if !(__GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3) Index: include/stdlib.h =================================================================== RCS file: /home/ncvs/src/include/stdlib.h,v retrieving revision 1.48 diff -u -r1.48 stdlib.h --- include/stdlib.h 12 Mar 2003 20:29:58 -0000 1.48 +++ include/stdlib.h 14 Jun 2003 15:06:02 -0000 @@ -222,7 +222,12 @@ extern void (*_malloc_message)(const char *, const char *, const char *, const char *); -void *alloca(size_t); /* built-in for gcc */ +#ifdef __GNUC__ +#define alloca(sz) __builtin_alloca(sz) +#else +void *alloca(size_t); +#endif + __uint32_t arc4random(void); void arc4random_addrandom(unsigned char *dat, int datlen); --=-=-=--