From 8defcee49be881f8c7b8327f07b988fbe5c7171d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 8 Sep 2014 16:31:14 -0700 Subject: maint: prefer 'return status;' to 'exit (status);' in 'main' * build-aux/gen-single-binary.sh: Don't use ATTRIBUTE_NORETURN for main functions. * src/base64.c, src/basename.c, src/cat.c, src/chcon.c, src/chgrp.c: * src/chmod.c, src/chown.c, src/chroot.c, src/cksum.c, src/comm.c: * src/cp.c, src/csplit.c, src/cut.c, src/date.c, src/dd.c, src/df.c: * src/dircolors.c, src/dirname.c, src/du.c, src/echo.c, src/env.c: * src/expand.c, src/expr.c, src/factor.c, src/fmt.c, src/fold.c: * src/getlimits.c, src/groups.c, src/head.c, src/hostid.c: * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c: * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/make-prime-list.c: * src/md5sum.c, src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mktemp.c: * src/mv.c, src/nice.c, src/nl.c, src/nohup.c, src/nproc.c: * src/numfmt.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c: * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c: * src/readlink.c, src/realpath.c, src/rm.c, src/rmdir.c, src/runcon.c: * src/seq.c, src/shred.c, src/shuf.c, src/sleep.c, src/sort.c: * src/split.c, src/stat.c, src/stdbuf.c, src/stty.c, src/sum.c: * src/sync.c, src/tac.c, src/tail.c, src/tee.c, src/timeout.c: * src/touch.c, src/tr.c, src/true.c, src/truncate.c, src/tsort.c: * src/tty.c, src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c: * src/uptime.c, src/users.c, src/wc.c, src/who.c, src/whoami.c: In 'main' functions, Prefer 'return status;' to 'exit (status);'. * src/coreutils-arch.c (_single_binary_main_uname) (_single_binary_main_arch): * src/coreutils-dir.c, src/coreutils-vdir.c (_single_binary_main_ls) (_single_binary_main_dir, _single_binary_main_vdir): Omit ATTRIBUTE_NORETURN. Return a value. * src/coreutils.c (SINGLE_BINARY_PROGRAM): Omit ATTRIBUTE_NORETURN. (launch_program): Now static. * src/dd.c (finish_up): New function. (quit, main): Use it. * src/getlimits.c (main): Return a proper exit status. * src/test.c (test_main_return): New macro. (main): Use it. * src/logname.c, src/nohup.c, src/whoami.c: Use 'error' to simplify exit status in 'main' function. * src/yes.c (main): Use 'return' rather than 'error' to exit, so that GCC doesn't suggest ATTRIBUTE_NORETURN. --- build-aux/gen-single-binary.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'build-aux') diff --git a/build-aux/gen-single-binary.sh b/build-aux/gen-single-binary.sh index a2423e60d..1128f40c6 100755 --- a/build-aux/gen-single-binary.sh +++ b/build-aux/gen-single-binary.sh @@ -91,8 +91,8 @@ for cmd in $ALL_PROGRAMS; do # CFLAGS # Hack any other program defining a main() replacing its main by # _single_binary_main_$PROGRAM_NAME. - echo "${base}_CFLAGS = \"-Dmain=_single_binary_main_${cmd}(int, char**) " \ - "ATTRIBUTE_NORETURN; int _single_binary_main_${cmd}\" " \ + echo "${base}_CFLAGS = \"-Dmain=_single_binary_main_${cmd} (int, char **);" \ + " int _single_binary_main_${cmd}\" " \ "-Dusage=_usage_${cmd} \$(src_coreutils_CFLAGS)" var=src_${cmd}_CFLAGS eval "value=\$$var" -- cgit v1.2.3-70-g09d2