Thanks, there's a bug in the recognition of the switch labels in this
situation. However, your patch doesn't work generally, so I've fixed
it in another way.
Also, the matter of the "right" indentation is of course a matter of
style. My fix corrects the syntactic info on the erring lines (they
were "statement", but should be "statement-case-intro"). From your
example it's ambiguous whether you want the lines indented one
c-basic-offset step or whether you want them aligned under first
statement in the case clause. If it's the latter, you'll have to put
an appropriate lineup function on statement-case-intro when you
upgrade to the fixed version (which will be 5.27).
Mike McEwan <mike(a)lotusland.demon.co.uk> wrote:
When a multi-line statement appears on the same line as a case
label, the following lines in the `case block' are not correctly
indented.
Example:
int function()
{
switch (arg) {
case 1: printf("Action to be taken for"
"case 1 here\n");
printf("This line indented incorrectly!\n");
break;
case 2: printf("Action to be taken for"
"case 2 here\n");
printf("This line indented incorrectly!\n");
break;
default: printf("Not allowed!\n");
}
return 0;
}
The following patch hopefully rectifies the situation in the correct
fashion (there's some intricate stuff going on in there :-)), to
produce:
int function()
{
switch (arg) {
case 1: printf("Action to be taken for"
"case 1 here\n");
printf("This line indented incorrectly!\n");
break;
case 2: printf("Action to be taken for"
"case 2 here\n");
printf("This line indented incorrectly!\n");
break;
default: printf("Not allowed!\n");
}
return 0;
}