From owner-freebsd-arch@FreeBSD.ORG Tue Feb 3 23:03:14 2004 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 D284C16A4CE; Tue, 3 Feb 2004 23:03:14 -0800 (PST) Received: from mailout1.pacific.net.au (mailout1.pacific.net.au [61.8.0.84]) by mx1.FreeBSD.org (Postfix) with ESMTP id 87ABD43D1F; Tue, 3 Feb 2004 23:03:11 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86])i1472mLE020971; Wed, 4 Feb 2004 18:02:48 +1100 Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) i1472jt4029521; Wed, 4 Feb 2004 18:02:46 +1100 Date: Wed, 4 Feb 2004 18:02:45 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: John Baldwin In-Reply-To: <200402031720.20211.john@baldwin.cx> Message-ID: <20040204172838.L1097@gamplex.bde.org> References: <20040203214530.GB14639@garage.freebsd.pl> <200402031720.20211.john@baldwin.cx> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Pawel Jakub Dawidek cc: freebsd-arch@freebsd.org Subject: Re: Non-standard ;; and SYSINIT(). 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: Wed, 04 Feb 2004 07:03:15 -0000 On Tue, 3 Feb 2004, John Baldwin wrote: > On Tuesday 03 February 2004 04:45 pm, Pawel Jakub Dawidek wrote: > > Hello. > > > > It looks like SYSINIT() macro is defined with trailing ;. > > Maybe there was some reason to do so, but I assume that this is a bug. > > There are many, many calls where an extra ; is added after SYSINIT(). > > SYSUNINIT() is defined without trailing ; ... > > > > This will be ok, but ;; is not supported by ICO C (gcc -pedantic > > tell me that). This is a bug in the calls with the extra semicolon. All calls in the original SYSINIT() mistake^W commit didn't have it, and I fixed all the extra semicolons that were there many years ago. Unfortunately, the kernel is not usually compiled with C compilers so bugs like this keep coming back. An extra "," at the end of enum lists and types smaller than int in bitfields are other favorites (the former is pedantic and is only required for C90, but the latter is serious since it gives unportabilities at both compile and runtime). > > Here is a patch that fix this issue at least for SYSINIT(): > > > > http://garage.freebsd.pl/patches/SYSINIT.patch This seems to be missing a few. A quick grep shows 111 lines matching "^-SYSINIT" in it, but there are 244 lines matching "^SYSINIT" in .c files in the kernel; among the latter there are 144 currently correct lines without the semicolon and 71 lines with it. I prefer not to make cosmetic changes in large amounts of non-broken code when it outweighs the broken code and was sort of waiting for the broken code to outweigh the non-broken code (or better, for SYSINIT to mostly go away) before changing this. Unfortunately, SYSINIT is not going away; RELENG_3: 112 lines without semicolon 20 with it RELENG_4: 80 lines without semicolon 46 with it -current: 144 lines without semicolon 71 with it > > The most important part is a change in sys/kernel.h, that removes > > trailing ; from SYSINIT() definition: > > > > - DATA_SET(sysinit_set,uniquifier ## _sys_init); > > + DATA_SET(sysinit_set,uniquifier ## _sys_init) > > > > AND REMEMBER! I'm not going to commit it (without strong approvals)!:) > > Yes, please. SYSINIT() without ;'s confuse "smart" editors that try to do > autoindent. There is a PR or two about this (mostly from the point of view of editors, starting with one for gtags IIRC). The queue FOREACH macros are similar mistakes at the level of editors. You have to add {} to make short loops even uglier to get indent(1) to accidentally understand them. Bruce