logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: 9fa6bfdee258a5986574299408159cb3177a836a
parent d810dd53e756680bbe62e639e5893a503c40a377
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Wed, 18 Dec 2024 10:17:10 +0100

configure: add when supported: -Wstrict-prototypes -Wmissing-prototypes

Diffstat:

Mcmd/basename.c2+-
Mcmd/pwd.c2+-
Mconfigure7++++++-
Mconfigure.d/cflag_test.c3+++
Mconfigure.d/copy_file_range.c2++
Mconfigure.d/reallocarray.c2++
Mconfigure.d/sendfile_linux.c3+++
Mconfigure.d/syncfs.c2++
Mlib/offline_realpath.c2++
Mlib/sha256.c2+-
Mlib/sha512.c2+-
11 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/cmd/basename.c b/cmd/basename.c @@ -35,7 +35,7 @@ suffix_basename(char *name, char *suffix) } static void -usage() +usage(void) { fputs("Usage: basename [-z] [path] [suffix]\n" " basename [-az] [-s suffix] [path...]\n", diff --git a/cmd/pwd.c b/cmd/pwd.c @@ -19,7 +19,7 @@ enum pwd }; static void -usage() +usage(void) { fputs("Usage: pwd [-L|-P]\n", stderr); } diff --git a/configure b/configure @@ -213,7 +213,12 @@ echo check_cflag "-Werror=implicit-function-declaration" && CFLAGS_CHECK="${CFLAGS_CHECK} -Werror=implicit-function-declaration" -check_cflag -Wwrite-strings && CFLAGS="${CFLAGS} -Wwrite-strings" +for f in -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes +do + check_cflag "$f" && CFLAGS="${CFLAGS} $f" +done + +echo if ! check_header mntent.h; then echo 'Disabling cmd/df' diff --git a/configure.d/cflag_test.c b/configure.d/cflag_test.c @@ -1,5 +1,8 @@ // SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me> // SPDX-License-Identifier: 0BSD + +int foo(int c); + int foo(int c) { diff --git a/configure.d/copy_file_range.c b/configure.d/copy_file_range.c @@ -10,6 +10,8 @@ #include <sys/types.h> #include <unistd.h> +ssize_t test(int in, int out); + ssize_t test(int in, int out) { diff --git a/configure.d/reallocarray.c b/configure.d/reallocarray.c @@ -8,6 +8,8 @@ #include <stdlib.h> // reallocarray +void test(void); + void test(void) { diff --git a/configure.d/sendfile_linux.c b/configure.d/sendfile_linux.c @@ -6,6 +6,9 @@ #define _POSIX_C_SOURCE 200809L #include <sys/sendfile.h> + +ssize_t test(int in, int out, size_t len); + ssize_t test(int in, int out, size_t len) { diff --git a/configure.d/syncfs.c b/configure.d/syncfs.c @@ -8,6 +8,8 @@ #include <unistd.h> // syncfs +int test(int fd); + int test(int fd) { diff --git a/lib/offline_realpath.c b/lib/offline_realpath.c @@ -3,6 +3,8 @@ // SPDX-License-Identifier: MIT #define _POSIX_C_SOURCE 200809L +#include "fs.h" + #include <errno.h> #include <limits.h> #include <stdlib.h> diff --git a/lib/sha256.c b/lib/sha256.c @@ -116,7 +116,7 @@ sha256_init(void *ctx) s->h[7] = 0x5be0cd19; } -void +static void sha256_sum_n(void *ctx, uint8_t *md, int n) { struct sha256 *s = ctx; diff --git a/lib/sha512.c b/lib/sha512.c @@ -133,7 +133,7 @@ sha512_init(void *ctx) s->h[7] = 0x5be0cd19137e2179ULL; } -void +static void sha512_sum_n(void *ctx, uint8_t *md, int n) { struct sha512 *s = ctx;