unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* etags failing with structure members
@ 2017-03-10  7:54 martin rudalics
  2017-03-10  9:21 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: martin rudalics @ 2017-03-10  7:54 UTC (permalink / raw)
  To: emacs-devel

An excerpt of the contents of my src/TAGS file after scanning the
`frame' structure with current master:

   ...
   bool_bf mouse_moved \x7f297,10416
   bool_bf pointer_invisible \x7f300,10495
   bool_bf frozen_window_starts \x7f304,10651
   ENUM_BF \x7f309,10870
   union output_data\x7f445,15670
     struct tty_output *tty;\x7ftty\x01447,15694
     struct x_output *x;\x7fx\x01448,15750
     struct w32_output *w32;\x7fw32\x01449,15803
     struct ns_output *ns;\x7fns\x01450,15858
     intptr_t nothing;\x7f451,15912
   output_data;\x7f453,15938
   ...

All taggable entries between

   ENUM_BF (output_method) output_method : 3;

#ifdef HAVE_WINDOW_SYSTEM
   /* See FULLSCREEN_ enum on top.  */
   ENUM_BF (fullscreen_type) want_fullscreen : 4;

   /* If not vertical_scroll_bar_none, we should actually
      display the scroll bars of this type on this frame.  */
   ENUM_BF (vertical_scroll_bar_type) vertical_scroll_bar_type : 2;

   /* Nonzero if we should actually display horizontal scroll bars on this frame.  */
   bool_bf horizontal_scroll_bars : 1;
#endif /* HAVE_WINDOW_SYSTEM */
   ...

and

   ...
   /* Canonical X unit.  Width of default font, in pixels.  */
   int column_width;

   /* Canonical Y unit.  Height of a line, in pixels.  */
   int line_height;

   /* The terminal device that this frame uses.  If this is NULL, then
      the frame has been deleted.  */
   struct terminal *terminal;

are missing.

martin



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: etags failing with structure members
  2017-03-10  7:54 etags failing with structure members martin rudalics
@ 2017-03-10  9:21 ` Eli Zaretskii
  2017-03-11 10:27   ` martin rudalics
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2017-03-10  9:21 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-devel

> Date: Fri, 10 Mar 2017 08:54:55 +0100
> From: martin rudalics <rudalics@gmx.at>
> 
> An excerpt of the contents of my src/TAGS file after scanning the
> `frame' structure with current master:
> 
>    ...
>    bool_bf mouse_moved \x7f297,10416
>    bool_bf pointer_invisible \x7f300,10495
>    bool_bf frozen_window_starts \x7f304,10651
>    ENUM_BF \x7f309,10870
>    union output_data\x7f445,15670
>      struct tty_output *tty;\x7ftty\x01447,15694
>      struct x_output *x;\x7fx\x01448,15750
>      struct w32_output *w32;\x7fw32\x01449,15803
>      struct ns_output *ns;\x7fns\x01450,15858
>      intptr_t nothing;\x7f451,15912
>    output_data;\x7f453,15938
>    ...
> 
> All taggable entries between
> 
>    ENUM_BF (output_method) output_method : 3;
> 
> #ifdef HAVE_WINDOW_SYSTEM
>    /* See FULLSCREEN_ enum on top.  */
>    ENUM_BF (fullscreen_type) want_fullscreen : 4;
> 
>    /* If not vertical_scroll_bar_none, we should actually
>       display the scroll bars of this type on this frame.  */
>    ENUM_BF (vertical_scroll_bar_type) vertical_scroll_bar_type : 2;
> 
>    /* Nonzero if we should actually display horizontal scroll bars on this frame.  */
>    bool_bf horizontal_scroll_bars : 1;
> #endif /* HAVE_WINDOW_SYSTEM */
>    ...
> 
> and
> 
>    ...
>    /* Canonical X unit.  Width of default font, in pixels.  */
>    int column_width;
> 
>    /* Canonical Y unit.  Height of a line, in pixels.  */
>    int line_height;
> 
>    /* The terminal device that this frame uses.  If this is NULL, then
>       the frame has been deleted.  */
>    struct terminal *terminal;
> 
> are missing.

This is a known problem: 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.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: etags failing with structure members
  2017-03-10  9:21 ` Eli Zaretskii
@ 2017-03-11 10:27   ` martin rudalics
  2017-03-11 11:24     ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: martin rudalics @ 2017-03-11 10:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

 > This is a known problem:

I thought so.  That's also why I didn't report this as a bug.

 > 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?  The
lines in question don't seem to differ much from lines that are handled
correctly.

