]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fsmonitor: mark some maybe-unused parameters
authorJeff King <peff@peff.net>
Mon, 18 Sep 2023 22:31:48 +0000 (18:31 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 18 Sep 2023 22:56:14 +0000 (15:56 -0700)
There's a bit of conditionally-compiled code in fsmonitor, so some
function parameters may be unused depending on the build options:

  - in fsmonitor--daemon.c's try_to_run_foreground_daemon(), we take a
    detach_console argument, but it's only used on Windows. This seems
    intentional (and not mistakenly missing other platforms) based on
    the discussion in c284e27ba7 (fsmonitor--daemon: implement 'start'
    command, 2022-03-25), which introduced it.

  - in fsmonitor-setting.c's check_for_incompatible(), we pass the "ipc"
    flag down to the system-specific fsm_os__incompatible() helper. But
    we can only do so if our platform has such a helper.

In both cases we can mark the argument as MAYBE_UNUSED. That annotates
it enough to suppress the compiler's -Wunused-parameter warning, but
without making it impossible to use the variable, as a regular UNUSED
annotation would.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fsmonitor--daemon.c
fsmonitor-settings.c

index 7e99c4d61ba95942014d8ab2681568f53658fd0d..7c4130c9811bd526748651f284aa1330dff30abe 100644 (file)
@@ -1412,7 +1412,7 @@ done:
        return err;
 }
 
-static int try_to_run_foreground_daemon(int detach_console)
+static int try_to_run_foreground_daemon(int detach_console MAYBE_UNUSED)
 {
        /*
         * Technically, we don't need to probe for an existing daemon
index b62acf44aee2b9c029fac4389f6af7e4c4df6dab..a6a9e6bc199ec2ea0b608212da2f5b4a6edd94ed 100644 (file)
@@ -62,7 +62,8 @@ static enum fsmonitor_reason check_remote(struct repository *r)
 }
 #endif
 
-static enum fsmonitor_reason check_for_incompatible(struct repository *r, int ipc)
+static enum fsmonitor_reason check_for_incompatible(struct repository *r,
+                                                   int ipc MAYBE_UNUSED)
 {
        if (!r->worktree) {
                /*