From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!.POSTED!not-for-mail
From: Alan Mackenzie <acm@muc.de>
Newsgroups: gmane.emacs.devel
Subject: Re: etags failing with structure members
Date: Sun, 12 Mar 2017 14:27:34 +0000
Message-ID: <20170312142733.GB16532@acm>
References: <58C25BCF.4010704@gmx.at> <831su5fpx7.fsf@gnu.org>
	<58C3D124.1070501@gmx.at> <834lz0dpjp.fsf@gnu.org>
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: blaine.gmane.org 1489328930 7437 195.159.176.226 (12 Mar 2017 14:28:50 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 12 Mar 2017 14:28:50 +0000 (UTC)
User-Agent: Mutt/1.7.2 (2016-11-26)
Cc: martin rudalics <rudalics@gmx.at>, emacs-devel@gnu.org
To: Eli Zaretskii <eliz@gnu.org>
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 12 15:28:44 2017
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>
Envelope-to: ged-emacs-devel@m.gmane.org
Original-Received: from lists.gnu.org ([208.118.235.17])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>)
	id 1cn4UE-0001JX-48
	for ged-emacs-devel@m.gmane.org; Sun, 12 Mar 2017 15:28:42 +0100
Original-Received: from localhost ([::1]:47215 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>)
	id 1cn4UJ-0000wo-UW
	for ged-emacs-devel@m.gmane.org; Sun, 12 Mar 2017 10:28:47 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42044)
	by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <acm@muc.de>)
	id 1cn4Tj-0000va-QO
	for emacs-devel@gnu.org; Sun, 12 Mar 2017 10:28:13 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <acm@muc.de>) id 1cn4Tg-0004SL-NJ
	for emacs-devel@gnu.org; Sun, 12 Mar 2017 10:28:11 -0400
Original-Received: from ocolin.muc.de ([193.149.48.4]:47822 helo=mail.muc.de)
	by eggs.gnu.org with smtp (Exim 4.71) (envelope-from <acm@muc.de>)
	id 1cn4Tg-0004RY-G3
	for emacs-devel@gnu.org; Sun, 12 Mar 2017 10:28:08 -0400
Original-Received: (qmail 50015 invoked by uid 3782); 12 Mar 2017 14:28:06 -0000
Original-Received: from acm.muc.de (p548C6F34.dip0.t-ipconnect.de [84.140.111.52]) by
	colin.muc.de (tmda-ofmipd) with ESMTP;
	Sun, 12 Mar 2017 15:28:05 +0100
Original-Received: (qmail 17358 invoked by uid 1000); 12 Mar 2017 14:27:34 -0000
Content-Disposition: inline
In-Reply-To: <834lz0dpjp.fsf@gnu.org>
X-Delivery-Agent: TMDA/1.1.12 (Macallan)
X-Primary-Address: acm@muc.de
X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy]
X-Received-From: 193.149.48.4
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/emacs-devel/>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=subscribe>
Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org
Original-Sender: "Emacs-devel" <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>
Xref: news.gmane.org gmane.emacs.devel:212943
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/212943>

Hello, Eli.

On Sat, Mar 11, 2017 at 13:24:26 +0200, Eli Zaretskii wrote:
> > Date: Sat, 11 Mar 2017 11:27:48 +0100
> > From: martin rudalics <rudalics@gmx.at>
> > CC: emacs-devel@gnu.org

> >  > the tricky macro syntax used by some of the
> >  > header files run afoul of the etags parsing.  I tried once to find a
> >  > solution for that, I might look into this again.

> > Can you explain with a few words why the macro syntax interferes?

> They look like a beginning of a K&R style function definition:

>   foo (bar, baz)
>     type1 bar;
>     type2 baz;

> This tricks etags into the state where it looks for the end of the
> function, and ignores everything until that point.

> One possible remedy would be to teach etags about the special macro
> ENUM_BF; I will look into that when I have time.  But there's trickier
> stuff in lisp.h that won't be helped even by that.

For what it's worth, CC Mode also suffers from K&R declarations.  It's a
shame that K and R didn't get this right in the initial version of C,
but considering everything, they did a splendid job.

CC Mode's current heuristic (see c-in-knr-argdecl in cc-engine.el) is to
check rigorously things like the absence of a ';' after the arglist, and
that the contents of the arglist is a simple comma separated list of
identifiers.  To solve a bug a year or two ago, it now also checks that
each identifier declared in the "k&r region" appears in the arglist.

I don't know how practical it would be to do all this in etags.

-- 
Alan Mackenzie (Nuremberg, Germany).