]> granicus.if.org Git - gc/commitdiff
Workaround 'function nested_sp is never used' cppcheck style warning
authorIvan Maidanski <ivmai@mail.ru>
Tue, 15 May 2018 09:39:03 +0000 (12:39 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 15 May 2018 09:39:03 +0000 (12:39 +0300)
The warning should not be produced by cppcheck as nested_sp is assigned
to nested_sp_fn variable.

* tools/setjmp_t.c [CPPCHECK] (main): Call nested_sp() directly; add
comment.

tools/setjmp_t.c

index fffc65c67badafa6465412bdc7f8d9136e5a6604..bef71f21f0eecbd599f08dc5b36b773c4dc8c48b 100644 (file)
@@ -86,6 +86,9 @@ int main(void)
 
     sp = (word)(&sp);
     printf("This appears to be a %s running %s\n", MACH_TYPE, OS_TYPE);
+#   if defined(CPPCHECK)
+      (void)nested_sp(); /* to workaround a bug in cppcheck */
+#   endif
     if (nested_sp_fn() < sp) {
       printf("Stack appears to grow down, which is the default.\n");
       printf("A good guess for STACKBOTTOM on this machine is 0x%lx.\n",