[wave] skip include directives

Hi, I cant find in the documentation so I wondering if it is possible to skip include directives. To do not try to open the file and continues with the preprocessing normally. Best regards, -- Felipe Magno de Almeida

Felipe Magno de Almeida wrote:
I cant find in the documentation so I wondering if it is possible to skip include directives. To do not try to open the file and continues with the preprocessing normally.
Do you want to completely skip the processing of certain include files or do you only want to suppress the generated output? BTW: Why do you want to do that? It'ld be very helpful for me if you could describe in more detail what you're planning to do with Wave and how you're plannning to use it. Regards Hartmut
Best regards, -- Felipe Magno de Almeida _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

On 5/15/06, Hartmut Kaiser <hartmut.kaiser@gmail.com> wrote:
Felipe Magno de Almeida wrote:
I cant find in the documentation so I wondering if it is possible to skip include directives. To do not try to open the file and continues with the preprocessing normally.
Do you want to completely skip the processing of certain include files or do you only want to suppress the generated output? BTW: Why do you want to do that?
I want to skip the preprocessing completely.
It'ld be very helpful for me if you could describe in more detail what you're planning to do with Wave and how you're plannning to use it.
I would like to be able to preprocess a file without having all headers. I'm not interested in the output of the preprocessing, I'm interested in analyzing the include directives and the conditionals of the file. I want to extract all preprocessing "paths" of the file and extract include directives.
Regards Hartmut
Thanks, -- Felipe Magno de Almeida

Felipe Magno de Almeida wrote:
I would like to be able to preprocess a file without having all headers. I'm not interested in the output of the preprocessing, I'm interested in analyzing the include directives and the conditionals of the file.
Conditionals generally, and include directives sometimes, depend on preprocessing instructions (macros) processed prior to the current directive. How can you analyze them if you can't be sure you know the value of the macros they are referring to ? Regards, Stefan

On 5/15/06, Stefan Seefeld <seefeld@sympatico.ca> wrote:
Felipe Magno de Almeida wrote:
I would like to be able to preprocess a file without having all headers. I'm not interested in the output of the preprocessing, I'm interested in analyzing the include directives and the conditionals of the file.
Conditionals generally, and include directives sometimes, depend on preprocessing instructions (macros) processed prior to the current directive. How can you analyze them if you can't be sure you know the value of the macros they are referring to ?
I'll preprocess both paths.
Regards, Stefan
-- Felipe Magno de Almeida Consultor - Expertise Solutions

Felipe Magno de Almeida wrote:
On 5/15/06, Stefan Seefeld <seefeld@sympatico.ca> wrote:
Felipe Magno de Almeida wrote:
I would like to be able to preprocess a file without having all headers. I'm not interested in the output of the preprocessing, I'm interested in analyzing the include directives and the conditionals of the file. Conditionals generally, and include directives sometimes, depend on preprocessing instructions (macros) processed prior to the current directive. How can you analyze them if you can't be sure you know the value of the macros they are referring to ?
I'll preprocess both paths.
Oh, so you want to recognize an include directive without actually processing the included file ? What if you have #include "foo.hh" #include BAR and the value of BAR depends on the preprocessor's state after having (pre-)processed foo.hh ? Regards, Stefan

On 5/15/06, Stefan Seefeld <seefeld@sympatico.ca> wrote:
[snipped]
Oh, so you want to recognize an include directive without actually processing the included file ?
What if you have
#include "foo.hh" #include BAR
and the value of BAR depends on the preprocessor's state after having (pre-)processed foo.hh ?
In this case the header would have to exist or an error should be emited for the include directive. I want to be able to preprocess a file without *needing* the system headers. Although, using them is a lot safer. #include BAR is very common in boost for including extension headers, but the macros are all defined in the boost headers. So there is no problem.
Regards, Stefan
Thanks, -- Felipe Magno de Almeida Consultor - Expertise Solutions

Felipe Magno de Almeida wrote:
I want to be able to preprocess a file without *needing* the system headers. Although, using them is a lot safer.
That's the point: To get predictable / correct results you can't skip processing included files. Anything else is heuristic. Regards, Stefan

On 5/15/06, Stefan Seefeld <seefeld@sympatico.ca> wrote:
Felipe Magno de Almeida wrote:
I want to be able to preprocess a file without *needing* the system headers. Although, using them is a lot safer.
That's the point: To get predictable / correct results you can't skip processing included files. Anything else is heuristic.
You can if you know what it do. For instance, I dont need to include a STL header to be able to preprocess a source file. Most headers are safe to not include. Also, I should be able to cache the modified state from a header and do not need to re-preprocess it again for another file.
Regards, Stefan
best regards, -- Felipe Magno de Almeida

Felipe Magno de Almeida wrote:
Felipe Magno de Almeida wrote:
I want to be able to preprocess a file without *needing* the system headers. Although, using them is a lot safer.
That's the point: To get predictable / correct results you can't skip processing included files. Anything else is heuristic.
You can if you know what it do. For instance, I dont need to include a STL header to be able to preprocess a source file. Most headers are safe to not include. Also, I should be able to cache the modified state from a header and do not need to re-preprocess it again for another file.
Wave is quite intelligent wrt skipping include files wherever possible. It supports the #pragma once directive and uses a heuristic to recognize standard header guarding schemes to avoid duplicate inclusion of a file. So there is no need for you worry about that. Regards Hartmut

On 5/15/06, Hartmut Kaiser <hartmut.kaiser@gmail.com> wrote:
[snipped]
Wave is quite intelligent wrt skipping include files wherever possible. It supports the #pragma once directive and uses a heuristic to recognize standard header guarding schemes to avoid duplicate inclusion of a file. So there is no need for you worry about that.
I mean when preprocessing different files. Usually they will contain the same dependencies, being able to cache this (using a graph for the dependencies) it could really improve preprocessing of lots of files. This tool should preprocess entire subsets of boost, preprocessing some headers again and again should be really slow. Pragma once wouldnt help here, since I want to cache a preprocessing that would occur inside preprocessing two different files.
Regards Hartmut
Thanks, -- Felipe Magno de Almeida

Felipe Magno de Almeida wrote:
Wave is quite intelligent wrt skipping include files wherever possible. It supports the #pragma once directive and uses a heuristic to recognize standard header guarding schemes to avoid duplicate inclusion of a file. So there is no need for you worry about that.
I mean when preprocessing different files. Usually they will contain the same dependencies, being able to cache this (using a graph for the dependencies) it could really improve preprocessing of lots of files.
How do you know that '...when preprocessing different files. Usually they will
contain the same dependencies...'?
This tool should preprocess entire subsets of boost, preprocessing some headers again and again should be really slow. Pragma once wouldnt help here, since I want to cache a preprocessing that would occur inside preprocessing two different files.
IIUC in this case you will even have to switch off Waves #pragma once support and the corresponding heuristics because otherwise it won't even open a header file for the second time. Anyway, it would be really helpful to know, what you're going to do with Wave and how. All I've got so far is that you somehow want to analyze include file dependencies. Sorry if I've missed this, but is this project going to build an extention to the current bcp tool? Regards Hartmut

On 5/15/06, Hartmut Kaiser <hartmut.kaiser@gmail.com> wrote:
Felipe Magno de Almeida wrote:
[snipped]
How do you know that '...when preprocessing different files. Usually they will
contain the same dependencies...'?
Dont have to be exactly. I'll explain better what I want. If I have three headers: 'a', 'b' and 'c'. I want to preprocess 'a' and 'b'. depends -> has a include directive 'a' depends on 'b' and 'c', and 'b' depends on 'c'. If I start preprocessing 'b', I want to cache all the analysys I created for 'b' to be used when preprocessing 'a', without having to preprocess 'b' all again. The same applies for 'c' that is include'd directly in 'a' and is used in 'b', so the analysys for it is already made, I dont need to preprocess 'c' when preprocessing 'a' *and* preprocessing 'b'.
This tool should preprocess entire subsets of boost, preprocessing some headers again and again should be really slow. Pragma once wouldnt help here, since I want to cache a preprocessing that would occur inside preprocessing two different files.
IIUC in this case you will even have to switch off Waves #pragma once support and the corresponding heuristics because otherwise it won't even open a header file for the second time.
No, that wouldn't be necessary. I dont care for the case where one header will *not* preprocess two times in the same translation file. I care *only* when preprocessing two different translation files, which I want to cache the preprocessing of all headers.
Anyway, it would be really helpful to know, what you're going to do with Wave and how. All I've got so far is that you somehow want to analyze include file dependencies. Sorry if I've missed this, but is this project going to build an extention to the current bcp tool?
I'm doing some research to see if Wave is really useable for creating a new bcp tool for handling dependencies more accurately. I'm writing yet the proposal for boost, it is done, but is *really really* weak, and I'm *very very* late in rewriting the proposal with details of the project. There are some issues, but in general I cannot see any major issue for writing it. This tool should, IMO, be usable for handling dependencies for all toolsets, which is impossible if the whole environment needs to be available to the tool (e.g. system headers). Hope you understood what I'm after.
Regards Hartmut
Thanks! -- Felipe Magno de Almeida

Felipe Magno de Almeida wrote:
How do you know that '...when preprocessing different files. Usually they will
contain the same dependencies...'?
Dont have to be exactly. I'll explain better what I want. If I have three headers: 'a', 'b' and 'c'. I want to preprocess 'a' and 'b'. depends -> has a include directive 'a' depends on 'b' and 'c', and 'b' depends on 'c'.
If I start preprocessing 'b', I want to cache all the analysys I created for 'b' to be used when preprocessing 'a', without having to preprocess 'b' all again. The same applies for 'c' that is include'd directly in 'a' and is used in 'b', so the analysys for it is already made, I dont need to preprocess 'c' when preprocessing 'a' *and* preprocessing 'b'.
You lost me here, sorry.
This tool should preprocess entire subsets of boost, preprocessing some headers again and again should be really slow. Pragma once wouldnt help here, since I want to cache a preprocessing that would occur inside preprocessing two different files.
IIUC in this case you will even have to switch off Waves #pragma once support and the corresponding heuristics because otherwise it won't even open a header file for the second time.
No, that wouldn't be necessary. I dont care for the case where one header will *not* preprocess two times in the same translation file. I care *only* when preprocessing two different translation files, which I want to cache the preprocessing of all headers.
Ok, let's recap. You have: - file A including file C and - file B including file C and you want to get all dependencies for file A and for file B (independently). IIUC you can skip the preprocessing of file C during the analysis of file B (given you've already analyzed file A) only if the overall preprocessing context upto the inclusion point of file C will be the same for both file A and B. IOW you need some kind of precompiled header support. You can't skip the preprocessing of file C if file A and file B are different before the inclusion point of C. I would suggest not to put too much effort into this kind of optimization, it's too much of a border case. Try starting with a straightforward implementation analysing everything as it goes.
Anyway, it would be really helpful to know, what you're going to do with Wave and how. All I've got so far is that you somehow want to analyze include file dependencies. Sorry if I've missed this, but is this project going to build an extention to the current bcp tool?
I'm doing some research to see if Wave is really useable for creating a new bcp tool for handling dependencies more accurately. I'm writing yet the proposal for boost, it is done, but is *really really* weak, and I'm *very very* late in rewriting the proposal with details of the project. There are some issues, but in general I cannot see any major issue for writing it. This tool should, IMO, be usable for handling dependencies for all toolsets, which is impossible if the whole environment needs to be available to the tool (e.g. system headers). Hope you understood what I'm after.
Understood. Regards Hartmut
participants (3)
-
Felipe Magno de Almeida
-
Hartmut Kaiser
-
Stefan Seefeld