Skip to content

topformflat confused by C++14/C23 digit separators #166

@emaxx-google

Description

@emaxx-google

C++14 and C23 introduced single-quotation-mark as digit separators:

int x = 1'048'576;

The parser in topformflat doesn't understand this notation, misinterpreting this as a beginning of a string literal - which confuses all the parsing after that point. And this might lead to inserting invalid line breaks - for example, there:

int x = 1'000;
char c = '"';
int y = 1'000;
char* s = "some_##value";  // a line break gets added before `#` (it's misinterpreted as a preprocessor directive)

This impedes the performance of the lines passes on such programs, because the pass often has to fall back to the non-reformatted file, or at least as the pass performs on wrongly grouped lines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions