aboutsummaryrefslogtreecommitdiffstats
path: root/libfdisk/src/script.c
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas@t-8ch.de>2023-11-19 17:27:40 +0100
committerThomas Weißschuh <thomas@t-8ch.de>2023-11-20 17:45:22 +0100
commit2a472ae894033b22b4beaa17c1c6e363c4ee3c9b (patch)
tree4a031a9f569752a13ddb77cad6c63bc5229353c0 /libfdisk/src/script.c
parent129f1c83b4fa2d485b04f3d4479b021593197dca (diff)
downloadutil-linux-2a472ae894033b22b4beaa17c1c6e363c4ee3c9b.tar.gz
treewide: explicitly mark unused arguments
The autotools build used -Wno-unused-parameter to silence these warnings for a few files. On meson however this configuration was not duplicated leading to persistent warnings, preventing the usage of -Werror. Instead of having to maintain the exceptions in two buildsystems, mark the exceptions directly in the source code. Afterward clean up autotools to not use -Wno-unused-parameter anymore. Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Diffstat (limited to 'libfdisk/src/script.c')
-rw-r--r--libfdisk/src/script.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c
index efa743f91d..e357fad9a4 100644
--- a/libfdisk/src/script.c
+++ b/libfdisk/src/script.c
@@ -1669,8 +1669,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
#endif
#ifdef TEST_PROGRAM
-static int test_dump(struct fdisk_test *ts, int argc, char *argv[])
+static int test_dump(struct fdisk_test *ts __attribute__((unused)),
+ int argc, char *argv[])
{
+ if (argc != 2)
+ return -1;
+
char *devname = argv[1];
struct fdisk_context *cxt;
struct fdisk_script *dp;
@@ -1688,8 +1692,12 @@ static int test_dump(struct fdisk_test *ts, int argc, char *argv[])
return 0;
}
-static int test_read(struct fdisk_test *ts, int argc, char *argv[])
+static int test_read(struct fdisk_test *ts __attribute__((unused)),
+ int argc, char *argv[])
{
+ if (argc != 2)
+ return -1;
+
char *filename = argv[1];
struct fdisk_script *dp;
struct fdisk_context *cxt;
@@ -1711,8 +1719,12 @@ static int test_read(struct fdisk_test *ts, int argc, char *argv[])
return 0;
}
-static int test_stdin(struct fdisk_test *ts, int argc, char *argv[])
+static int test_stdin(struct fdisk_test *ts __attribute__((unused)),
+ int argc, char *argv[] __attribute__((unused)))
{
+ if (argc != 1)
+ return -1;
+
char buf[BUFSIZ] = { '\0' };
struct fdisk_script *dp;
struct fdisk_context *cxt;
@@ -1746,8 +1758,12 @@ static int test_stdin(struct fdisk_test *ts, int argc, char *argv[])
return rc;
}
-static int test_apply(struct fdisk_test *ts, int argc, char *argv[])
+static int test_apply(struct fdisk_test *ts __attribute__((unused)),
+ int argc, char *argv[])
{
+ if (argc != 3)
+ return -1;
+
char *devname = argv[1], *scriptname = argv[2];
struct fdisk_context *cxt;
struct fdisk_script *dp;
@@ -1788,8 +1804,12 @@ done:
return 0;
}
-static int test_tokens(struct fdisk_test *ts, int argc, char *argv[])
+static int test_tokens(struct fdisk_test *ts __attribute__((unused)),
+ int argc, char *argv[])
{
+ if (argc != 2)
+ return -1;
+
char *p, *str = argc == 2 ? strdup(argv[1]) : NULL;
int i;