Concatenation with -Mpreprocess

This might be related to my macro recursion issue, but perhaps not. What I’d like to do is use the ## operator with -Mpreprocess (or, alternatively, with .F90 files), but I can’t seem to.

For example, let’s say we have test.F90:

#define CONST(x) x ## _const

module test

real :: CONST(height) = 3.5

end module test

Now, we run pgfortran over it:

> pgfortran -E test.F90
# 1 "test.F90"

# 3
module test

real :: height ## _const = 3.5

end module test

Well, it seemed to just ignore ##. (Note: same output if you use -Mpreprocess)

But, if we use -Mcpp:

> pgfortran -Mcpp -E test.F90


module test

real :: height_const = 3.5

end module test

Does this mean that -Mpreprocess does not allow the complete cpp syntax? Is there an alternative concatenation operator for the “built-in” preprocessor?

Does this mean that -Mpreprocess does not allow the complete cpp syntax?

Correct.

Is there an alternative concatenation operator for the “built-in” preprocessor?

Use C-style comments.

% cat testp.F90
#define CONST(x) x/**/_const

module test

real :: CONST(height) = 3.5

end module test
% pgf90 testp.F90 -E
# 1 "testp.F90"

# 3
module test

real :: height_const = 3.5

end module test

Hope this helps,
Mat

Woohoo! Thanks, Mat. That did it.

Is there a reference or cheatsheet out there that does ‘fpp’ equivalents of cpp tricks?