Skip to content

mccode-clangformat breaks long one-line #define macros #3123

Closed

Description

@willend

Found by @mads-bertelsen while formatting #3095 (see #3095 (comment)).

devel/bin/mccode-clangformat breaks long one-line preprocessor macros. Example from IncoherentPhonon_process.comp:

#define UNION_CASE_PHYSICS_SCATTERING_INCOHERENTPHONON(out, ...) case IncoherentPhonon: out = IncoherentPhonon_physics_scattering(__VA_ARGS__); break;

is rewritten so the macro line ends after the function call, with //break; on the next line. break is then outside the macro, and the generated switch case can fall through.

Seen in IncoherentPhonon_process.comp and Inhomogenous_incoherent_process.comp; formatting was reverted on those lines in #3095. The same dispatch-macro pattern exists in all Union *_process.comp files, so any line over the 160-column limit is affected.

Likely cause: the script escapes # lines as //__ESC__PRE#... comments before calling clang-format, and clang-format reflows comments longer than ColumnLimit, splitting the directive.

Expected: preprocessor lines (including \ continuations) pass through the formatter unchanged.

Activity

  1. added a commit that references this issue on Nov 17, 2026
    b10e276
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions