Skip to content

clang-format: hangs when a CASE macro is defined and used #163202

@nickie

Description

@nickie

The following simple .clang-format file, defining a CASE macro, results in a hang when trying to format the following simple poc.cc file.

$ cat .clang-format
Macros:
  - CASE=case

$ cat poc.cc
int f() {
  switch (42) {
#define CASE(kind)
    CASE(1)
    CASE(2)
#undef CASE
  }
}

$ ./clang-format -version
clang-format version 21.1.3 (https://github.com/llvm/llvm-project 450f52eec88f728c89a9efd667dbeaf2dad93826)

$ ./clang-format poc.cc
^Cinterrupted

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions