RTEMS | rtems: Add a clang-format ignore file (!1531)

Sebastian Huber (@sebhub) gitlab at rtems.org
Sat Oct 10 02:16:44 UTC 2026



Sebastian Huber created a merge request: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1531

Project:Branches: sebhub/rtems:up/clang-format-ignore to rtems/rtos/rtems:main
Author: Sebastian Huber

## Summary

Issue #3860: Code Formatting and Style Check for RTEMS

Commits:

- `rtems: Add a clang-format ignore file`

This merge request is a counter proposal to !1527. That merge request
removes `_clang-format`, because clang-format applies the style to
sources which do not follow it. This merge request keeps the style file
and adds a `.clang-format-ignore` file next to it. The file lists:

| Group | Examples |
| ----- | -------- |
| Imported code | `**/contrib/**`, `cpukit/dtc`, `cpukit/libmd` |
| Data generated from binary images | `fsdosfsname01/image*.h`, `fdt01/*-dtb.h` |
| Code which does not follow the conventions | `bsps`, `cpukit/score/cpu`, `cpukit/libdl`, the shell |
| Headers which are not formatted yet | 58 headers in `cpukit/include/rtems` |

A `.clang-format-ignore` file in `bsps/sparc`, `bsps/include/grlib` and
`bsps/shared/grlib` turns the formatting back on for these directories.
A line of the header group can go once its header is formatted.

Result of a run of clang-format 22.1.8 from the top directory:

| State | Changed sources |
| ----- | --------------: |
| `main` | 4457 |
| `main` with this merge request | 272 |
| with this merge request, !1509 and !1511 | 44 |

The 44 sources drifted from the style after the reformat.

Notes:

- clang-format 18 and later reads `.clang-format-ignore`. It does not
  read `_clang-format-ignore`. The style file itself needs
  clang-format 22. Version 21 rejects `IndentPPDirectives: Leave`.
- `git clang-format` skips the ignored files.
- A tool which passes an ignored file through the standard input with
  `--assume-filename` gets an empty output and the exit status 0.
- `.gitlab/ignore.toml` lists the exemptions of the format check of the
  CI. Its list overlaps with the new file. This merge request leaves it
  unchanged.

## AI Details
<!-- Make sure you have read our statement at https://www.rtems.org/generative-ai/ -->

### Prompt used

None as a single prompt. The work was done in an interactive Claude
Code session on the RTEMS tree. The session measured which sources
follow the style and tested how clang-format reads the ignore files.
Each change was directed and reviewed.

### AI model used

Claude Opus 5.5 (claude-opus-5-5), through Claude Code.

### How AI was used for the contribution

- [x] Formatting
- [ ] Test creation.
- [ ] Code comments.
- [ ] The entire contribution was generated using AI
- [ ] AI code completion such as Copilot in VSCode.

The session wrote the ignore files from its measurements and drafted the
commit message and this description.

### Access

I have not used a product which claims copyright in its output, and I
have legitimate access to the one I used.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1531
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/namespace/49/sent_notifications/6-0sr5sd4f21u8zf2i6z8yyzuq3-1d/unsubscribe | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | Help: https://gitlab.rtems.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20261010/f5615b17/attachment-0001.htm>


More information about the bugs mailing list