Preprocess files with gcc/gfortran vs. cpp
Nick Papior
nickpapior@gmail.com
Fri Feb 19 20:30:00 GMT 2016
@Timothy
2016-02-19 21:25 GMT+01:00 Jonathan Wakely <jwakely.gcc@gmail.com>:
> On 19 February 2016 at 20:22, Tim Prince wrote:
>>
>>
>> On 2/19/2016 2:30 PM, Jonathan Wakely wrote:
>>> On 19 February 2016 at 19:01, Nick Papior wrote:
>>>> Am I missing some point here?
>>>> I would have expected gcc/gfortran to use the _same_ preprocessing
>>>> utility as that provided in cpp?
>>> By default cpp works in C mode, but when invoked by the Fortran
>>> front-end it runs in a different mode. If you use cpp -x f97-cpp-input
>>> then it works in F95 mode, and you get results consistent with
>>> invoking gcc on a .f file, or invoking gfortran.
>>>
>>> I don't know why cpp treats C and Fortran input differently, but
>>> that's why you don't see what you expect.
>> The most obvious reason is that C99/c++ style pre-processing will break
>> the Fortran // operator (introduced in f77). It doesn't make sense if
>> the previous -traditional option for gcc was changed to f97-cpp-input.
>> Did you mean something like f77-cpp-input?
By adding "-C" you allow // comments to be unaltered, thus allowing
fortran to get those things.
The "non-expandable" preprocessor macros are the issue I am trying to
circumvent.
>
> Oops, yes, I meant -f95-cpp-input
--
Kind regards Nick
More information about the Gcc-help
mailing list