AnsweredAssumed Answered

Bug in Codewarrior Indentation Format

Question asked by Ben Griffiths on Apr 11, 2017
Latest reply on Apr 13, 2017 by Ben Griffiths

Unless I'm doing something wrong I think I've found a bug in Code Warrior, when using Auto Indentation

My indentation options (in Window/Preferences/C/C++/Code Style/Formatter/Edit/Indentation) are:

 

Take a simple switch statement (I've used a dash to indicate a space below):

uint8_t var;

switch (var)

{

case 1:

--perform_action_1();

--break;

 

case 2:

--perform_action_2();

--break;

}

I want the case statement to start same at the column  as the switch statement (as above). Typing the code above produces correctly indented code. However if I add parenthesis around the case statement expression (i.e. case (1) : instead of case 1:)  changes the indentation to:

uint8_t var;

switch (var)

{

case (1):

----perform_action_1();

break;

 

case (2):

----perform_action_2();

break;

}

I can't see anything in the code style formatter options that should cause adding parenthesis to result in thiis crazy indentation.

 

So:

  1. is this a bug or have I done something wrong?
  2. If it's a bug what's the process for reporting a bug?

 

As an addendum this same issues is present in Kinetis Design Studio so the problem may be with Eclipse.

Outcomes