threads / patch / 62234

patchFix unused-parameter warnings with NO_ICONV

Subject: [PATCH] Fix unused-parameter warnings with NO_ICONV

## tl;dr

6 messages between Oct 2, 2024 and Oct 3, 2024. Diffs are folded; open one to read it.

replies: 5people: 4as markdown or json

Mike Hommey· Oct 2, 2024, 09:06 UTC · lore
The jk/unused-parameters topic enabled -Wunused-parameter. Some code in
some non-typical configuration lacked annotations.
---
 utf8.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Show changes to utf8.h +3 −2
diff --git a/utf8.h b/utf8.h
index fcd5167baf..cce299d274 100644
--- a/utf8.h
+++ b/utf8.h
@@ -33,8 +33,9 @@ char *reencode_string_len(const char *in, size_t insz,
 			  const char *in_encoding,
 			  size_t *outsz);
 #else
-static inline char *reencode_string_len(const char *a, size_t b,
-					const char *c, const char *d, size_t *e)
+static inline char *reencode_string_len(const char *a UNUSED, size_t b UNUSED,
+					const char *c UNUSED,
+					const char *d UNUSED, size_t *e)
 { if (e) *e = 0; return NULL; }
 #endif
 
-- 
2.46.1.1.gad55fb22ef
Kristoffer Haugsbakk· Oct 2, 2024, 09:47 UTC · re: Mike Hommey · lore

Re: [PATCH] Fix unused-parameter warnings with NO_ICONV

On Wed, Oct 2, 2024, at 11:06, Mike Hommey wrote:
> The jk/unused-parameters topic enabled -Wunused-parameter. Some code in
> some non-typical configuration lacked annotations.
You forgot the sign-off.
-- 
Kristoffer Haugsbakk
Mike Hommey· Oct 2, 2024, 20:01 UTC · re: Kristoffer Haugsbakk · lore

The jk/unused-parameters topic enabled -Wunused-parameter. Some code in some non-typical configuration lacked annotations.

Signed-off-by: Mike Hommey <mh@glandium.org>
---
 utf8.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Show changes to utf8.h +3 −2
diff --git a/utf8.h b/utf8.h
index fcd5167baf..cce299d274 100644
--- a/utf8.h
+++ b/utf8.h
@@ -33,8 +33,9 @@ char *reencode_string_len(const char *in, size_t insz,
 			  const char *in_encoding,
 			  size_t *outsz);
 #else
-static inline char *reencode_string_len(const char *a, size_t b,
-					const char *c, const char *d, size_t *e)
+static inline char *reencode_string_len(const char *a UNUSED, size_t b UNUSED,
+					const char *c UNUSED,
+					const char *d UNUSED, size_t *e)
 { if (e) *e = 0; return NULL; }
 #endif
 
-- 
2.46.1.1.gad55fb22ef
Jeff King· Oct 2, 2024, 22:01 UTC · re: Mike Hommey · lore

Re: [PATCH] Fix unused-parameter warnings with NO_ICONV

On Thu, Oct 03, 2024 at 05:01:40AM +0900, Mike Hommey wrote:
> The jk/unused-parameters topic enabled -Wunused-parameter. Some code in
> some non-typical configuration lacked annotations.

Thanks, this looks good. I tried to catch compile-time variants like this, but I was mostly limited to what we build in CI.

Out of curiosity, what platform do you use that needs NO_ICONV (or is it just a preference)?

-Peff
Mike Hommey· Oct 3, 2024, 21:02 UTC · re: Jeff King · lore

Re: [PATCH] Fix unused-parameter warnings with NO_ICONV

On Wed, Oct 02, 2024 at 06:01:18PM -0400, Jeff King wrote:
Show 10 quoted lines
> On Thu, Oct 03, 2024 at 05:01:40AM +0900, Mike Hommey wrote:
> 
> > The jk/unused-parameters topic enabled -Wunused-parameter. Some code in
> > some non-typical configuration lacked annotations.
> 
> Thanks, this looks good. I tried to catch compile-time variants like
> this, but I was mostly limited to what we build in CI.
> 
> Out of curiosity, what platform do you use that needs NO_ICONV (or is it
> just a preference)?

I'm just using parts of libgit.a and don't need the iconv support so I disable it. That avoids a dependency on the iconv dll on Windows.

Mike
Junio C Hamano· Oct 2, 2024, 22:39 UTC · re: Mike Hommey · lore

Re: [PATCH] Fix unused-parameter warnings with NO_ICONV

Mike Hommey <mh@glandium.org> writes:
Show 7 quoted lines
> The jk/unused-parameters topic enabled -Wunused-parameter. Some code in
> some non-typical configuration lacked annotations.
>
> Signed-off-by: Mike Hommey <mh@glandium.org>
> ---
>  utf8.h | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
Thanks.
Show 15 quoted lines
> diff --git a/utf8.h b/utf8.h
> index fcd5167baf..cce299d274 100644
> --- a/utf8.h
> +++ b/utf8.h
> @@ -33,8 +33,9 @@ char *reencode_string_len(const char *in, size_t insz,
>  			  const char *in_encoding,
>  			  size_t *outsz);
>  #else
> -static inline char *reencode_string_len(const char *a, size_t b,
> -					const char *c, const char *d, size_t *e)
> +static inline char *reencode_string_len(const char *a UNUSED, size_t b UNUSED,
> +					const char *c UNUSED,
> +					const char *d UNUSED, size_t *e)
>  { if (e) *e = 0; return NULL; }
>  #endif

← back to recent threads