clang-format `AlignConsecutiveDeclarations: AcrossEmptyLinesAndComments` does NOT work on functions
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
clang-format 22 (from llvm repo for Debian) is suggesting to break the alignment of `gimp_scroll_get_adjustment_value`. But it should still remain aligned with `gimp_scrolled_preview_thaw` and `gimp_scroll_adjustment_values` since I am using `AlignConsecutiveDeclarations: AcrossEmptyLinesAndComments`
[.clang-format.zip](https://github.com/user-attachments/files/30388528/default.clang-format.zip)
```diff
--- libgimpwidgets/gimpscrolledpreview.h (before formatting)
+++ libgimpwidgets/gimpscrolledpreview.h (after formatting)
@@ -70,12 +70,12 @@
void gimp_scrolled_preview_thaw (GimpScrolledPreview *preview);
/* utility function for scrolled-window like gimp widgets, like the canvas */
-void gimp_scroll_get_adjustment_values (GdkEventScroll *sevent,
- GtkAdjustment *hadj,
- GtkAdjustment *vadj,
- gdouble *hvalue,
- gdouble *vvalue,
- gboolean clamp_output);
+void gimp_scroll_get_adjustment_values (GdkEventScroll *sevent,
+ GtkAdjustment *hadj,
+ GtkAdjustment *vadj,
+ gdouble *hvalue,
+ gdouble *vvalue,
+ gboolean clamp_output);
/* legacy version of the same (imposes clamping on output) */
void gimp_scroll_adjustment_values (GdkEventScroll *sevent,
```
Contributor guide
Research direction
Start with the formatting example in libgimpwidgets/gimpscrolledpreview.h and the attached .clang-format configuration; reproduce the result with clang-format 22. Trace how AlignConsecutiveDeclarations handles function declarations across empty lines and comments. Done means the three gimp_* declarations remain aligned under this option, with regression coverage for the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100