I am getting ready about adding support of macros to C++ parser.
There is one hard issue there:
When any macro changes, it is often required to reparse a lot of files (all that use it).
As we parse files quite often (at least, at each file switch), this would be slow.
I am therefore trying to find some other, less complex way how to do that.
The simple way is to do it at compile time (if any macros have changed) and at user request. The downside is that sometimes the code database would be 'out-of-sync' (contain wrong information w.r.t. macros).
unodgs Messages: 1366 Registered: November 2005 Location: Poland
Ultimate Contributor
If you collect information about which file is affected by particular macro I think this scenario could be applied - for macros used by one or two files assist should work imediatelly, for rest before build process. Some kind of simple heuristics.
If you collect information about which file is affected by particular macro I think this scenario could be applied - for macros used by one or two files assist should work imediatelly, for rest before build process. Some kind of simple heuristics.
unodgs Messages: 1366 Registered: November 2005 Location: Poland
Ultimate Contributor
luzr wrote on Thu, 20 November 2008 12:29
unodgs wrote on Thu, 20 November 2008 09:57
If you collect information about which file is affected by particular macro I think this scenario could be applied - for macros used by one or two files assist should work imediatelly, for rest before build process. Some kind of simple heuristics.
Uhm, is it worth the trouble?
OTOH, not a bad idea.
Mirek
The only rason it's worth the trouble is a case when you edit macro used only in current file and you use this macro in this file so you can have correct intelisense.
I think for now you could parse files only before build. It should be enough. I didn't write any macro since one/two years..
I just gave you an idea because you were asking
If you collect information about which file is affected by particular macro I think this scenario could be applied - for macros used by one or two files assist should work imediatelly, for rest before build process. Some kind of simple heuristics.
Uhm, is it worth the trouble?
OTOH, not a bad idea.
Mirek
The only rason it's worth the trouble is a case when you edit macro used only in current file and you use this macro in this file so you can have correct intelisense.
I think for now you could parse files only before build. It should be enough. I didn't write any macro since one/two years..
I just gave you an idea because you were asking
The file edited would be reparsed anyway, it always is.
How fast it is? Can it improve compilation time of UPP, if it will be used for preprocessing and let gcc/MSC just to compile?
Anybody with enough free time on hands to try?
It would be interesting if I would plan to do C++ compiler.
For our purpose, we need something different.
In fact, parsing is not a problem with macros. The problem is the whole structure. We cannot preprocess files the same way as C++ compiler does - that would be too slow for A++.
Sender Ghost Messages: 301 Registered: November 2008
Senior Member
luzr
It would be interesting if I would plan to do C++ compiler.
For our purpose, we need something different.
In fact, parsing is not a problem with macros. The problem is the whole structure. We cannot preprocess files the same way as C++ compiler does - that would be too slow for A++.
Mirek
Ok, no problem here. Just to note.
I suggest you some modes for preprocessor part of A++:
- Current mode: Current OS, compiler and configuration.
- Free mode: All OS'es, compilers (and configuration).
mr_ped
How fast it is? Can it improve compilation time of UPP, if it will be used for preprocessing and let gcc/MSC just to compile?
Anybody with enough free time on hands to try?
Would be slow. It's not my point. I thinking Mirek have some troubles with preprocessing. He haven't.
It would be interesting if I would plan to do C++ compiler.
For our purpose, we need something different.
In fact, parsing is not a problem with macros. The problem is the whole structure. We cannot preprocess files the same way as C++ compiler does - that would be too slow for A++.
Mirek
Ok, no problem here. Just to note.
I suggest you some modes for preprocessor part of A++:
- Current mode: Current OS, compiler and configuration.
- Free mode: All OS'es, compilers (and configuration).