bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

etags treats "interface" as a keyword in plain C


From: Per Cederqvist
Subject: etags treats "interface" as a keyword in plain C
Date: Thu, 01 Feb 2007 12:07:03 +0100

Revision 3.67 of lib-src/etags.c, fetched from CVS earlier today,
fails to properly handle the following C file:

-- cut here for foo.c --
struct interface *
interface_locate(void)
{
  return 0;
}
-- foo.c ends on the previous line --

The interface_locate function is not detected:

$ etags foo.c
$ cat TAGS


foo.c,0
$

The reason is that "interface" is treated specially.  If I change the
first line by altering a single character, I get the expected result:

-- cut here for bar.c --
struct interlace *
interface_locate(void)
{
  return 0;
}
-- bar.c ends on the previous line --

$ etags bar.c
$ cat TAGS


bar.c,23
interface_locate(2,19
$

The reason seems to be this code in etags.c:

import,         (C_JAVA & !C_PLPL),     st_C_ignore
package,        (C_JAVA & !C_PLPL),     st_C_ignore
friend,         C_PLPL,                 st_C_ignore
extends,        (C_JAVA & !C_PLPL),     st_C_javastruct
implements,     (C_JAVA & !C_PLPL),     st_C_javastruct
interface,      (C_JAVA & !C_PLPL),     st_C_struct

As we have the following definitions:

#define C_JAVA  0x00005         /* JAVA */
#define C_PLPL  0x00001         /* C++ */

The expression evaluates to:

(0x00005 & !0x00001)

Since !0x00001 is 0, this evaluates to 0.  My guess is that the author
intended to write ~C_PLPL, not !C_PLPL.

The attached patch fixes the above test case.  However, I'm not
certain that it doesn't break anything else.  If this isn't good,
maybe the value should be reverted back to plain C_JAVA as it was
prior to revision 3.40.

    /ceder

Attachment: patch
Description: Suggested fix


reply via email to

[Prev in Thread] Current Thread [Next in Thread]