I and @milancurcic came across a problem while designing the syntax for the manifest file for preprocessor support for FPM. The problem is whether for a particular project we need to consider the order of preprocessing important or not if that project uses multiple preprocessors like cpp and fypp in one project. This means should we consider the case whether a project needs to first be preprocessed using fypp and then cpp and not vice versa or should we consider that case unimportant for now?
Most modern compilers, will invoke their own preprocessors (cpp/fpp) before continuing to the rest of the compilation. Interfering with that order and adding fypp could lead to a number of unwanted results since the compiler would not be unable to guarantee that the fypp produces valid syntax.
When you call gfortran -cpp main.F90, there is the implicit assumption from the user that whatever the compiler does internally it will correctly resolve any and all preprocessor macros. If you were to intervene between the compiler’s preprocessor and the rest of the compilation you better be able to guarantee that your tool’s output (fypp) should be at least as robust and well tested as the compiler’s preprocessors to minimise the probability of creating invalid Fortran syntax. I believe that is not a very reasonable expectation.
In addition, I think it keeps the building process tidier and makes it easier to spot invalid syntax and bugs, if each building step is neatly isolated from the previous one.
Having said all that, I would be curious to see a Minimal Working Example were the order of the preprocessors affects the final result. Would it be possible to update your question with one?
In practice many compilers already support cpp; so a .F90 can be considered “preprocessed” in many ways, especially C code, where almost all C code at least has #include directives. I use dual preprocessing in that sense extensively where I use another preprocessor for extracting documentation, templating, … etc but often generate .F90 files, leaving the simpler preprocessing or preprocessing requiring built-in macros up to cpp/fpp. So I would find it unusuable if the custom preprocessing was not allowed to be first; and personally I have no need for it to be selectable but others might.