Skip to content

Auto-Format destroys multiline macros #1602

Closed
@willie68

Description

@willie68

From the Forum (http://forum.arduino.cc/index.php?topic=191048.0):

In my code I'm defining some macros.
e.g.
Code:

#define calcNP() \
if ((this->state & 0xF0) == 0) { \
    if (myStack.index == stackSize) { \
      this->msNullpoint = getMsValue(); \
      this->nullpoint = mMapMsValue(this->msNullpoint); \
      this->state = this->state | 0xF0; \
        } \
  }

If i try to format this file i get
Code:

#define calcNP() \
if ((this->state & 0xF0) == 0) { 
  \
    if (myStack.index == stackSize) { 
    \
      this->msNullpoint = getMsValue();  
    \
      this->nullpoint = mMapMsValue(this->msNullpoint); 
    \
      this->state = this->state | 0xF0; 
    \
        } 
  \
  }

which now throws compile errors.

The formatter should ignore the macro definition.
In addition it would be nice to have some markers in the source to prevent the formatter to format some portion of the source.
In Eclipse i can do this by adding:

// @formatter:off
...
// @formatter:on

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions