Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jul 1997 00:53:36 +0900 (JST)
From:      shigio@wafu.netgate.net
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   misc/4128: ctags(1) is decived by extra blanks.
Message-ID:  <199707200746.HAA23547@wafu.netgate.net>
Resent-Message-ID: <199707201600.JAA21472@hub.freebsd.org>

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

>Number:         4128
>Category:       misc
>Synopsis:       ctags(1) overlooks objects decived by extra blanks.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 20 09:00:01 PDT 1997
>Last-Modified:
>Originator:     Shigio Yamaguchi
>Organization:
Freelance programmer
>Release:        FreeBSD 2.2.1-RELEASE i386
>Environment:

	All environments.

>Description:

	Ctags(1) overlooks some functions and macros decived by extra blanks.

	1. function

	Blanks which follows function name disturbs ctags.

	func  () {}
	     ^

	2. macro

	Blanks which follows '#' disturbs ctags.

	#  define macro() ;
	  ^

>How-To-Repeat:

	test.c
	------------------------------------------
	# define macro()        printf("Hello")
	func   ()
	{
		print("Hello");
	}
	------------------------------------------

	% ctags -x test.c
	%

	It should be like this.

	func               2 test.c           func   ()
	macro              1 test.c           # define macro()  printf("Hello")

>Fix:
	
	[/usr/src/usr.bin/ctags/C.c]

	*** C.c.orig	Mon Jul 21 00:23:04 1997
	--- C.c	Mon Jul 21 00:24:24 1997
	***************
	*** 193,198 ****
	--- 193,213 ----
			 * reserved words.
			 */
			default:
	+ 			/*
	+ 			 * to treat following function.
	+ 			 * func      (arg) {
	+ 			 * ....
	+ 			 * }
	+ 			 */
	+ 			if (c == ' ' || c == '\t') {
	+ 				int save = c;
	+ 				while (GETC(!=, EOF) && (c == ' ' || c == '\t'))
	+ 					;
	+ 				if (c == EOF)
	+ 					return;
	+ 				(void)ungetc(c, inf);
	+ 				c = save;
	+ 			}
		storec:		if (!intoken(c)) {
					if (sp == tok)
						break;
	***************
	*** 310,315 ****
	--- 325,338 ----
		int	curline;		/* line started on */
		char	*sp;			/* buffer pointer */
		char	tok[MAXTOKEN];		/* storage buffer */
	+ 
	+ 	/*
	+ 	 * to treat following macro.
	+ 	 * #     macro(arg)        ....
	+ 	 */
	+ 	while (GETC(!=, EOF) && (c == ' ' || c == '\t'))
	+ 		;
	+ 	(void)ungetc(c, inf);
	  
		curline = lineno;
		for (sp = tok;;) {		/* get next token */
>Audit-Trail:
>Unformatted:



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