Module Name: src Committed By: kre Date: Wed Nov 10 17:35:45 UTC 2021
Modified Files: src/bin/echo: echo.c Log Message: With -Wall compiling this was giving: echo.c: In function 'main': echo.c:74:1: warning: control reaches end of non-void function This raises 2 issues. First, why with WARNS set to 6, which should include just about everything, was this not causing problems with everyday builds? Surely falling off the end of a non-void function without returning a specific value is one of the more basic errors that should be fixed. (Whatever the name of the function). Is there a missing -Wxxx option? And second, does C99 really promise: Remove unnecessary call to exit(0); returning from main is equivalent since C99. in the sense that simply falling out of main() is exit(0)? Or is it simply saying that the return value of main() is the exit status (which has been true for much longer than since c99)? To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/bin/echo/echo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/echo/echo.c diff -u src/bin/echo/echo.c:1.21 src/bin/echo/echo.c:1.22 --- src/bin/echo/echo.c:1.21 Sun Oct 10 19:07:19 2021 +++ src/bin/echo/echo.c Wed Nov 10 17:35:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: echo.c,v 1.21 2021/10/10 19:07:19 rillig Exp $ */ +/* $NetBSD: echo.c,v 1.22 2021/11/10 17:35:45 kre Exp $ */ /* * Copyright (c) 1989, 1993 @@ -37,7 +37,7 @@ __COPYRIGHT( #if 0 static char sccsid[] = "@(#)echo.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: echo.c,v 1.21 2021/10/10 19:07:19 rillig Exp $"); +__RCSID("$NetBSD: echo.c,v 1.22 2021/11/10 17:35:45 kre Exp $"); #endif #include <err.h> @@ -71,4 +71,5 @@ main(int argc, char *argv[]) fflush(stdout); if (ferror(stdout)) err(1, "write error"); + return 0; }