From shigio@wafu.netgate.net  Thu Jun 19 23:28:28 1997
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
Subject: ctags(1) cannot trace some macro correctly.
X-Send-Pr-Version: 3.2

>Number:         3912
>Category:       misc
>Synopsis:       ctags(1) cannot trace some macro correctly.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 19 23:30:00 PDT 1997
>Closed-Date:    Sat Jan 19 13:42:54 PST 2002
>Last-Modified:  Sat Jan 19 13:43:21 PST 2002
>Originator:     Shigio Yamaguchi
>Release:        FreeBSD 2.2.1-RELEASE i386
>Organization:
Freelance programmer
>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 ';'.
>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: FreeBSD-gnats-submit@FreeBSD.ORG, shigio@wafu.netgate.net
Cc:  Subject: Re: misc/3912: ctags(1) cannot trace some macro correctly.
Date: Fri, 20 Jun 1997 18:25:02 +1000

 >	[/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.
 
 I started to fix this, but gave up when I realised that there are > 100
 invocations of SYSINIT(), and suprisingly enough, only 8 of them have a
 bogus extra semicolon.
 
 I will fix the corresponding problem for SYSCTL_*() and the ELF case of
 MAKE_SET().  Most invocations already have a bogus extra semicolon.
 
 Bruce
State-Changed-From-To: open->feedback 
State-Changed-By: iedowse 
State-Changed-When: Sat Jan 19 13:19:49 PST 2002 
State-Changed-Why:  

Does this problem still exist? 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=3912 
State-Changed-From-To: feedback->closed 
State-Changed-By: iedowse 
State-Changed-When: Sat Jan 19 13:42:54 PST 2002 
State-Changed-Why:  

Mail to submitter bounces. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=3912 
>Unformatted:
