From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: Re: etags: function not indexed after macro Date: Sat, 13 May 2006 11:00:34 +0300 Message-ID: References: <44644D18.3060604@zurich.ibm.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1147507252 3962 80.91.229.2 (13 May 2006 08:00:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 13 May 2006 08:00:52 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org, Francesco Potorti` Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 13 10:00:51 2006 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Fep3R-0004IO-VL for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 May 2006 10:00:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fep3R-0008Gf-BR for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 May 2006 04:00:49 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Fep3L-0008GT-PG for bug-gnu-emacs@gnu.org; Sat, 13 May 2006 04:00:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Fep3J-0008G5-JP for bug-gnu-emacs@gnu.org; Sat, 13 May 2006 04:00:42 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fep3J-0008G2-7z for bug-gnu-emacs@gnu.org; Sat, 13 May 2006 04:00:41 -0400 Original-Received: from [192.114.186.66] (helo=romy.inter.net.il) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Fep5B-0006O8-RA; Sat, 13 May 2006 04:02:38 -0400 Original-Received: from HOME-C4E4A596F7 (IGLD-83-130-243-9.inter.net.il [83.130.243.9]) by romy.inter.net.il (MOS 3.7.3-GA) with ESMTP id EED75173 (AUTH halo1); Sat, 13 May 2006 11:00:34 +0300 (IDT) Original-To: Roman Pletka In-reply-to: <44644D18.3060604@zurich.ibm.com> (message from Roman Pletka on Fri, 12 May 2006 10:53:44 +0200) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:15089 Archived-At: > Date: Fri, 12 May 2006 10:53:44 +0200 > From: Roman Pletka > > I tried to index the following code with etags: > > #define DECLARE_TEST(name) \ > static int test_##name; > > DECLARE_TEST(var) > > > > void my_func(int i) { > test_var = i; > } > > void my_func2(int j) { > test_var = j; > } > > > It looks like etags does not create an entry for the my_func function because > the closing semicolon is in the definition of the macro. I think it's not because of the semicolon in the macro definition, it's because the macro _invocation_ looks like a beginning of a function (whose name is DECLARE_TEST), and thus etags regards the definition of my_func as part of that function's body. You can work around this by moving the semicolon from the macro definition to its invocation: #define DECLARE_TEST(name) \ static int test_##name DECLARE_TEST(var); Which IMO is better C style anyway, and will probably help you elsewhere, like with Emacs syntax highlighting and indentation. > I am using etags that comes with GNU Emacs 21.4 (Debian emacs21 > 21.4a-3). The same problem exists in the current development sources. I don't know if this can be easily fixed, but I cc Francesco who is the etags maintainer. Thanks for reporting this.