From owner-freebsd-hackers Mon Jun 16 08:19:25 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id IAA10696 for hackers-outgoing; Mon, 16 Jun 1997 08:19:25 -0700 (PDT) Received: from wafu.netgate.net (wafu.netgate.net [204.145.147.80]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id IAA10689 for ; Mon, 16 Jun 1997 08:19:11 -0700 (PDT) Received: from chiota.signet.or.jp (INS30.tama.dtinet.or.jp [203.181.77.30]) by wafu.netgate.net (8.7.5/8.7.3) with ESMTP id HAA10719; Mon, 16 Jun 1997 07:22:46 GMT Message-Id: <199706160722.HAA10719@wafu.netgate.net> Received: from chiota.signet.or.jp (localhost.signet.or.jp [127.0.0.1]) by chiota.signet.or.jp (8.8.5/) with ESMTP id AAA00481; Tue, 17 Jun 1997 00:19:42 +0900 (JST) To: freebsd-hackers@FreeBSD.ORG Cc: shigio@wafu.netgate.net Subject: an inconvenience about macro [/usr/src/sys/sys/kernel.h] Date: Tue, 17 Jun 1997 00:19:42 +0900 From: Shigio Yamaguchi Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Hello hackers. I found an inconvenience in kernel source. (It is not a bug.) What do you think? --------------------------------------------------------------------------- Inconvenience about Macro --------------------------------------------------------------------------- In /usr/src/sys/kern/init_main.c, SYSINIT macro is used. It is like this. [/usr/src/sys/kern/init_main.c] SYSINIT(placeholder, SI_SUB_DUMMY,SI_ORDER_ANY, NULL, NULL) SYSINIT doesn't end with ';', because the definition already has it. [/usr/src/sys/sys/kern.h] #define SYSINIT(uniquifier, subsystem, order, func, ident) \ static struct sysinit uniquifier ## _sys_init = { \ subsystem, \ order, \ func, \ ident, \ SI_TYPE_DEFAULT \ }; \ DATA_SET(sysinit_set,uniquifier ## _sys_init); ^ | END WITH ';' But ctags(1) cannot treat this pattern. For example, in these code [/usr/src/sys/kern/init_main.c] SYSINIT(placeholder, SI_SUB_DUMMY,SI_ORDER_ANY, NULL, NULL) ... (a) ..... void main(framep) ... (b) void *framep; { ..... } ... (c) Ctags(1) assumes SYSINIT start at (a) and end at (c). As the result that main() functin is skipped. I think the definition of SYSINIT should not end with ';' and the referenced point should end with ';' like this. SYSINIT(placeholder, SI_SUB_DUMMY,SI_ORDER_ANY, NULL, NULL); By the way, in the same source file(/usr/src/sys/sys/kern.h), MAKE_SET's code is good. [/usr/src/sys/sys/kern.h] #define MAKE_SET(set, sym, type) \ static void const * const __set_##set##_sym_##sym = &sym; \ asm(".stabs \"_" #set "\", " #type ", 0, 0, _" #sym) In this macro, the first statement ends with ';' and the second (=last) statement doesn't end with ';'. It should be so. -- Shigio Yamaguchi (Freelance programmer) Mail: shigio@wafu.netgate.net, WWW: http://wafu.netgate.net/tama/