]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
manual: Fix missing declaration in setjmp example.
authorCollin Funk <collin.funk1@gmail.com>
Sun, 28 Sep 2025 22:23:16 +0000 (15:23 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Tue, 30 Sep 2025 00:01:54 +0000 (17:01 -0700)
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>
manual/examples/setjmp.c

index 95e328d40102eb606664ce6600227684ff5ec9d4..3c7d97937e439acd5c8855c77c3ae7ba21d34f18 100644 (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 ();
+}