Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discrepancy between clang-format and actions lint #2087

Open
robots opened this issue Mar 3, 2025 · 4 comments
Open

Discrepancy between clang-format and actions lint #2087

robots opened this issue Mar 3, 2025 · 4 comments
Milestone

Comments

@robots
Copy link

robots commented Mar 3, 2025

Hi,

When working on samx5x.c file i have tried to format it using clang-format. But this failed lint phase of the PR workflow.

Clang-format wanted this change:

[robot@robot-work blackmagic]$ python run-clang-format.py --style="file:.clang-format" ./src/target/samx5x.c
--- ./src/target/samx5x.c	(original)
+++ ./src/target/samx5x.c	(reformatted)
@@ -141,7 +141,7 @@
 /* Non-Volatile Memory Calibration and Auxiliary Registers */
 #define SAMX5X_NVM_USER_PAGE   UINT32_C(0x00804000)
 #define SAMX5X_NVM_CALIBRATION UINT32_C(0x00800000)
-#define SAMX5X_NVM_SERIAL(n)   (UINT32_C(0x0080600c) + ((n) == 0 ? 0x1f0U : (n)*4U))
+#define SAMX5X_NVM_SERIAL(n)   (UINT32_C(0x0080600c) + ((n) == 0 ? 0x1f0U : (n) * 4U))

 #define SAMX5X_USER_PAGE_OFFSET_LOCK     0x08U
 #define SAMX5X_USER_PAGE_OFFSET_BOOTPROT 0x03U
@robots robots changed the title Discrepancy between clang-format and action linter Discrepancy between clang-format and actions lint Mar 3, 2025
@robots
Copy link
Author

robots commented Mar 3, 2025

@dragonmux
Copy link
Member

This is a known problem with using newer clang-format with this code base. We intend to upgrade the clang-format used by the lint pass to clang-format-18 to grab a pile of fixes (such as this one) that were made in the newer release but didn't want to do that for v2.0 as it is a disruptive change (requires reformatting a pile of files).

This is entirely due to older clang-format being a little buggy around such macros.

@dragonmux dragonmux added this to the v2.1 release milestone Mar 3, 2025
@dragonmux
Copy link
Member

We'll note that whatever we do in relation to this, we're kinda damned either way: people using older clang-format such as comes with Debian stable or Ubuntu get the "right" behaviour (lint-passing) and don't complain, and people using newer get the "wrong" behaviour and complain; people using newer clang-format such as comes with Arch or the Clang APT repos get the right behaviour and don't complain, and people using the older get the wrong behaviour and do complain.

😅 So we get to choose which way we're going to have some subset of users complain - going with the newer clang-format though means getting a pile of bugfixes and it working better with our own setup, so this is why the path we're going to tread for v2.1.

@robots
Copy link
Author

robots commented Mar 3, 2025

I just wanted to point this out because it kicked me, while trying to clean the file. And yes, i am on bleeding edge - Arch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants