From shigio@wafu.netgate.net  Sun Jul 20 08:52:54 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 IAA21246
          for <FreeBSD-gnats-submit@freebsd.org>; Sun, 20 Jul 1997 08:52:52 -0700 (PDT)
Received: from chiota.signet.or.jp (INS91.tama.dti.ne.jp [210.159.144.45]) by wafu.netgate.net (8.7.5/8.7.3) with ESMTP id HAA23547 for <FreeBSD-gnats-submit@freebsd.org>; Sun, 20 Jul 1997 07:46:47 GMT
Received: (from shigio@localhost) by chiota.signet.or.jp (8.8.5/) id AAA05496; Mon, 21 Jul 1997 00:53:36 +0900 (JST)
Message-Id: <199707200746.HAA23547@wafu.netgate.net>
Date: Mon, 21 Jul 1997 00:53:36 +0900 (JST)
From: shigio@wafu.netgate.net
Reply-To: shigio@wafu.netgate.net
To: FreeBSD-gnats-submit@freebsd.org
Subject: ctags(1) is decived by extra blanks.
X-Send-Pr-Version: 3.2

>Number:         4128
>Category:       misc
>Synopsis:       ctags(1) overlooks objects decived by extra blanks.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    steve
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 20 09:00:01 PDT 1997
>Closed-Date:    Sat Aug 23 09:14:19 PDT 1997
>Last-Modified:  Sat Aug 23 09:15:02 PDT 1997
>Originator:     Shigio Yamaguchi
>Release:        FreeBSD 2.2.1-RELEASE i386
>Organization:
Freelance programmer
>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 */
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: steve 
State-Changed-When: Sat Aug 23 09:14:19 PDT 1997 
State-Changed-Why:  
Slightly modified patch applied in revision 1.2 of C.c. 
>Unformatted:
