[Top][All Lists]

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

Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken

From: Alan Mackenzie
Subject: Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken
Date: 18 Apr 2007 21:15:47 +0200
Date: Wed, 18 Apr 2007 21:35:55 +0100
User-agent: Mutt/1.5.9i

'Evening, Chong!

On Wed, Apr 18, 2007 at 02:10:05PM -0400, Chong Yidong wrote:
> Andreas Schwab <address@hidden> writes:

> > c-end-of-defun no longer always goes to the end of the function.  This
> > breaks add-log-current-defun, for example.  It doesn't always happen, but
> > you can reproduce it with
> > <http://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/src/gdb/symtab.c?rev=1.157&content-type=text/plain&cvsroot=src>.
> > Just load the file and type M-C-e.  You end up in the middle of
> > lookup_partial_symtab instead of at the end of lookup_symtab.

> The trouble is the following code in c-end-of-defun (cc-cmds.el:1645):
>       ;; Move forward to the } of a function
>       (if (> arg 0)
>         (setq arg (c-forward-to-nth-EOF-} arg where))))
>     ;; Do we need to move forward from the brace to the semicolon?
>     (when (eq arg 0)
>       (if (c-in-function-trailer-p)   ; after "}" of struct/enum, etc.
>         (c-syntactic-re-search-forward ";"))

> The function c-in-function-trailer-p thinks we are between the closing
> brace and the semicolon of struct construct, because this function
> returns a struct *:

>   struct symtab *
>   lookup_symtab (const char *name)
>   {

> Alan, can you come up with a quick fix?


There is code which analyses `struct' headers properly in the function
`c-end-of-decl-1' in cc-engine.el.  I can copy this into

I might be able to post a patch tonight.  If not, tomorrow.


reply via email to

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