Hi,

Klaus Gerlicher wrote:
> Many GNU packages-if not all-use a macro #define _() as a shorthand
> for gettext() to support internationalization in a concise way.
> However, this convention is not currently documented in the GNU coding
> standards.

This convention is documented in multiple places in the GNU gettext
documentation [1][2][3][4].

> This omission causes issues with clang-format, which treats _() as
> a regular function call and consistently inserts a space between _ and (
> during formatting. While minor, this behavior is inconvenient for
> projects following GNU conventions.

[2] actually documents the omission of the space in this context:
  "Many packages use ‘_’ (a simple underline) as a keyword, and write
   ‘_("Translatable string")’ instead of ‘gettext ("Translatable string")’.
   Further, the coding rule, from GNU standards, wanting that there is
   a space between the keyword and the opening parenthesis is relaxed,
   in practice, for this particular usage."

This has been documented like this for more than 20 years.

> I've proposed a change to clang-format to allow customization of
> this behavior (discussion here). However, without a broader policy
> or documentation in the GNU coding style, the maintainers are
> hesitant to accept such a change.
> https://github.com/llvm/llvm-project/pull/159925#issuecomment-3322484612

Maybe it convinces these people that there are more than 500000
occurrences of this pattern in the Debian GNU/Linux source code? [5]

In summary, I don't think it is necessary to adjust the GNU Coding Standards
for such details. I have presented enough arguments for the clang-format
people to listen.

Bruno

[1] https://www.gnu.org/software/gettext/manual/html_node/Overview.html
[2] https://www.gnu.org/software/gettext/manual/html_node/Mark-Keywords.html
[3] https://www.gnu.org/software/gettext/manual/html_node/Libraries.html
[4] https://www.gnu.org/software/gettext/manual/html_node/C.html
[5] https://codesearch.debian.net/search?q=+_%28%22&literal=1




Reply via email to