+static int maybe_warn_about_dependency(const char *id, const char *other, UnitDependency dependency) {
+ switch (dependency) {
+ case UNIT_REQUIRES:
+ case UNIT_REQUIRES_OVERRIDABLE:
+ case UNIT_WANTS:
+ case UNIT_REQUISITE:
+ case UNIT_REQUISITE_OVERRIDABLE:
+ case UNIT_BINDS_TO:
+ case UNIT_PART_OF:
+ case UNIT_REQUIRED_BY:
+ case UNIT_REQUIRED_BY_OVERRIDABLE:
+ case UNIT_WANTED_BY:
+ case UNIT_BOUND_BY:
+ case UNIT_CONSISTS_OF:
+ case UNIT_REFERENCES:
+ case UNIT_REFERENCED_BY:
+ case UNIT_PROPAGATES_RELOAD_TO:
+ case UNIT_RELOAD_PROPAGATED_FROM:
+ case UNIT_JOINS_NAMESPACE_OF:
+ return 0;
+
+ case UNIT_CONFLICTS:
+ case UNIT_CONFLICTED_BY:
+ case UNIT_BEFORE:
+ case UNIT_AFTER:
+ case UNIT_ON_FAILURE:
+ case UNIT_TRIGGERS:
+ case UNIT_TRIGGERED_BY:
+ if (streq_ptr(id, other))
+ log_warning_unit(id, "Dependency %s=%s dropped from unit %s",
+ unit_dependency_to_string(dependency), id, other);
+ else
+ log_warning_unit(id, "Dependency %s=%s dropped from unit %s merged into %s",
+ unit_dependency_to_string(dependency), id,
+ strna(other), id);
+ return -EINVAL;
+
+ case _UNIT_DEPENDENCY_MAX:
+ case _UNIT_DEPENDENCY_INVALID:
+ break;
+ }
+ assert_not_reached("Invalid dependency type");
+}
+