Skip to content

Which rule to use for C11 _Generic? #131

Description

While working on dotnet/corefx#30495, I realized that clang-format has transformed:

#define LIMIT_MAX(T) _Generic(((T)0), \
  unsigned int: UINT_MAX,             \
  unsigned long: ULONG_MAX,           \
  unsigned long long: ULLONG_MAX)

into:

#define LIMIT_MAX(T) _Generic(((T)0),              \
                              unsigned int         \
                              : UINT_MAX,          \
                                unsigned long      \
                              : ULONG_MAX,         \
                                unsigned long long \
                              : ULLONG_MAX)

and couldn't quite figure out which *colon* rule needs to be set to leave alone _Generic block: https://clang.llvm.org/docs/ClangFormatStyleOptions.html.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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