Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Aug 1998 22:19:35 +0200 (CEST)
From:      Stefan Eggers <seggers@semyam.dinoco.de>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Cc:        seggers@semyam.dinoco.de
Subject:   kern/7523: clearly marking gcc extension in swap_pager.c
Message-ID:  <199808072019.WAA17745@semyam.dinoco.de>

next in thread | raw e-mail | index | archive | help

>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



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