491 {
494 "Builtin protocol feature has unsupported builtin_protocol_feature_t: ${codename}",
495 (
"codename",
static_cast<uint32_t>(
f._codename )) );
496
498
501 protocol_feature_exception,
502 "builtin protocol feature with codename '${codename}' already added",
503 (
"codename",
f.builtin_feature_codename) );
504 }
505
506 auto feature_digest =
f.digest();
507
508 const auto& expected_builtin_dependencies = builtin_itr->second.builtin_dependencies;
509 flat_set<builtin_protocol_feature_t> satisfied_builtin_dependencies;
510 satisfied_builtin_dependencies.reserve( expected_builtin_dependencies.size() );
511
512 for(
const auto& d :
f.dependencies ) {
515 "builtin protocol feature with codename '${codename}' and digest of ${digest} has a dependency on a protocol feature with digest ${dependency_digest} that is not recognized",
516 (
"codename",
f.builtin_feature_codename)
517 ("digest", feature_digest)
518 ("dependency_digest", d )
519 );
520
521 if( itr->builtin_feature
522 && expected_builtin_dependencies.find( *itr->builtin_feature )
523 != expected_builtin_dependencies.end() )
524 {
525 satisfied_builtin_dependencies.insert( *itr->builtin_feature );
526 }
527 }
528
529 if( expected_builtin_dependencies.size() > satisfied_builtin_dependencies.size() ) {
530 flat_set<builtin_protocol_feature_t> missing_builtins;
531 missing_builtins.reserve( expected_builtin_dependencies.size() - satisfied_builtin_dependencies.size() );
532 std::set_difference( expected_builtin_dependencies.begin(), expected_builtin_dependencies.end(),
533 satisfied_builtin_dependencies.begin(), satisfied_builtin_dependencies.end(),
535 );
536
537 vector<string> missing_builtins_with_names;
538 missing_builtins_with_names.reserve( missing_builtins.size() );
539 for( const auto& builtin_codename : missing_builtins ) {
542 protocol_feature_exception,
543 "Unexpected error"
544 );
545 missing_builtins_with_names.emplace_back( itr->second.codename );
546 }
547
548 SYS_THROW( protocol_feature_validation_exception,
549 "Not all the builtin dependencies of the builtin protocol feature with codename '${codename}' and digest of ${digest} were satisfied.",
550 ("missing_dependencies", missing_builtins_with_names)
551 );
552 }
553
555 feature_digest,
556 f.description_digest,
558 f.subjective_restrictions.earliest_allowed_activation_time,
559 f.subjective_restrictions.preactivation_required,
560 f.subjective_restrictions.enabled,
562 } );
563
564 SYS_ASSERT( res.second, protocol_feature_exception,
565 "builtin protocol feature with codename '${codename}' has a digest of ${digest} but another protocol feature with the same digest has already been added",
566 (
"codename",
f.builtin_feature_codename)(
"digest", feature_digest) );
567
571 }
572 }
573
575 return *res.first;
576 }
#define SYS_THROW(exc_type, FORMAT,...)
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
protocol_feature_set_type _recognized_protocol_features
end_insert_iterator< Container > end_inserter(Container &c)