V Mon, Apr 10, 2023 at 01:29:41PM -0600, Nicolas Bock napsal(a): > The following code is aligned incorrectly using indent-2.2.12: > > ```C > #include <stdlib.h> > > #define TYPED(name) name ## _typed > > typedef void matrix_t; > > void TYPED (testfunc) (void) > { > matrix_t*A = NULL; > matrix_t*B = NULL; > } > > void testfunc (void) > { > matrix_t*A = NULL; > matrix_t*B = NULL; > } > ``` > > ```console > indent -par test.c > ``` > > ```diff > --- test.c 2023-04-10 13:21:00.516535705 -0600 > +++ test-2.2.12.c 2023-04-10 13:21:04.172585827 -0600 > @@ -6,12 +6,13 @@ > > void TYPED (testfunc) (void) > { > - matrix_t*A = NULL; > - matrix_t*B = NULL; > + matrix_t * A = NULL; > + matrix_t *B = NULL; > } > > -void testfunc (void) > +void > +testfunc (void) > { > - matrix_t*A = NULL; > - matrix_t*B = NULL; > + matrix_t *A = NULL; > + matrix_t *B = NULL; > } > ``` > > The pointer's indirection operator '*' for variable A is incorrectly > aligned in the first function definition. This is a regression from > indent-2.2.11. > I confirm it with 2.2.13. Because indent does not perform a macro expansion, the reproducer can be reduced to:
/* If a function name is hidden with a parametrized macro, and a variable type * is not a built-in type, then a first variable definition with a pointer of * that type in the function block will have a star character misaligned. * (indent -par) */ void TYPED (foo) (void) { bar *A = NULL; bar *B = NULL; bar *C = NULL; } -- Petr
signature.asc
Description: PGP signature