layout: Show a warning if no region is included

This seems better than a plain success message for a (probably
accidental) no-op run.

Change-Id: I53b749ce42ecc6c267b6cbe71413d536ec3965c5
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/313
Reviewed-by: Felix Singer <felixsinger@posteo.net>
diff --git a/layout.c b/layout.c
index ef4ebe9..24e25e7 100644
--- a/layout.c
+++ b/layout.c
@@ -186,6 +186,19 @@
 	return 0;
 }
 
+unsigned int layout_num_regions_included(const struct flashprog_layout *const l)
+{
+	const struct romentry *entry = NULL;
+	unsigned int count = 0;
+
+	while ((entry = layout_next(l, entry))) {
+		if (entry->included)
+			++count;
+	}
+
+	return count;
+}
+
 void cleanup_include_args(struct layout_include_args **args)
 {
 	struct layout_include_args *tmp;