fsmonitor: mark some maybe-unused parameters

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>

Jeff King committed Sep 18, 2023 at 18:31 UTC f4c5778b2dca447ae130cfab6cc9b7b614e7ec43
2 files changed +3 -2
builtin/fsmonitor--daemon.c
+1 -1
@@ -1412,7 +1412,7 @@ done:
1412 return err;
1413 }
1414
1415 -static int try_to_run_foreground_daemon(int detach_console)
1415 +static int try_to_run_foreground_daemon(int detach_console MAYBE_UNUSED)
1416 {
1417 /*
1418 * Technically, we don't need to probe for an existing daemon
fsmonitor-settings.c
+2 -1
@@ -62,7 +62,8 @@ static enum fsmonitor_reason check_remote(struct repository *r)
62 }
63 #endif
64
65 -static enum fsmonitor_reason check_for_incompatible(struct repository *r, int ipc)
65 +static enum fsmonitor_reason check_for_incompatible(struct repository *r,
66 + int ipc MAYBE_UNUSED)
67 {
68 if (!r->worktree) {
69 /*