emacs-devel
[Top][All Lists]
Advanced

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

Re: imenu fails to index C function with function pointer as parameter


From: Alan Mackenzie
Subject: Re: imenu fails to index C function with function pointer as parameter
Date: Fri, 26 Aug 2011 19:34:16 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Hi, Liang.

On Mon, Aug 22, 2011 at 02:02:12PM +0800, Liang Wang wrote:
> Hi,

> When I try to jump to a function definition which has a function
> pointer as one of its parameters, imenu fails to recognize such
> function.  One example is

> static rtx
> substitute_address (rtx exp, rtx (*no_address_fn) (rtx),
>                   rtx (*address_fn) (rtx))

> which is from gcc source code in gcc/genattrtab.c.

> To reproduce it, run

> M-x imenu RET sub TAB

> And then, I get [No match].  Other functions are just fine.

Thanks for taking the trouble to report this bug.  I think this patch
fixes it.  Would you please try it out and confirm it's OK.


*** orig/cc-menus.el    2011-08-26 17:24:29.000000000 +0000
--- cc-menus.el 2011-08-26 19:22:03.000000000 +0000
***************
*** 110,117 ****
         "[^" c-alnum "_:<>~]"                ; match any non-identifier char
         "\\([" c-alpha "_][" c-alnum "_:<>~]*\\)" ; match function name
         "\\([ \t\n]\\|\\\\\n\\)*("           ; see above, BUT the arg list
!        "\\([ \t\n]\\|\\\\\n\\)*\\([^ \t\n(*][^)]*\\)?)" ; must not start
!        "\\([ \t\n]\\|\\\\\n\\)*[^ \t\n;(]"    ; with an asterisk or 
parentheses
         ) 1)
      ;; Special case for definitions using phony prototype macros like:
      ;; `int main _PROTO( (int argc,char *argv[]) )'.
--- 110,120 ----
         "[^" c-alnum "_:<>~]"                ; match any non-identifier char
         "\\([" c-alpha "_][" c-alnum "_:<>~]*\\)" ; match function name
         "\\([ \t\n]\\|\\\\\n\\)*("           ; see above, BUT the arg list
!        "\\([ \t\n]\\|\\\\\n\\)*"            ; must not start
!        "\\([^ \t\n(*]"                              ; with an asterisk or 
parentheses
!        "[^()]*\\(([^()]*)[^()]*\\)*"        ; Maybe function pointer arguments
!        "\\)?)"
!        "\\([ \t\n]\\|\\\\\n\\)*[^ \t\n;(]"
         ) 1)
      ;; Special case for definitions using phony prototype macros like:
      ;; `int main _PROTO( (int argc,char *argv[]) )'.


> Thanks,
> Liang.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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