Bug in Codewarrior Indentation Format

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bug in Codewarrior Indentation Format

865 Views
beng_
Contributor III

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:

pastedImage_3.png

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.

0 Kudos
4 Replies

596 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hello Ben.

I am not sure if I fully understand your questions.

from my understanding, you want to set default indentation for wrapped lines. did you try this:

pastedImage_1.png


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

596 Views
beng_
Contributor III

Jennie,

I want:

case 1:  // No Parenthesis

  function();

  break;

to have the same indentation as:

case (1):  // Parenthesis

  function();

  break;

When in fact adding the parenthesis appears as:

case (1):  // Parenthesis

    function();

break;

0 Kudos

596 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hello Ben,

I have reproduced your problem.

I will contact development team for it.

If I get any news, I will let you know.

Thanks for bringing the problem to our attention.


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

596 Views
beng_
Contributor III

Thanks

0 Kudos