From 6eead7e28eed56b2cb2099fa462fcbbd2f741cad Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Fri, 14 Apr 2023 12:13:49 +0200 Subject: [PATCH] Warn if some looms don't have the rank Fallback to sorting by loom name instead. --- src/emu/system.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/emu/system.c b/src/emu/system.c index a098789..bd72ead 100644 --- a/src/emu/system.c +++ b/src/emu/system.c @@ -482,22 +482,20 @@ init_offsets(struct system *sys, struct trace *trace) static int set_sort_criteria(struct system *sys) { + int some_have = 0; + int all_have = 1; for (struct loom *l = sys->looms; l; l = l->next) { - if (l->rank_enabled) { - sys->sort_by_rank = 1; - break; - } + if (l->rank_enabled) + some_have = 1; + else + all_have = 0; } - if (!sys->sort_by_rank) - return 0; - - for (struct loom *l = sys->looms; l; l = l->next) { - if (!l->rank_enabled) { - err("missing rank for loom %s", l->id); - return -1; - } - } + /* Only sort by rank if all looms have the rank information */ + if (all_have) + sys->sort_by_rank = 1; + else if (some_have) + warn("missing rank in some looms, cannot sort CPUs by rank"); return 0; }