Re: [PATCH 2/2] maint: re-indent C source code.
Collin Funk <[email protected]> Sun, 12 Jul 2026 12:06:15 -0700
| Newsgroups | gmane.comp.gnu.findutils.patches,gmane.comp.gnu.findutils.bugs |
|---|---|
| Message-ID | <[email protected]> |
James Youngman <[email protected]> writes: > Change the indent options that "make indent" uses to that "make > indent" and "make sc_spaces_not_tabs" have consistent expectations. > > * cfg.mk (indent_args): use the --no-tabs option of indent so that > "make indent" produces an output which is acceptalbe to "make > sc_spaces_not_tabs". > * find/ftsfind.c: Re-indent with "make indent". > * find/parser.c: Likewise. > * find/print.c: Likewise. > * find/util.c: Likewise. > * gnulib-local/lib/gcc-function-attributes.h: Likewise. > * locate/locate.c: Likewise. > * tests/xargs/test-sigusr.c: Likewise. > * xargs/xargs.c: Likewise. > --- > cfg.mk | 4 + > find/ftsfind.c | 2 +- > find/parser.c | 32 +++--- > find/print.c | 120 ++++++++++----------- > find/util.c | 2 +- > gnulib-local/lib/gcc-function-attributes.h | 26 ++--- > locate/locate.c | 6 +- > tests/xargs/test-sigusr.c | 4 +- > xargs/xargs.c | 14 +-- > 9 files changed, 107 insertions(+), 103 deletions(-) Cool, I always disliked the mix of tabs and spaces that lots of (mostly) older GNU code has. I think it is because both emacs and indent do it by default. My preference is not to use indent or similar tools (e.g., clang-format) because it is a hassle if all contributors do not have the same version available, since their outputs aren't stable in my experience. Also, 'indent' specifically has some weird behaviors that I dislike. E.g., it makes designated initializes look strange: $ cat main.c #include <time.h> #include <stdlib.h> int main (void) { struct timespec ts = { .tm_sec = 0, .tm_nsec = 0 }; (void) ts; return EXIT_SUCCESS; } $ indent --no-tabs --ignore-profile \ --preprocessor-indentation 1 main.c $ cat main.c #include <time.h> #include <stdlib.h> int main (void) { struct timespec ts = {.tm_sec = 0,.tm_nsec = 0 }; (void) ts; return EXIT_SUCCESS; } Just figured I would bring this up for your consideration. Not trying to demand you disable it or anything like that. :) Collin