From 8df2a7811e5adce61e9329e8107cb6b430f2fcc5 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Sun, 28 Sep 2025 15:23:16 -0700 Subject: [PATCH] manual: Fix missing declaration in setjmp example. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Previously this file would fail to compile with the following error: $ gcc manual/examples/setjmp.c manual/examples/setjmp.c: In function ‘main’: manual/examples/setjmp.c:37:7: error: implicit declaration of function ‘do_command’ [-Wimplicit-function-declaration] 37 | do_command (); | ^~~~~~~~~~ manual/examples/setjmp.c: At top level: manual/examples/setjmp.c:42:1: warning: conflicting types for ‘do_command’; have ‘void(void)’ 42 | do_command (void) | ^~~~~~~~~~ manual/examples/setjmp.c:37:7: note: previous implicit declaration of ‘do_command’ with type ‘void(void)’ 37 | do_command (); | ^~~~~~~~~~ Reviewed-by: Adhemerval Zanella --- manual/examples/setjmp.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/manual/examples/setjmp.c b/manual/examples/setjmp.c index 95e328d401..3c7d97937e 100644 --- a/manual/examples/setjmp.c +++ b/manual/examples/setjmp.c @@ -27,17 +27,6 @@ abort_to_main_loop (int status) longjmp (main_loop, status); } -int -main (void) -{ - while (1) - if (setjmp (main_loop)) - puts ("Back at main loop...."); - else - do_command (); -} - - void do_command (void) { @@ -47,3 +36,13 @@ do_command (void) else exit (EXIT_SUCCESS); } + +int +main (void) +{ + while (1) + if (setjmp (main_loop)) + puts ("Back at main loop...."); + else + do_command (); +} -- 2.47.3