|
Re: [cedet-semantic] Error in autocompletion with typedef struct
From: <eric@si...> - 2003-09-17 14:48
|
On Wed, 17 Sep 2003 19:53:46 +0530, Amardeep Singh wrote:
>
> hi,
>
> in the following c file:
>
> #include <stdio.h>
>
> typedef struct foo {
> int hello;
> } foo_t;
>
>
> int main() {
>
> struct foo* f;
>
> f->he;
>
>
> }
>
> doing semantic-ia-complete-symbol after f->he doesn't work,
> although it works if i declare f as foo_t* f instead of
> struct foo* f;
>
> also, if i change the structure definition to not use typedef,
> i.e. struct foo {
> int hello;
> };
>
> then completion works.
>
> what is the solution?
This looks like a limitation in how typedefs are stored. I'd guess that
if the C code were re-written as
struct foo { ... };
typedef struct foo foo_t;
then it might work in both cases there as well.
The solution may be that the C parser would need to identify a compound typedef
and (internally) split it into two individual TAGS covering the same space
in the buffer. I think it is the function `semantic-expand-c-nonterminal'
in semantic 1.4.
Anyone want to give this a try?
Eric
|
| Thread | Author | Date |
|---|---|---|
| Re: [cedet-semantic] Error in autocompletion with typedef struct | <eric@si...> |