Using the default configuration with the following changes:
cmt_convert_tab_to_spaces = true
align_var_def_span = 2
align_assign_span = 2
ORIGINAL FILE (array_init.c):
uint8_t a1 = 0;
uint16_t name = 1;
uint32_t long_name_is_long = 3;
uint16_t testing_really_long_variable_name = 5;
uint16_t array[4] = {0};
uint8_t b[4] = {0};
uint_32_t array_name[DEFINED_NUMBER] = {0};
OUTPUT (array_init.unc):
uint8_t a1 = 0;
uint16_t name = 1;
uint32_t long_name_is_long = 3;
uint16_t testing_really_long_variable_name = 5;
uint16_t array[4] = {0};
uint8_t b[4] = {0};
uint_32_t array_name[DEFINED_NUMBER] = {0};
align_assign_span doesn't seem to work for the variables that are arrays. Not sure if this is a bug or if there's some other setting somewhere that needs to be set.
Are you sure you have pushed the right source?
Using:
define DEFINED_NUMBER 4
void a()
{
int a1 = 0;
int name = 1;
int long_name_is_long = 3;
int testing_really_long_variable_name = 5;
int array[4] = {0};
int b[4] = {0};
int array_name[DEFINED_NUMBER] = {0};
}
I get exactly what you wanted to have:
void a()
{
int a1 = 0;
int name = 1;
int long_name_is_long = 3;
int testing_really_long_variable_name = 5;
}
-
Last edit: john fong 2016-04-18
It seems to work if you enclose everything into a function like you tested it. In my original source, all those variables are global and declared outside of a function.
When I run the attached cfg on array_init.c, I get array_init.unc which doesn't format the arrays correctly.
When I run the attached cfg on array_init_fnc.c, I get array_init_fnc.unc which does format it as expected.