Skip to content

manifest: extend preprocess_config_t for external preprocessor support#1268

Open
ijatinydv wants to merge 1 commit into
fortran-lang:mainfrom
ijatinydv:extend-preprocess-config
Open

manifest: extend preprocess_config_t for external preprocessor support#1268
ijatinydv wants to merge 1 commit into
fortran-lang:mainfrom
ijatinydv:extend-preprocess-config

Conversation

@ijatinydv

Copy link
Copy Markdown
Contributor

Right now fpm silently drops any [preprocess] section that isn't cpp, there's a four-line guard in add_config() at lines 320–324 that returns early with a warning if the name isn't "cpp". This PR removes that guard and adds the fields needed to describe an external preprocessor in fpm.toml.

What changed

preprocess.f90 — two things:

  1. Removed the CPP-only guard in add_config(). Any preprocessor name is now accepted.
  2. Added four new fields to preprocess_config_t:
    • command — the executable to invoke (e.g. "fypp"). This is the activation key: a section without command stays silently ignored, so existing [preprocess.fypp] sections in the wild don't break.
    • arguments(:) — extra CLI flags passed verbatim.
    • output-suffix — output extension, defaults to .f90. Set to .F90 for tools that emit output requiring a second CPP pass.
    • depfile — opt-in boolean for --depfile support. Defaults .false. so custom tools that don't support the flag are never passed it.

Also added is_external(), returns .true. when command is allocated. This single check will gate all external execution in the phases that follow.

Updated everything that touches fields: check() whitelist, new_preprocess_config(), dump_to_toml, load_from_toml, preprocess_is_same, destroy, add_config, and info.

test_manifest.f90 — added two tests: preprocess-external parses a full fypp config with all new fields and verifies a serialization roundtrip; preprocess-backward-compat verifies that a section without command leaves is_external() as .false. and produces no error.

Backward compatibility

Existing [preprocess.cpp] manifests work exactly as before. A [preprocess.fypp] section without command is still silently ignored same behavior as today.

This is the manifest groundwork for the external preprocessor execution engine. The execution logic, Phase A integration in build_model(), and target system changes come in follow up PRs. Raising this early so the schema can get feedback before the rest is built on top of it.

Related: #78, #308, #469

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