Source->Format (DS 2.3.0)


#1

In my project properties I selected C/C++ General -> Formatter and checked Enable project specific settings.
Then I selected one of the built-in and went to edit and saved with new name and selected that.

Source->Format however still sticks to the formatter that I based my custom one on instead of my formatter.

The formatter I used as base is the BSD/Allman one.

It also doesn’t matter if I use project specific or workspace wide configuration.


#2

I’ve found another problem with the source formatter in 2.3.0. If you have a pointer in an if statement with two conditions, and the first condition tests against NULL, the formatter does not correctly format the code, and all code following the statement is not formatted correctly (using BSD/Allman). If the test for NULL is the second condition, the formatter works correctly. For example:

Correct:

/* Set 1s cyclic timer */
    adl_tmr_t * timer_handle = adl_tmrSubscribe(TRUE, 10, ADL_TMR_TYPE_100MS, HelloWorld_TimerHandler);

    if ((timer_handle < 0) || (timer_handle == NULL ))
    {
        TRACE(( 1, "Timer Subscription failed." ));
    }

Incorrect after formatter applied:

/* Set 1s cyclic timer */
    adl_tmr_t * timer_handle = adl_tmrSubscribe(TRUE, 10, ADL_TMR_TYPE_100MS, HelloWorld_TimerHandler);

    if ((timer_handle == NULL )|| (timer_handle < 0)){
    TRACE (( 1, "Timer Subscription failed." ));
}

#3

@tobias: can’t reproduce your issue… Code formatter customizations are correctly applied on our side…

@tomridl: we reproduced the issue. Sounds like an Eclipse CDT formatter bug. We’ve raised a ticket on their side for following: bugs.eclipse.org/bugs/show_bug.cgi?id=401663


#4

I’m not sure what has changed since last time I tried it, but it seems to be working as intended now…


#5

Thanks daav.