Skip to content

Commit

Permalink
Auto-generate files after cl/625527117
Browse files Browse the repository at this point in the history
  • Loading branch information
protobuf-team-bot committed Apr 17, 2024
1 parent db5814e commit 2a9e5ef
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
23 changes: 19 additions & 4 deletions php/ext/google/protobuf/php-upb.c
Original file line number Diff line number Diff line change
Expand Up @@ -14713,20 +14713,35 @@ const UPB_DESC(FeatureSet*)
size_t n;
const UPB_DESC(FeatureSetDefaults_FeatureSetEditionDefault)* const* d =
UPB_DESC(FeatureSetDefaults_defaults)(defaults, &n);
const UPB_DESC(FeatureSet)* ret = NULL;
const UPB_DESC(FeatureSetDefaults_FeatureSetEditionDefault)* result = NULL;
for (size_t i = 0; i < n; i++) {
if (UPB_DESC(FeatureSetDefaults_FeatureSetEditionDefault_edition)(d[i]) >
edition) {
break;
}
ret = UPB_DESC(FeatureSetDefaults_FeatureSetEditionDefault_features)(d[i]);
result = d[i];
}
if (ret == NULL) {
if (result == NULL) {
_upb_DefBuilder_Errf(ctx, "No valid default found for edition %s",
upb_FileDef_EditionName(edition));
return NULL;
}
return ret;

// Merge the fixed and overridable features to get the edition's default
// feature set.
const UPB_DESC(FeatureSet)* fixed = UPB_DESC(
FeatureSetDefaults_FeatureSetEditionDefault_fixed_features)(result);
const UPB_DESC(FeatureSet)* overridable = UPB_DESC(
FeatureSetDefaults_FeatureSetEditionDefault_overridable_features)(result);
if (!fixed && !overridable) {
_upb_DefBuilder_Errf(ctx, "No valid default found for edition %s",
upb_FileDef_EditionName(edition));
return NULL;
} else if (!fixed) {
return overridable;
}
return _upb_DefBuilder_DoResolveFeatures(ctx, fixed, overridable,
/*is_implicit=*/true);
}

// Allocate and initialize one file def, and add it to the context object.
Expand Down
23 changes: 19 additions & 4 deletions ruby/ext/google/protobuf_c/ruby-upb.c
Original file line number Diff line number Diff line change
Expand Up @@ -14204,20 +14204,35 @@ const UPB_DESC(FeatureSet*)
size_t n;
const UPB_DESC(FeatureSetDefaults_FeatureSetEditionDefault)* const* d =
UPB_DESC(FeatureSetDefaults_defaults)(defaults, &n);
const UPB_DESC(FeatureSet)* ret = NULL;
const UPB_DESC(FeatureSetDefaults_FeatureSetEditionDefault)* result = NULL;
for (size_t i = 0; i < n; i++) {
if (UPB_DESC(FeatureSetDefaults_FeatureSetEditionDefault_edition)(d[i]) >
edition) {
break;
}
ret = UPB_DESC(FeatureSetDefaults_FeatureSetEditionDefault_features)(d[i]);
result = d[i];
}
if (ret == NULL) {
if (result == NULL) {
_upb_DefBuilder_Errf(ctx, "No valid default found for edition %s",
upb_FileDef_EditionName(edition));
return NULL;
}
return ret;

// Merge the fixed and overridable features to get the edition's default
// feature set.
const UPB_DESC(FeatureSet)* fixed = UPB_DESC(
FeatureSetDefaults_FeatureSetEditionDefault_fixed_features)(result);
const UPB_DESC(FeatureSet)* overridable = UPB_DESC(
FeatureSetDefaults_FeatureSetEditionDefault_overridable_features)(result);
if (!fixed && !overridable) {
_upb_DefBuilder_Errf(ctx, "No valid default found for edition %s",
upb_FileDef_EditionName(edition));
return NULL;
} else if (!fixed) {
return overridable;
}
return _upb_DefBuilder_DoResolveFeatures(ctx, fixed, overridable,
/*is_implicit=*/true);
}

// Allocate and initialize one file def, and add it to the context object.
Expand Down

0 comments on commit 2a9e5ef

Please sign in to comment.