Skip to content

Commit

Permalink
Fix build failure
Browse files Browse the repository at this point in the history
Summary:
FieldId is defined as an empty enum. Some compilers would report a warning if we use it in switch-case

```
error: case value not in enumerated type 'apache::thrift::FieldId' (aka 'apache::thrift::type::FieldId') [-Werror,-Wswitch]
[CONTEXT] case FieldId{1}: {
[CONTEXT] ^
```

Reviewed By: thedavekwon

Differential Revision: D52172806

fbshipit-source-id: 362b53c58a3a04220bc988f315e5868d2a30bb62
  • Loading branch information
TJ Yin authored and facebook-github-bot committed Dec 15, 2023
1 parent 205a36c commit 4c6ce27
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ namespace apache::thrift::detail::annotation {
<%#program:split_structs%>
<%#struct:has_field_with_runtime_annotation?%>
template<> const std::vector<std::any>& field_annotation_values<<%struct:cpp_fullname%>>(FieldId id) {
switch (id) {
switch (static_cast<int16_t>(id)) {
<%#struct:fields%>
case FieldId{<%field:key%>}: {
case <%field:key%>: {
static const folly::Indestructible<std::vector<std::any>> ret = [] {
std::vector<std::any> values;
<%#field:structured_annotations%>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4c6ce27

Please sign in to comment.