From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Francesco =?UTF-8?Q?Potort=C3=AC?= Newsgroups: gmane.emacs.bugs Subject: bug#38511: etags seems to be confused by macros Date: Mon, 09 Dec 2019 11:59:06 +0100 Message-ID: References: <83sglwfvz4.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="164003"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Skip Montanaro , 38511@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 09 12:00:16 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ieGlz-000gTn-PY for geb-bug-gnu-emacs@m.gmane.org; Mon, 09 Dec 2019 12:00:15 +0100 Original-Received: from localhost ([::1]:38470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ieGlx-0002ph-MA for geb-bug-gnu-emacs@m.gmane.org; Mon, 09 Dec 2019 06:00:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38483) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ieGlo-0002oV-28 for bug-gnu-emacs@gnu.org; Mon, 09 Dec 2019 06:00:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ieGlm-0007KT-T8 for bug-gnu-emacs@gnu.org; Mon, 09 Dec 2019 06:00:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46688) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ieGlm-0007KJ-Pj for bug-gnu-emacs@gnu.org; Mon, 09 Dec 2019 06:00:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ieGlm-0004RA-OE for bug-gnu-emacs@gnu.org; Mon, 09 Dec 2019 06:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Francesco =?UTF-8?Q?Potort=C3=AC?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Dec 2019 11:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38511 X-GNU-PR-Package: emacs Original-Received: via spool by 38511-submit@debbugs.gnu.org id=B38511.157588915916921 (code B ref 38511); Mon, 09 Dec 2019 11:00:02 +0000 Original-Received: (at 38511) by debbugs.gnu.org; 9 Dec 2019 10:59:19 +0000 Original-Received: from localhost ([127.0.0.1]:52661 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ieGl5-0004Or-4c for submit@debbugs.gnu.org; Mon, 09 Dec 2019 05:59:19 -0500 Original-Received: from blade3.isti.cnr.it ([194.119.192.3]:21601 helo=mx-all.isti.cnr.it) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ieGl3-0004Of-3O for 38511@debbugs.gnu.org; Mon, 09 Dec 2019 05:59:17 -0500 Original-Received: from savesent-daemon.mx-all.isti.cnr.it by mx-all.isti.cnr.it (PMDF V6.7-x04 #1884) id <01RERO4QIGKWQ96LP4@mx-all.isti.cnr.it> for 38511@debbugs.gnu.org; Mon, 09 Dec 2019 11:59:11 +0100 (MET) Original-Received: from tucano.isti.cnr.it ([146.48.81.102]) by mx-all.isti.cnr.it (PMDF V6.7-x04 #1884) with ESMTPSA id <01RERO4N11KWQ7XQGD@mx-all.isti.cnr.it>; Mon, 09 Dec 2019 11:59:08 +0100 (MET) Original-Received: from pot by tucano.isti.cnr.it with local (Exim 4.92.3) (envelope-from ) id 1ieGks-005fc5-RE; Mon, 09 Dec 2019 11:59:06 +0100 In-reply-to: <83sglwfvz4.fsf@gnu.org> X-INSM-ip-source: 146.48.81.102 Auth Done X-fingerprint: 4B02 6187 5C03 D6B1 2E31 7666 09DF 2DC9 BE21 6115 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:173093 Archived-At: >> From: Skip Montanaro >> Date: Fri, 6 Dec 2019 14:20:14 -0600 >> >> I use speedbar in Emacs, which relies on etags to generate tag files. >> The Python source defines a macro named Py_LOCAL_INLINE, which is used >> to select the appropriate spelling of "static inline": >> >> #if defined(_MSC_VER) >> ... >> # define Py_LOCAL_INLINE(type) static __inline type __fastcall >> #else >> ... >> # define Py_LOCAL_INLINE(type) static inline type >> #endif >> >> It's used like so: >> >> Py_LOCAL_INLINE(void) >> stackdepth_push(basicblock ***sp, basicblock *b, int depth) >> { >> assert(b->b_startdepth < 0 || b->b_startdepth == depth); >> if (b->b_startdepth < depth && b->b_startdepth < 100) { >> assert(b->b_startdepth < 0); >> b->b_startdepth = depth; >> *(*sp)++ = b; >> } >> } >> >> It all works well. Etags though, thinks the file contains a function >> named "Py_LOCAL_INLINE" and completely misses the actual function, >> "stackdepth_push". Eli Zaretskii: >Etags works by looking at the source at face value, and it doesn't >expand macros as a C compiler would. So this: > > Py_LOCAL_INLINE(void) stackdepth_push(basicblock ***sp, basicblock *b, int depth) > >looks to its naïve lexical analysis very much like a K&R definition of >a function and declaration of its arguments: > > Py_LOCAL_INLINE(foo) int foo(bar) > >> Seems like a bug to me, but it's not obvious if there is a trivial >> fix. > >Patches are welcome, if someone has an idea for how to fix that. Unless some C code wizard steps up and contradicts me, I'd say that it is in principle impossible for Etags to detect such macros. This is a work for the --regex feature of Etags, which is thought just for this sort of situations. The Etags man page explains it with examples, as does the info page. -- fp