Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress readability-enum-initial-value in clang-tidy #4540

Merged
merged 2 commits into from
Nov 15, 2024

Conversation

danakj
Copy link
Contributor

@danakj danakj commented Nov 15, 2024

This warns unhelpfully on enums like:

enum Kind: int8_t {
  Value,
  ValueOrRef,
  ...
  FullInitializer,
  Last = FullInitializer
};

It claims that all enum values should have explicit values if any of the
values do, but that's not what we would want to write here.

@danakj
Copy link
Contributor Author

danakj commented Nov 15, 2024

cc: @jonmeow

This warns unhelpfully on enums like:

```
enum Kind: int8_t {
  Value,
  ValueOrRef,
  ...
  FullInitializer,
  Last = FullInitializer
};
```

It claims that all enum values should have explicit values if any of the
values do, but that's not what we would want to write here.
@danakj danakj force-pushed the readability-enum-initial-value branch from b57f9f7 to f26e26d Compare November 15, 2024 19:41
-readability-function-cognitive-complexity, -readability-else-after-return,
-readability-identifier-length, -readability-implicit-bool-conversion,
-readability-magic-numbers, -readability-make-member-function-const,
-readability-else-after-return, -readability-enum-initial-value,
Copy link
Contributor

@jonmeow jonmeow Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been trying to document why various warnings are disabled so that we don't forget. Can you add a note above, something like:

  # - readability-enum-initial-value has false positives for `Last = ...`.

(it can't be here due to yaml parsing)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, thanks. I didn't notice the comments up there.

@danakj danakj requested a review from jonmeow November 15, 2024 19:57
@jonmeow
Copy link
Contributor

jonmeow commented Nov 15, 2024

Thanks!

@jonmeow jonmeow added this pull request to the merge queue Nov 15, 2024
Merged via the queue into carbon-language:trunk with commit 3c18a6c Nov 15, 2024
8 checks passed
@danakj danakj deleted the readability-enum-initial-value branch November 15, 2024 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants