klauspost/asmfmt

Semicolons in multi-line macros

karalabe opened this issue · 6 comments

The semicolons aren't formatted to the end of the operation in a multi-line macro:

Input:

#define MACRO \
  MOVQ AB BX; \
  MOVQ BX AX ; \
  MOVQ AB BX  ; \
  MOVQ BX AX   \

Output:

#define MACRO \
    MOVQ AB BX;   \
    MOVQ BX AX ;  \
    MOVQ AB BX  ; \
    MOVQ BX AX    \

Expected:

#define MACRO \
    MOVQ AB BX; \
    MOVQ BX AX; \
    MOVQ AB BX; \
    MOVQ BX AX  \

Correct. Semi-colons are not formatted.

Similar, should:

    BYTE $0x48;BYTE $0x8d;BYTE $0x3d;BYTE $0xc9;BYTE $0x6a;BYTE $0xa3;BYTE $0x00

Output:

    BYTE $0x48; BYTE $0x8d; BYTE $0x3d; BYTE $0xc9; BYTE $0x6a; BYTE $0xa3; BYTE $0x00

Ah ok, if it's by design I can live with it. Thought it was a bug.

I do think it would be fair to expect it to work though.

#12 shows a clear improvement, but handling comments is a bit tricky, since block comments are inline in macro lines.

Most corner cases should be covered now. I think semi-colon formatting should be added, otherwise it will just keep annoying me in the future.

Merged #12.