From 776515ef8b381d49caeccfe2e8da98cb666e257a Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 19 Aug 2022 06:08:54 -0400 Subject: [PATCH] is_path_owned_by_current_uid(): mark "report" parameter as unused In the non-Windows version of this function, we never have any errors to report, and thus the "report" parameter is unused. But we can't drop it, because we have to maintain function call compatibility with the version in compat/mingw.h, which does use this parameter. Note that there's an extra level of indirection here; the common function is actually is_path_owned_by_current_user, which is a macro pointing to "by_current_uid" or "by_current_sid", depending on the platform. So an alternative here is to eat the unused parameter in the macro, since -Wunused-parameter doesn't complain about macros. But I think the UNUSED() annotation is less obfuscated for somebody reading the code later. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- git-compat-util.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/git-compat-util.h b/git-compat-util.h index 12239fedf7..a9690126bb 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -498,7 +498,8 @@ static inline void extract_id_from_env(const char *env, uid_t *id) } } -static inline int is_path_owned_by_current_uid(const char *path, struct strbuf *report) +static inline int is_path_owned_by_current_uid(const char *path, + struct strbuf *UNUSED(report)) { struct stat st; uid_t euid;