Auto Indent not working with Macro Function

Completed

I'm using ChibiOS and Threads are defined like follows:

THD_WORKING_AREA(switching_calc_thread_wa, 128);
THD_FUNCTION(switching_calc_thread, p) {
(void)p;
chRegSetThreadName("Switching Calculation Thread");

unsigned int i;
static double result = 1;

for(i=0; i<10000000000; i++){
result = result * i;
}
}

Here is an example where it didnt format:

/*
* This is a periodic thread that does absolutely nothing except flashing
* a LED.
*/
static THD_WORKING_AREA(serial_interface_thread_wa, 128);
static THD_FUNCTION(serial_interface_thread, arg) {

(void)arg;
chRegSetThreadName("blinker");
while (true) {
palSetLine(LINE_LED1);
chThdSleepMilliseconds(50);
palSetLine(LINE_LED2);
chThdSleepMilliseconds(200);
palClearLine(LINE_LED1);
chThdSleepMilliseconds(50);
palClearLine(LINE_LED2);
chThdSleepMilliseconds(200);
sdWrite(&SD4, (int8_t*)"HohohoHohohoHohohoHohohoHohohoHohohoHohohoHohohoHohohoHohohoHohohoHohohoHohohoHohohoHohoho\r\n", 256);
}
}

Unfortunatley CLion does not detect that as a function and does not autoindent. Replacing the THD_FUNCTION with void x() works. Is there a setting I can tweak?

0
5 comments

Hello!

Could you please clarify what indents you miss and where? Thanks!

0

Before there where no indents at all. everything on the same level. Heres another example:

/*
* This is a periodic thread that does absolutely nothing except flashing
* a LED.
*/
static THD_WORKING_AREA(serial_interface_thread_wa, 128);
static THD_FUNCTION(serial_interface_thread, arg) {

(void)arg;
chRegSetThreadName("blinker");
while (true) {
palSetLine(LINE_LED1);
chThdSleepMilliseconds(50);
palSetLine(LINE_LED2);
chThdSleepMilliseconds(200);
palClearLine(LINE_LED1);
chThdSleepMilliseconds(50);
palClearLine(LINE_LED2);
chThdSleepMilliseconds(200);
sdWrite(&SD4, (int8_t*)"HohohoHohohoHohohoHohohoHohohoHohohoHohohoHohohoHohohoHohohoHohohoHohohoHohohoHohohoHohoho\r\n", 256);
}
}

0

Hi Julian!

I recall that I saw a comment from you that the new update had fixed the issue. But I don't see it now. Do you still experience the issue?

0

Yes i edited the comment. It seems like thats only happening when the macro can't be resolved.

0

Just wanted to indicate (better late than never) that formatting works correctly indeed only for properly resolved code.

0

Please sign in to leave a comment.