Subject: Re: bug#64133: CC Mode 5.35.2 (C/*l); incorrect indentation for an arrays of structs.

From: Eli Zaretskii <[email-masked]>
Date: Sat, 17 Jun 2023 18:14:34 +0300

> From: Jeff Norden <[email-masked]>
> Date: Sat, 17 Jun 2023 10:03:24 -0500
> 
> I've verified the following behavior with c-version 5.35.2 (emacs-29,
> and emacs-30 from git) and with 5.35.1 (emacs 28.2).
> 
> Place the following text into a file with a ".c" extension, and load
> it with "emacs -Q".
> ==========================================
> #include <stdio.h>
> struct three_ints {
>   int a, b, c;
> };
> int main () {
>   struct three_ints numbers[]= {
>     {0,1,2},
> {3,4,5},
>     {6,7,8}
>   };
>   for (int i=0; i<numbers[2].a; i++) {
>     printf("ack ");
>   }
>   printf("\n");
> }
> ==========================================
> Move the cursor to the beginning of the line with {3,4,5} and press
> <tab> to indent the line.  It will be incorrectly indented 2 spaces
> more than the previous line.  Move to the next line, press <tab>,
> and you'll see:
> 
>   struct three_ints numbers[]= {
>     {0,1,2},
>       {3,4,5},
>         {6,7,8}
>   };

This source code uses the 'linux' indentation style, so you should do

  M-x c-set-style RET linux RET

after which the problem goes away, AFAICT.