Skip to content

Clang format problemsΒ #31

@fiesh

Description

@fiesh

Alas, clang-format goes rather wild when there are no semicolons present between function declarations, putting them in one line if no empty line is in between, and indenting them when there is.

As a workaround, we added the following macro that allows adding a ; after the signal macro:

#define WS_SIGNAL(...) W_MACRO_MSVC_EXPAND(WS_SIGNAL2(__VA_ARGS__, 0))
#define WS_SIGNAL2(NAME, ...)                                                        \
	W_SIGNAL2(NAME, __VA_ARGS__) struct W_MACRO_CONCAT(w_Dummy_##NAME, __LINE__) \
	{                                                                            \
	}

So now we can write void signal(bool yay) WS_SIGNAL(signal, yay);, and clang-format plays along nicely.

I suspect we might not be the only ones who run into this, so maybe there is a place for something like this in verdigris itself?

Maybe there is also a better solution than defining a dummy struct to allow adding the extra ;?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions