[clang] [clang-format] Add SpaceBeforeUnderscoreParens option for GNU gettext… (PR #159925)
Simon Marchi via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 12 09:02:03 PST 2026
simark wrote:
I would like to revive this PR. Is there something in the proposed alternatives that would be acceptable?
- My `SpaceBeforeIdentifierExceptions` suggestion (or an option under `SpaceBeforeParensOptions`), which is weirdly specific but at least doesn't hardcode `_`. It would be usable by other people, it would not be specific to GNU. It is also more extensible (just needs a config change), for instance, I just recalled there is also the `N_` macro, which we would want to treat the same way:
https://gitlab.com/gnutools/binutils-gdb/-/blob/65f5e3d727e539ae3a017faf79ff45a821147e5d/gdb/inf-child.c#L44-45
- A `SBPO_GNU` value for `SpaceBeforeParens`. It would fix our use case (we could implement any logic we want in there), but it would not be useful for anybody else. Also, if we realize later that another macro or identifier shoud be treated the same, it would require a change to clang-format to implement it, wait for that change to be part of a release, etc.
We tried to push for a change in the GNU standards to make it more "official", but it got kind of shot down because "well it's not _mandatory_ for GNU projects to use it" (although they pretty much all do) and "it's so widespread already we don't need to mention it" (sigh...).
See:
- https://lists.gnu.org/archive/html/bug-standards/2025-09/msg00009.html
- https://lists.gnu.org/archive/html/bug-standards/2025-10/msg00001.html
https://github.com/llvm/llvm-project/pull/159925
More information about the cfe-commits
mailing list