Include files and fpp

Include files and fpp

One of our users has a "dusty" code that has a number of include files that are basically nothing but hundreds of #if, #ifdef, #elf, #define, etc. When the Fortran preprocessor works on the files that include these files, it just copies the "include" line into the processed file, thus passing all of these directives to the main Fortran compiler, which doesn't know how to deal with them. Is there any way to talk fpp into working on the include files while it is preprocessing the file that includes them?

10 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

No - sorry. If you're using cpp-style directives, you should use them consistently - use #include instead of INCLUDE.

Steve

Steve

Thanks, Steve. Although your reply was "No" - it made me realize that mixing styles doesn't work. It will be much easier to change the INCLUDE statements to #include in the source files than to edit the include files themselves.

I just got the exact same problem but using the #include as proposed by Steve causes us some other problem: We are using Visual studio and work in a mixed C/C++/FORTRAN environnement. When we modify the included file, automatic dependency does not work. By that I mean that using the build command will not cause the fort ran file using that included file to be recompile as it was the case when we used the INCLUDE version. This is a very serious issue for us since we are relying on this dependency check to ensure that our developer studio projects are up to date. Removing preprocessing directive from the header file is not a solution neither since we have hundreds of those file and they are used to build our product on multiple platforms (Windows and UNIXs) and this is the only compiler causing this problem. Is there any other way to get both preprocessor directive in include file and get good dependency check up? I should also mention that we are using version 6.1a. I saw version 6.5 being released. Is this problem fixed in the 6.5 version? Any suggestion will be appreciated.

Thanks

I am told that dependence analysis for #include files is supposed to work if you have enabled the FPP option. I know it works in 6.5.

Steve

Steve

Hi Steve, according to your answer it look like it is supposed to work under version 6.1a. I just made sure that "Use FPP" option is checked (under the FORTRAN preprocessor tab in developer studio) and it is set. In fact, without this option, preprocessing does not work at all. Could you confirm us that this was a fix made between 6.1a and 6.5 so we can be sure that this will solve the problem. This way I can justify spending money upgrading our existing sets of Compaq FORTRAN compiler to our system manager.

Hi Steve, we just found where our problem was. I should have thought about it before but better late than never. Our dependency problem was caused because we were using < > instead of " " to include files and dependency are checked only for file using " " which make perfect sense.

Thank you very much for your help.

Stephane,

The only reference I can find to a problem in this area being fixed was that the fix was included in 5.0C. I see no later reports of such a problem. It could be that there is something unusual about your project setup that prevents the analysis from working.

If you would like us to take a look, send a ZIP file of an example project to us at vf-support@compaq.com, along with a problem description. Otherwise, I suggest that you upgrade to 6.5 as if the problem is still in 6.1A, we would not be able to provide an update for that version. If you upgrade by July 31, you'll save money - the upgrade will cost more after that. See our web site for details on the special offer for registered users.

Steve

Steve

I also have a lot of code which has to be maintained on both UNIX and Windows
and would like to keep the #includes the same, but the Visual FORTRAN fpp
does not seem to like nested include files, i.e., where the included file also has
#include statements. I don't use <> like the one respondent, or straight INCLUDEs lke another, but it still doesn't work.
This happens in both 6.1a and 6.5.

I know of no reason nested #includes should not work. If you have an example showing otherwise, send a ZIP archive of your project, and a problem description, to vf-support@compaq.com

Steve

Steve

Login to leave a comment.