diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py index 163b105bc6..98327d0144 100755 --- a/xen/tools/gen-cpuid.py +++ b/xen/tools/gen-cpuid.py @@ -350,7 +350,7 @@ def crunch_numbers(state): for feat in deep_features: - seen = [feat] + seen = [] to_process = list(deps[feat]) while len(to_process): @@ -363,14 +363,17 @@ def crunch_numbers(state): f = to_process.pop(0) + if f == feat: + raise Fail("ERROR: Cycle found when processing %s" % + (state.names[f], )) + if f in seen: - raise Fail("ERROR: Cycle found with %s when processing %s" - % (state.names[f], state.names[feat])) + continue seen.append(f) to_process = list(set(to_process + deps.get(f, []))) - state.deep_deps[feat] = seen[1:] + state.deep_deps[feat] = seen state.deep_features = deps.keys() state.nr_deep_deps = len(state.deep_deps.keys())