Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Jun 1997 15:28:30 +0900 (JST)
From:      shigio@wafu.netgate.net
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Cc:        shigio@wafu.netgate.net
Subject:   misc/3912: ctags(1) cannot trace some macro correctly.
Message-ID:  <199706192232.WAA11140@wafu.netgate.net>
Resent-Message-ID: <199706200630.XAA14906@hub.freebsd.org>

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

>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:



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