Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Interesting search/indexing results

Thomas wrote:
> 2) The simple project that I have looks like:
> 
> --- file1.c ---
> #include <stdlib.h>
> #include <stdio.h>
> 
> int main(int argc, char **argv) {
>    printf("Hello CDT folks \n");
>    afunction(argc, argv);

parse error : unknown symbol afunction

Ref: to ANSI C 99 specification, section 5.1.1.2 Translation Phases

Steps 1 through 6 deal with the preprocessor. 
Step 7 is tokenizing and parsing (syntactic & semantic analysis). 
Step 8 is where external symbols get resolved. 

Unfortunately, we did not complete the implementation of IProblem from the 
parser 
side of things, so if the parser encounters an "official" error, all the 
indexer 
knows is that something failed and you get a log entry like

ENTRY org.eclipse.cdt.core 4 4 Oct 14, 2003 23:40:01.918
MESSAGE Failed to index /CStdMake/file2.c

If the parser reported problems appropriately, the Indexer could resolve 
these 
references by inspecting the IProblem if and only if all CDT builder 
extensions 
could provide an answer to are compilation units X and Y linked together. 
Our 
fragmented builder model rears its head again :-(

So to summarize, its an architectural problem perhaps we could deal with. 

>    return EXIT_SUCCESS
parse error : missing semicolon.  (from stdlib.h #define EXIT_SUCCESS 0 )

> }
> 
> --- file2.c ---
> #include <stdlib.h>
> #include <stdio.h>
> 
> int afunction(int argc, char **argv) {
>    printf("I'm lazy so I cut and paste\n");
>    return EXIT_SUCCESS

parse error : missing semicolon. 

> }
> 
> ---
> 
> This code doesn't get indexed in the qnx project, but in the standard 
make
> it does.  So then using the search I do a search for afunc* which 
returns
> only the instance in file2.c, even when I specified All Occurrences. How
> come the reference to the function in main() is not returned?

If you are encountering a preprocessor or scanner error, you will see an 
entry in 
the cdt.core .log file indicating what has gone wrong.  The fact that it 
works for
one builder and not the other makes me think that its related to 
IScannerInfo somehow. 

JohnC


Back to the top