Subject: bug#36678: 27.0.50; imenu not working in C++ (maybe because of namespace)

From: Alan Mackenzie <[email-masked]>
Date: 17 Jul 2019 16:34:27 -0000

Hello again, Ergus.

In article <[email-masked]> you wrote:
> [-- text/plain, encoding 7bit, charset: us-ascii, 91 lines --]

> --text follows this line--

> In the example code (attachement) imenu does not recognizes the
> functions. So it shows that there are not candidates when there are.

[ .... ]

> Major mode: C++//l

The problem is that the function names are not at column zero.  If they
were, they'd get recognised properly.  If CC Mode's imenu were to
recognise indented functions there'd be too many false positives.

This problem has actually come up before (on 2016-11-25, in a post to the
CC Mode list by Jens Kjerrström), and I then hacked up three defuns which
would search for functions functionally rather than by regexp.  This
wasn't wholly satisfactory since (i) this searching was slow; and (ii) if
there were two functions of the same name (e.g., in different
namespaces), imenu would only find the first one in the buffer.

If you are interested, I could send you this hack, which is not all that
big.  Maybe you could play around with it and make it work well.

Maybe it would be possible to bring this approach up to a usable part of
CC Mode - possibly solving (ii) by constructing a hierarchical menu, but
problem (i) would remain.  In any case this would be a substantial
enhancement rather than a simple bug fix.

[ .... ]

> [-- text/plain, encoding 7bit, charset: us-ascii, 45 lines, name: make_local_matrix.hpp --]

> #ifndef _make_local_matrix_hpp_
> #define _make_local_matrix_hpp_

> #include <vector>
> #include <map>

> #include <cassert>
> #include <cstdio>

> #include <fstream>

> namespace miniFE {

>         void get_recv_info_task(CSRMatrix *A, size_t id, size_t numboxes
>                                 const size_t *nrows_array,
>                                 size_t Annz, size_t Anrows)
>         {

>         }

>         void get_send_info_task(CSRMatrix *A, size_t id,
>                 size_t numboxes,
>                 int *send_length_local)
>         {
>         }

>         void set_send_info_task(CSRMatrix *A_array, size_t id,
>                                 size_t numboxes,
>                                 int nelements_to_send_local,
>                                 int *elements_to_send_local)
>         {
>         }

>         void make_local_matrix(CSRMatrix *A_array, singleton *sing, size_t numboxes)
>         {
>         }

> }//namespace miniFE

> #endif

-- 
Alan Mackenzie (Nuremberg, Germany).