Thanks, martin



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: etags failing with structure members
  2017-03-11 10:27   ` martin rudalics
@ 2017-03-11 11:24     ` Eli Zaretskii
  2017-03-11 15:42       ` John Yates
                         ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Eli Zaretskii @ 2017-03-11 11:24 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-devel

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: etags failing with structure members
  2017-03-11 11:24     ` Eli Zaretskii
@ 2017-03-11 15:42       ` John Yates
  2017-03-11 16:37         ` Eli Zaretskii
  2017-03-12 14:27       ` Alan Mackenzie
  2017-03-12 15:39       ` Eli Zaretskii
  2 siblings, 1 reply; 10+ messages in thread
From: John Yates @ 2017-03-11 15:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: martin rudalics, Emacs developers

On Sat, Mar 11, 2017 at 6:24 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> They look like a beginning of a K&R style function definition:

For many contemporary codebases support for K&R is only a liability.
Might it be possible to drop such support (at least optionally)?

/john



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: etags failing with structure members
  2017-03-11 15:42       ` John Yates
@ 2017-03-11 16:37         ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2017-03-11 16:37 UTC (permalink / raw)
  To: John Yates; +Cc: rudalics, emacs-devel

> From: John Yates <john@yates-sheets.org>
> Date: Sat, 11 Mar 2017 10:42:23 -0500
> Cc: martin rudalics <rudalics@gmx.at>, Emacs developers <emacs-devel@gnu.org>
> 
> On Sat, Mar 11, 2017 at 6:24 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > They look like a beginning of a K&R style function definition:
> 
> For many contemporary codebases support for K&R is only a liability.
> Might it be possible to drop such support (at least optionally)?

Even if we'd decided to drop that (and I'm not so sure we should),
someone would still need to rework the humongous state machine in
C_entries and consider_token (which supports all C-like languages,
including C++, ObjC, Java, etc.) to get rid of that cleanly.  If such
a volunteer steps forward, this question will become something we (and
the volunteer) should consider, yes.  But until that time, simple
localized changes are all we can afford, unfortunately, at least as
long as I'm the only one who dares to touch etags bugs.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: etags failing with structure members
  2017-03-11 11:24     ` Eli Zaretskii
  2017-03-11 15:42       ` John Yates
@ 2017-03-12 14:27       ` Alan Mackenzie
  2017-03-12 15:39       ` Eli Zaretskii
  2 siblings, 0 replies; 10+ messages in thread
From: Alan Mackenzie @ 2017-03-12 14:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: martin rudalics, emacs-devel

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: etags failing with structure members
  2017-03-11 11:24     ` Eli Zaretskii
  2017-03-11 15:42       ` John Yates
  2017-03-12 14:27       ` Alan Mackenzie
@ 2017-03-12 15:39       ` Eli Zaretskii
  2017-03-12 18:03         ` martin rudalics
  2 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2017-03-12 15:39 UTC (permalink / raw)
  To: rudalics; +Cc: emacs-devel

> Date: Sat, 11 Mar 2017 13:24:26 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org
> 
> One possible remedy would be to teach etags about the special macro
> ENUM_BF; I will look into that when I have time.

Should be fixed now on the master branch.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: etags failing with structure members
  2017-03-12 15:39       ` Eli Zaretskii
@ 2017-03-12 18:03         ` martin rudalics
  2017-03-12 18:09           ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: martin rudalics @ 2017-03-12 18:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

 > Should be fixed now on the master branch.

Looks perfect.  Thank you very much.

martin



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: etags failing with structure members
  2017-03-12 18:03         ` martin rudalics
@ 2017-03-12 18:09           ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2017-03-12 18:09 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-devel

> Date: Sun, 12 Mar 2017 19:03:00 +0100
> From: martin rudalics <rudalics@gmx.at>
> Cc: emacs-devel@gnu.org
> 
>  > Should be fixed now on the master branch.
> 
> Looks perfect.  Thank you very much.

Thanks for testing (and for reporting the issue in the first place).



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-03-12 18:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-10  7:54 etags failing with structure members martin rudalics
2017-03-10  9:21 ` Eli Zaretskii
2017-03-11 10:27   ` martin rudalics
2017-03-11 11:24     ` Eli Zaretskii
2017-03-11 15:42       ` John Yates
2017-03-11 16:37         ` Eli Zaretskii
2017-03-12 14:27       ` Alan Mackenzie
2017-03-12 15:39       ` Eli Zaretskii
2017-03-12 18:03         ` martin rudalics
2017-03-12 18:09           ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).