Skip to content

Conversation

@jim-p-w
Copy link
Contributor

@jim-p-w jim-p-w commented Jan 7, 2026

This PR addresses a problem with the intel fortran preprocessor (fpp).

In particular, the default preprocessor ordering results in a failure to expand a macro properly when it is used as an argument to another macro.
Given the following definitions:

#define COMMA ,
#define STREAM_DEBUG_WRITE(M) call mpas_log_write(M)

followed by the following invocation:

STREAM_DEBUG_WRITE(' -- Setting record to: $i' COMMA intArgs=(/stream % nRecords/))

results in the COMMA and everything after it being eliminated from the final expansion:

call mpas_log_write(' -- Setting record to: $i')

There is a switch you can provide to fpp (via the compiler) which changes the order of nexted macro expansion and gives the desire result.

I tested this by running test_model and verifying correct printouts, using both an intel make build and an intl cmake build.

This fixes a problem when using a macro in the invocation of another macro.
This is only for the intel target when running gnu make.
This fixes a problem when using a macro in the invocation of another macro.
This change is only when running cmake with an intel environment loaded.
@jim-p-w jim-p-w marked this pull request as ready for review January 7, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant