Skip to content

[clang-format] Incorrectly formatted macro #78965

Closed
@prj-

Description

@prj-
$ cat foo.c 
#define foo(i, j)     (i - bar(j))
#define foo(i, j)     ((i) - bar(j))
$ clang-format --version
clang-format version 17.0.6
$ clang-format foo.c    
#define foo(i, j) (i - bar(j))
#define foo(i, j) ((i)-bar(j))
$ clang-format-18 --version
Debian clang-format version 18.0.0 (++20240119100743+cd05ade13a66-1~exp1~20240119220916.1830)
$ clang-format-18 foo.c 
#define foo(i, j) (i - bar(j))
#define foo(i, j) ((i)-bar(j))

Shouldn't the proper output be the following?

#define foo(i, j) (i - bar(j))
#define foo(i, j) ((i) - bar(j))

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions