79491489

Date: 2025-03-07 07:06:32
Score: 0.5
Natty:
Report link

After some trial, I found the cause of the issue: the version of clang-format installed via Homebrew.

The clang-format installed through brew:

brew install clang-format

which is located at /opt/homebrew/bin/clang-format. For some reason, this version of clang-format has problems with formatting both .c and .h files.

To resolve this, using clang-format via LLVM instead:

brew install llvm

Then, update the clang-format path to the newly installed version: /opt/homebrew/opt/llvm/bin/clang-format This fixed the issue.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Xinghang Chen