summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/heapwalk.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-01 15:58:59 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-01 15:58:59 +0000
commit894bbbc4f2da0b2157756ba6cdd9063b1c826c80 (patch)
tree9fb38035e2aeb526872e9c4ffa43a1aad886d83e /cpukit/score/src/heapwalk.c
parent2009-08-01 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-894bbbc4f2da0b2157756ba6cdd9063b1c826c80.tar.bz2
2009-08-01 Joel Sherrill <joel.sherrill@oarcorp.com>
* score/inline/rtems/score/heap.inl, score/src/heapwalk.c: Do not inline code to check if newline should be printed. It leads to branch path explosion which is really hard to get coverage on.
Diffstat (limited to 'cpukit/score/src/heapwalk.c')
-rw-r--r--cpukit/score/src/heapwalk.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/cpukit/score/src/heapwalk.c b/cpukit/score/src/heapwalk.c
index cdf6a54670..69782bf4e8 100644
--- a/cpukit/score/src/heapwalk.c
+++ b/cpukit/score/src/heapwalk.c
@@ -22,6 +22,22 @@
#include <rtems/score/interr.h>
#include <rtems/bspIo.h>
+#if defined(__GNUC__)
+ #define DO_NOT_INLINE __attribute__((__noinline__))
+#else
+ #define DO_NOT_INLINE
+#endif
+/*
+ * Helper to avoid introducing even more branches and paths in this
+ * code to do coverage analysis on.
+ *
+ * We do not want this inlined.
+ */
+static void hw_nl(
+ int error,
+ bool do_dump
+) DO_NOT_INLINE;
+
/*PAGE
*
* _Heap_Walk
@@ -113,7 +129,8 @@ bool _Heap_Walk(
error = 1;
}
if (!prev_used) {
- if (do_dump || error) printk("\n");
+
+ hw_nl(do_dump, error);
printk("PASS: %d !two consecutive blocks are free", source);
error = 1;
}
@@ -141,14 +158,14 @@ bool _Heap_Walk(
block = block->next;
}
if (block != the_block) {
- if (do_dump || error) printk("\n");
+ hw_nl(do_dump, error);
printk("PASS: %d !the_block not in the free list", source);
error = 1;
}
}
}
- if (do_dump || error) printk("\n");
+ hw_nl(do_dump, error);
if (the_size < the_heap->min_block_size) {
printk("PASS: %d !block size is too small\n", source);
@@ -184,3 +201,14 @@ bool _Heap_Walk(
return error;
}
+
+/*
+ * This method exists to simplify branch paths in the generated code above.
+ */
+static void hw_nl(
+ int error,
+ bool do_dump
+)
+{
+ if (do_dump || error) printk("\n");
+}