Skip to content

[clang-format] AlignTrailingComments has no penalty for not-aligning comments #53711

@rxlecky

Description

@rxlecky

clang-format Version: 13.0.
Description: AlignTrailingComments doesn't always align the block of comments.
Reproduction Steps: Format the following block of code with AlignTrailingComments option on. Notice resulting three different levels of indentation.

#define NODEFERWINDOWPOS // DeferWindowPos routines
#define NOSERVICE // All Service Controller routines, SERVICE_ equates, etc.
#define NOSYSCOMMANDS // SC_*
#define NOVIRTUALKEYCODES // VK_*

Expected Result:

#define NODEFERWINDOWPOS  // DeferWindowPos routines
#define NOSERVICE         // All Service Controller routines, SERVICE_ equates, etc.
#define NOSYSCOMMANDS     // SC_*
#define NOVIRTUALKEYCODES // VK_*

Actual Result:

#define NODEFERWINDOWPOS // DeferWindowPos routines
#define NOSERVICE     // All Service Controller routines, SERVICE_ equates, etc.
#define NOSYSCOMMANDS // SC_*
#define NOVIRTUALKEYCODES // VK_*

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-formatenhancementImproving things as opposed to bug fixing, e.g. new or missing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions