GNU bug report logs - #38511
etags seems to be confused by macros

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Skip Montanaro <skip.montanaro@HIDDEN>; dated Fri, 6 Dec 2019 20:31:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 38511 <at> debbugs.gnu.org:


Received: (at 38511) by debbugs.gnu.org; 8 Dec 2019 06:08:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 08 01:08:30 2019
Received: from localhost ([127.0.0.1]:50365 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1idpk6-0000V5-9K
	for submit <at> debbugs.gnu.org; Sun, 08 Dec 2019 01:08:30 -0500
Received: from eggs.gnu.org ([209.51.188.92]:41438)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1idpk4-0000Up-SO
 for 38511 <at> debbugs.gnu.org; Sun, 08 Dec 2019 01:08:29 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:59137)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1idUIh-00005V-Qw; Sat, 07 Dec 2019 02:14:47 -0500
Received: from [176.228.60.248] (port=3047 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1idUIh-0000WU-9L; Sat, 07 Dec 2019 02:14:47 -0500
Date: Sat, 07 Dec 2019 09:14:39 +0200
Message-Id: <83sglwfvz4.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Skip Montanaro <skip.montanaro@HIDDEN>
In-reply-to: <CANc-5Uzsk-24uhHnRCRZjSxph=Ei1zdtLau9jjUDLkwwHjQc_Q@HIDDEN>
 (message from Skip Montanaro on Fri, 6 Dec 2019 14:20:14 -0600)
Subject: Re: bug#38511: etags seems to be confused by macros
References: <CANc-5Uzsk-24uhHnRCRZjSxph=Ei1zdtLau9jjUDLkwwHjQc_Q@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 38511
Cc: 38511 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Skip Montanaro <skip.montanaro@HIDDEN>
> 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".

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.

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38511; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 6 Dec 2019 20:30:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 06 15:30:12 2019
Received: from localhost ([127.0.0.1]:47093 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1idKEt-0007vj-Ps
	for submit <at> debbugs.gnu.org; Fri, 06 Dec 2019 15:30:12 -0500
Received: from lists.gnu.org ([209.51.188.17]:56276)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <skip.montanaro@HIDDEN>) id 1idK5l-0007U5-5r
 for submit <at> debbugs.gnu.org; Fri, 06 Dec 2019 15:20:45 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:42576)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <skip.montanaro@HIDDEN>) id 1idK5k-0005Vj-25
 for bug-gnu-emacs@HIDDEN; Fri, 06 Dec 2019 15:20:45 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM
 autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <skip.montanaro@HIDDEN>) id 1idK5i-0002MB-VM
 for bug-gnu-emacs@HIDDEN; Fri, 06 Dec 2019 15:20:43 -0500
Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:33986)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <skip.montanaro@HIDDEN>)
 id 1idK5i-0002G1-N0
 for bug-gnu-emacs@HIDDEN; Fri, 06 Dec 2019 15:20:42 -0500
Received: by mail-pf1-x42d.google.com with SMTP id n13so3912029pff.1
 for <bug-gnu-emacs@HIDDEN>; Fri, 06 Dec 2019 12:20:42 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:from:date:message-id:subject:to;
 bh=UC/TOiMYrIyz5sQYKIv04yVXNujICC52R+Ho63TCf+M=;
 b=pQpspbW3zNrKx19IyqTaJMMOOxOXiPOKw8ZN12pTbglrKVOfX+iyIOYumWRi/gle7x
 EX3C2ITkYpJC2FOXIy6vhGEosu9oI8fC0xoGPdLxwPFRez3ifBflV58LFCBXSxgwz1Ny
 FWvzv8g2gAMA4unXpeXFtryCsSg4j5gqm3n4/JhEgaDEJFfs5/jp/UNsSvUTeejfNqCu
 31TTYxBDUbVRjc+xKAIsyv8xy0rbq3u2K4gHirqwzD0Dsgs+emToCN7u8rxk3XnuLavy
 Q/qSmZGCOPOx4TMpti/VooTNYBp8OHg0sG3EJXWPaBljSPdNaP3+PganX+FQK5K6rCTO
 jcSg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=UC/TOiMYrIyz5sQYKIv04yVXNujICC52R+Ho63TCf+M=;
 b=DO56SRivRAfgiIn/T4Hum4ESbb9mnokUxAiLiun3Qb/uoCcrpi83tIGVGaV+QhOZQo
 JRrB1UIPKrfVxjcIe3RcEMNfaxBjyyfqMtGsC5RyCiyugUuH95IqaQgpnkAHDIepUd3Y
 5svZo0pP/QZ66GwEdeGF/dw8ArrpUsMggZ+6lMtlPKgw3FsuBkbonuSAaAskLlVqptk0
 cQzh95HOQESEamMNlAnIIIifzmGKtqGBUYeffIvrwdyWHePJ0pJg9rnVu7MGFxF0Qqvi
 xVrys2QjBsNm3Ibni3+6nenB+xV6zrgcS5kZMM04R31/heLnlV3i2FRyI7a+udHuZvGx
 CMzQ==
X-Gm-Message-State: APjAAAVQYSzQTiS5c2w6ggW9KjIOUhUsVT92nluxQ8MJ1aOSCClrtTvy
 kzcp+S3tFoYJXJCUaAUDcE4oC9ADPI69Kb5x2BXJrsMYO0+Fag0=
X-Google-Smtp-Source: APXvYqwS4hfzSGeOXyScXNcTWllD1yE4AaZM6Eye0MBmJpNYiGywiNOm0MrDsBGdG0ngxx1sXtwH9jmfUmLr5MR7m5g=
X-Received: by 2002:a63:dd16:: with SMTP id t22mr5711875pgg.307.1575663640683; 
 Fri, 06 Dec 2019 12:20:40 -0800 (PST)
MIME-Version: 1.0
From: Skip Montanaro <skip.montanaro@HIDDEN>
Date: Fri, 6 Dec 2019 14:20:14 -0600
Message-ID: <CANc-5Uzsk-24uhHnRCRZjSxph=Ei1zdtLau9jjUDLkwwHjQc_Q@HIDDEN>
Subject: etags seems to be confused by macros
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset="UTF-8"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2607:f8b0:4864:20::42d
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 06 Dec 2019 15:30:10 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

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".

Seems like a bug to me, but it's not obvious if there is a trivial
fix. As a workaround, I think I can write a little shell script which
effectively expands the Py_LOCAL_INLINE macro, then pumps the result
to etags. Still, would be kind of nice if this could be fixed.

Thanks,

Skip Montanaro




Acknowledgement sent to Skip Montanaro <skip.montanaro@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#38511; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 8 Dec 2019 06:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.