unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Liang Wang <netcasper@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: imenu fails to index C function with function pointer as parameter
Date: Fri, 26 Aug 2011 19:34:16 +0000	[thread overview]
Message-ID: <20110826193416.GA30651@acm.acm> (raw)
In-Reply-To: <CAO+NnCYuYp40dJOaap8Ad7FLfLxwphZCpghZwwFAwfdCFCHrUQ@mail.gmail.com>

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



  parent reply	other threads:[~2011-08-26 19:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22  6:02 imenu fails to index C function with function pointer as parameter Liang Wang
2011-08-23 13:16 ` Alan Mackenzie
2011-08-26 19:34 ` Alan Mackenzie [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-08-27 16:31 Angelo Graziosi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110826193416.GA30651@acm.acm \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=netcasper@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).