User forums > Using Code::Blocks

Help on code completion

<< < (2/4) > >>

ouille:
Hello,

It seem that parser by default only parse .c/.cpp files.

Modifying line 1093 of nativearser.cpp with :

--- Code: ---            if ((ft == ParserCommon::ftSource) || (ft==ParserCommon::ftHeader)) // parse source files and Headers Files
--- End code ---

Will parse project as I expect !

Is there a raison why .h are not parsed on project load or project reparse  (but parsed when added to the project ?).

Is it the right way of handling this case ?

Have a nice day.
Ouille.

oBFusCATed:
The reason (probably) is that C/C++ are based on translation units and header files are not translation unit.

Are those headers you need parsed included in some .c file?

I doubt this is the correct solution. A header file has meaning only when it is included in a .c/cpp file.

ollydbg:

--- Code: ---NativeParser::DoFullParsing(): AddProjectDefinedMacros failed!
--- End code ---
From your log, I see this is an error.



--- Quote ---Is there a raison why .h are not parsed on project load or project reparse  (but parsed when added to the project ?).
--- End quote ---

If you have two a.c and b.c, and a.h and b.h
Here is a.c

--- Code: ---#include "a.h"
#include "b.h"
...

--- End code ---

Here is b.c

--- Code: ---#include "a.h"
#include "b.h"
...

--- End code ---

Now the logic is, our parser just parse the a.c and b.c, but note that the a.h and b.h is parsed when parsing the a.c. After that, when parsing b.c, those headers are just skipped.

I hope you can understand this logic.

EDIT:
Reparse the project should rebuild the whole thing, so if you have updated the header file, reparse the project should work, so what's the exact problem you have?

ouille:
Hello,

Thank's for your reply.

First : The project is in attachment. It's a small linux module WIP.
It build ok.
But using CC on inode for example didn't give any hints, copy_to_user didn't complete.
Forcing parsing .h files -> CC work well on inode and copy_to_user for example.
Perhaps project structure is not correct ?

My comments :


--- Quote ---The reason (probably) is that C/C++ are based on translation units and header files are not translation unit.
--- End quote ---
Ok, but are they parsed when files are added to project.


--- Quote ---Are those headers you need parsed included in some .c file?
--- End quote ---
Not directly, but project builds ok. So they are found by some way, it's mystery for me ;o)


--- Quote ---I doubt this is the correct solution. A header file has meaning only when it is included in a .c/cpp file.
--- End quote ---
Probaly not, but i try to undestrand ;o)


--- Code: ---NativeParser::DoFullParsing(): AddProjectDefinedMacros failed!
--- End code ---
I don't know where this error come from.
Do you think it can be related ?

For the rest i'm ok is your explanations. But why can't i use CC on a.h if it parsed at least once ?

Looking in Editor / CC options I fond thise check box (see attachment).

Exhibit a "Enable Headers Code Completion".

But this options doesn't seemed to be used in codeblocks inner code.

Comments and remarks welcome.
Have a nice day.





ouille:
Hello,

I've try to handle "Enable Headers Code Completion" inside codeblock CC.

Here is a patch (see attachment).

If option checked, headers are parsed / and reparsed correctly (can be slow on linux headers).

If unchecked : previous behavior.

Feedback welcome.

Have a nice day.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version