diff mbox series

[uclibc-ng-devel] uclibc: prevent warning about setting an unused variable

Message ID 20250106072220.32574-1-marcus.haehnel@kernkonzept.com
State Accepted
Headers show
Series [uclibc-ng-devel] uclibc: prevent warning about setting an unused variable | expand

Commit Message

Marcus Hähnel Jan. 6, 2025, 7:21 a.m. UTC
From: Frank Mehnert <frank.mehnert@kernkonzept.com>

This variable is used either if __UCLIBC_HAS_FLOATS__ is defined or if
__UCLIBC_HAS_GLIBC_DIGIT_GROUPING__ is defined. Instead of adding more
complicated #ifdef magic, just mark this variable as possibly unused to
satisfy the compiler.

Signed-off-by: marcus.haehnel@kernkonzept.com
---
 libc/stdio/_scanf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Waldemar Brodkorb Jan. 16, 2025, 4 p.m. UTC | #1
Hi,

this patch and the other pending patches got applied and
are part of 1.0.51 release.

Thanks
 Waldemar

Marcus Haehnel wrote,

> From: Frank Mehnert <frank.mehnert@kernkonzept.com>
> 
> This variable is used either if __UCLIBC_HAS_FLOATS__ is defined or if
> __UCLIBC_HAS_GLIBC_DIGIT_GROUPING__ is defined. Instead of adding more
> complicated #ifdef magic, just mark this variable as possibly unused to
> satisfy the compiler.
> 
> Signed-off-by: marcus.haehnel@kernkonzept.com
> ---
>  libc/stdio/_scanf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libc/stdio/_scanf.c b/libc/stdio/_scanf.c
> index 3f3000d6f..cb72d14ac 100644
> --- a/libc/stdio/_scanf.c
> +++ b/libc/stdio/_scanf.c
> @@ -1715,7 +1715,7 @@ int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc)
>  #define MAX_DIGITS 65			/* Allow one leading 0. */
>  	unsigned char buf[MAX_DIGITS+2+ 100];
>  	unsigned char usflag, base;
> -	unsigned char nonzero = 0;
> +	unsigned char nonzero __attribute__((unused)) = 0;
>  	unsigned char seendigit = 0;
>  
>  #ifndef __UCLIBC_HAS_FLOATS__
> -- 
> 2.47.1
> 
> _______________________________________________
> devel mailing list -- devel@uclibc-ng.org
> To unsubscribe send an email to devel-leave@uclibc-ng.org
>
diff mbox series

Patch

diff --git a/libc/stdio/_scanf.c b/libc/stdio/_scanf.c
index 3f3000d6f..cb72d14ac 100644
--- a/libc/stdio/_scanf.c
+++ b/libc/stdio/_scanf.c
@@ -1715,7 +1715,7 @@  int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc)
 #define MAX_DIGITS 65			/* Allow one leading 0. */
 	unsigned char buf[MAX_DIGITS+2+ 100];
 	unsigned char usflag, base;
-	unsigned char nonzero = 0;
+	unsigned char nonzero __attribute__((unused)) = 0;
 	unsigned char seendigit = 0;
 
 #ifndef __UCLIBC_HAS_FLOATS__