From owner-freebsd-bugs Fri Aug 7 13:30:14 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA15382 for freebsd-bugs-outgoing; Fri, 7 Aug 1998 13:30:14 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA15353 for ; Fri, 7 Aug 1998 13:30:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id NAA24556; Fri, 7 Aug 1998 13:30:01 -0700 (PDT) Received: from tim.xenologics.com (tim.xenologics.com [194.77.5.24]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA13502 for ; Fri, 7 Aug 1998 13:22:22 -0700 (PDT) (envelope-from seggers@semyam.dinoco.de) Received: (from uucp@localhost) by tim.xenologics.com (8.8.5/8.8.8) with UUCP id WAA06250 for FreeBSD-gnats-submit@freebsd.org; Fri, 7 Aug 1998 22:21:14 +0200 (MET DST) Received: (from seggers@localhost) by semyam.dinoco.de (8.8.8/8.8.8) id WAA17745; Fri, 7 Aug 1998 22:19:35 +0200 (CEST) (envelope-from seggers) Message-Id: <199808072019.WAA17745@semyam.dinoco.de> Date: Fri, 7 Aug 1998 22:19:35 +0200 (CEST) From: Stefan Eggers Reply-To: seggers@semyam.dinoco.de To: FreeBSD-gnats-submit@FreeBSD.ORG Cc: seggers@semyam.dinoco.de X-Send-Pr-Version: 3.2 Subject: kern/7523: clearly marking gcc extension in swap_pager.c Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 7523 >Category: kern >Synopsis: clearly marking gcc extension in swap_pager.c >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Aug 7 13:30:00 PDT 1998 >Last-Modified: >Originator: Stefan Eggers >Organization: none >Release: FreeBSD 3.0-CURRENT i386 >Environment: -current sources from Wednesday. >Description: In a thread in freebsd-hackers John Polstra said that when using gcc extensions they should be #ifdef'ed and have an alternative implementation. In swap_pager.c this is missing in two functions where arrays with computed size (a gcc extension) are used. >How-To-Repeat: Read swap_pager.c and look for these non-ANSI constructs. >Fix: I don't have an alternative implementation to offer. Just an error message which I hope helps in case someone tries it with another compiler. The propper fix is of course to use dynamic memory for these arrays but doing that is much work and error prone as in front of every return statement one has to add a free for it. Besides this I first have to read a bit about dynamic memory in the FreeBSD kernel first as I am not 100% sure if it is legal to use in this place. I don't think I can do that in a few minutes. ;-) --- swap_pager.c.ORIG Tue Jul 28 19:58:31 1998 +++ swap_pager.c Fri Aug 7 22:02:01 1998 @@ -933,13 +933,25 @@ int count, reqpage; { register struct buf *bp; +#ifdef __GNUC__ sw_blk_t swb[count]; +#else +#error XXX uses GCC extension of computed array size +#endif register int s; int i; boolean_t rv; +#ifdef __GNUC__ vm_offset_t kva, off[count]; +#else +#error XXX uses GCC extension of computed array size +#endif vm_pindex_t paging_offset; +#ifdef __GNUC__ int reqaddr[count]; +#else +#error XXX uses GCC extension of computed array size +#endif int sequential; int first, last; @@ -1159,14 +1171,22 @@ int *rtvals; { register struct buf *bp; +#ifdef __GNUC__ sw_blk_t swb[count]; +#else +#error XXX uses GCC extension of computed array size +#endif register int s; int i, j, ix, firstidx, lastidx; boolean_t rv; vm_offset_t kva, off, fidx; swp_clean_t spc; vm_pindex_t paging_pindex; +#ifdef __GNUC__ int reqaddr[count]; +#else +#error XXX uses GCC extension of computed array size +#endif int failed; if (vm_swap_size) >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message