From owner-freebsd-bugs  Thu Jun 19 23:30:04 1997
Return-Path: <owner-bugs>
Received: (from root@localhost)
          by hub.freebsd.org (8.8.5/8.8.5) id XAA14920
          for bugs-outgoing; Thu, 19 Jun 1997 23:30:04 -0700 (PDT)
Received: (from gnats@localhost)
          by hub.freebsd.org (8.8.5/8.8.5) id XAA14906;
          Thu, 19 Jun 1997 23:30:01 -0700 (PDT)
Resent-Date: Thu, 19 Jun 1997 23:30:01 -0700 (PDT)
Resent-Message-Id: <199706200630.XAA14906@hub.freebsd.org>
Resent-From: gnats (GNATS Management)
Resent-To: freebsd-bugs
Resent-Reply-To: FreeBSD-gnats@FreeBSD.ORG, shigio@wafu.netgate.net
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 XAA14773
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 19 Jun 1997 23:28:27 -0700 (PDT)
Received: from chiota.signet.or.jp (INS24.tama.dtinet.or.jp [203.181.77.24]) by wafu.netgate.net (8.7.5/8.7.3) with ESMTP id WAA11140; Thu, 19 Jun 1997 22:32:13 GMT
Received: (from shigio@localhost) by chiota.signet.or.jp (8.8.5/) id PAA01224; Fri, 20 Jun 1997 15:28:30 +0900 (JST)
Message-Id: <199706192232.WAA11140@wafu.netgate.net>
Date: Fri, 20 Jun 1997 15:28:30 +0900 (JST)
From: shigio@wafu.netgate.net
Reply-To: shigio@wafu.netgate.net
To: FreeBSD-gnats-submit@FreeBSD.ORG
Cc: shigio@wafu.netgate.net
X-Send-Pr-Version: 3.2
Subject: misc/3912: ctags(1) cannot trace some macro correctly.
Sender: owner-bugs@FreeBSD.ORG
X-Loop: FreeBSD.org
Precedence: bulk


>Number:         3912
>Category:       misc
>Synopsis:       ctags(1) cannot trace some macro correctly.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 19 23:30:00 PDT 1997
>Last-Modified:
>Originator:     Shigio Yamaguchi
>Organization:
Freelance programmer
>Release:        FreeBSD 2.2.1-RELEASE i386
>Environment:

	All environment

>Description:

	Ctags(1) cannot trace some macro correctly. But ctags isn't bad.
	Trouble maker are some macro definitions.

	For example, SYSINIT is used in /usr/src/sys/kern/init_main.c
	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 ';'.

	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.


>How-To-Repeat:

	Nothing
>Fix:
	
	Change all macros which seems like function as follows.

	o Definition doesn't end with ';'.
	o Reference end with ';'.
>Audit-Trail:
>Unformatted: