manual: Fix missing declaration in setjmp example.

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  <adhemerval.zanella@linaro.org>
This commit is contained in:
Collin Funk 2025-09-28 15:23:16 -07:00
parent dd4e8ae64e
commit 8df2a7811e
1 changed files with 10 additions and 11 deletions

View File

@ -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 ();
}