Menu

#550 Wrong indentation when using switch-case inside a function implementation

closed-fixed
2023-01-24
2021-11-16
Joel Wirz
No

Dear Mr Pattee

We have an issue with the Artistic Style regarding the indentaion of switch-case statements inside function definitions. We are using C-language.

In the attachement you can find a c-source file (wrong_indentation.c) in which a function is defined and a switch-case is used immediately at the beginning of the function. Unfortunately the second case is indented wrong as well as the braces of the first and second case.
Interestingly, if the return type is changed from enum to void (or int, double, etc.), the formatting is correct. Also, when an if-statement is added before the switch-case statement follows, the formatting is also correct. You can also find an example in the attachement (correct_indentation.c).
I also appended the config file (AStyleOptions.txt) with which we run the AStyle.

Is there a way how I can change the configuration to solve this issue?
If not, might this be a finding in your software (I couldn't find any tickets regarding this topic)?

Any help would be much appreciated.

Kind Regards
Joël Wirz

3 Attachments

Discussion

  • André Simon

    André Simon - 2022-11-25
    • assigned_to: Jim Pattee --> André Simon
     
  • André Simon

    André Simon - 2022-11-25
    • status: open --> open-accepted
     
  • André Simon

    André Simon - 2023-01-24
    • status: open-accepted --> closed-fixed
     
  • André Simon

    André Simon - 2023-01-24

    This issue was resolved in the latest 3.2 beta release.

     

Log in to post a comment.

MongoDB Logo MongoDB