libdecnumber/dpd/decimal64: Fix compiler warning from Clang 15
PATCH 1/1 libdecnumber/dpd/decimal64: Fix compiler warning from Clang 15
Clang 15 from Fedora 37 complains:
../libdecnumber/dpd/decimal64.c:620:8: error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable]
Int n; /* output bunch counter */
^
1 error generated.
Remove the unused variable to silence the compiler warning.
--- libdecnumber/dpd/decimal64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
libdecnumber/dpd/decimal64.c +1 -2
@@ -617,7 +617,6 @@ static const uInt multies[]={131073, 26215, 5243, 1049, 210};#endif void decDigitsToDPD (const decNumber *dn,uInt *targ,Int shift) {Int cut;/* work */ -Int n;/* output bunch counter */ Int digits=dn->digits;/* digit countdown */ uInt dpd;/* densely packed decimal value */ uInt bin;/* binary value 0-999 */
@@ -676,7 +675,7 @@ void decDigitsToDPD(const decNumber *dn, uInt *targ, Int shift) { bin=0 ;/* [keep compiler quiet] */ #endif -for (n=0 ; digits>0 ; n++) {/* each output bunch */ +while (digits >0 ) {/* each output bunch */ #if DECDPUN ==3 /* fast path, 3-at-a-time */ bin=*inu;/* 3 digits ready for convert */ digits-=3 ;/* [may go negative] */
Signature · 1 line
2.31.1
Quoted 11 lines · Thomas Huth
Clang 15 from Fedora 37 complains:
../libdecnumber/dpd/decimal64.c:620:8: error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable]
Int n; /* output bunch counter */
^
1 error generated.Remove the unused variable to silence the compiler warning.
Signed-off-by Thomas Huth <[email protected]>
Thanks,
C.
Quoted 25 lines
--- libdecnumber/dpd/decimal64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)libdecnumber/dpd/decimal64.c +1
-2@@ -617,7 +617,6 @@ static const uInt multies[]={131073, 26215, 5243, 1049, 210};#endif void decDigitsToDPD (const decNumber *dn,uInt *targ,Int shift) {Int cut;/* work */ -Int n;/* output bunch counter */ Int digits=dn->digits;/* digit countdown */ uInt dpd;/* densely packed decimal value */ uInt bin;/* binary value 0-999 */ @@ -676,7 +675,7 @@ void decDigitsToDPD(const decNumber *dn, uInt *targ, Int shift) { bin=0 ;/* [keep compiler quiet] */ #endif -for (n=0 ; digits>0 ; n++) {/* each output bunch */ +while (digits >0 ) {/* each output bunch */ #if DECDPUN ==3 /* fast path, 3-at-a-time */ bin=*inu;/* 3 digits ready for convert */ digits-=3 ;/* [may go negative] */
Quoted 28 lines · Thomas Huth
Clang 15 from Fedora 37 complains:
../libdecnumber/dpd/decimal64.c:620:8: error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable]
Int n; /* output bunch counter */
^
1 error generated.Remove the unused variable to silence the compiler warning.
Signed-off-by Thomas Huth <[email protected]>--- libdecnumber/dpd/decimal64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)libdecnumber/dpd/decimal64.c +0
-1@@ -617,7 +617,6 @@ static const uInt multies[]={131073, 26215, 5243, 1049, 210};#endif void decDigitsToDPD (const decNumber *dn,uInt *targ,Int shift) {Int cut;/* work */ -Int n;/* output bunch counter */ Int digits=dn->digits;/* digit countdown */ uInt dpd;/* densely packed decimal value */ uInt bin;/* binary value 0-999 */
libdecnumber/dpd/decimal64.c void decDigitsToDPD(const decNumber *dn, uInt *targ, Int shift) { · line 681
Quoted 8 lines
libdecnumber/dpd/decimal64.c +1
-1@@ -676,7 +675,7 @@ void decDigitsToDPD(const decNumber *dn, uInt *targ, Int shift) { bin=0 ;/* [keep compiler quiet] */ #endif -for (n=0 ; digits>0 ; n++) {/* each output bunch */ +while (digits >0 ) {/* each output bunch */ #if DECDPUN ==3 /* fast path, 3-at-a-time */ bin=*inu;/* 3 digits ready for convert */ digits-=3 ;/* [may go negative] */
Or we could we backport the upstream fix :)
Quoted 41 lines · Philippe Mathieu-Daudé
Quoted 30 lines · Thomas Huth
Clang 15 from Fedora 37 complains:
../libdecnumber/dpd/decimal64.c:620:8: error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable]
Int n; /* output bunch counter */ ^
1 error generated.Remove the unused variable to silence the compiler warning.
Signed-off-by Thomas Huth <[email protected]>---
libdecnumber/dpd/decimal64.c| 3 +--1 file changed, 1 insertion(+), 2 deletions(-)libdecnumber/dpd/decimal64.c +0
-0@@ -617,7 +617,6 @@ static const uInt multies[]={131073, 26215, 5243, 1049, 210}; #endif void decDigitsToDPD(const decNumber *dn, uInt *targ, Int shift) {Int cut; /* work */
- Int n; /* output bunch counter */ Int digits=dn->digits; /* digit countdown */ uInt dpd; /* densely packed decimal value */ uInt bin; /* binary value 0-999 */libdecnumber/dpd/decimal64.c +0
-0@@ -676,7 +675,7 @@ void decDigitsToDPD(const decNumber *dn, uInt *targ, Int shift) {Quoted 7 lines
bin=0; /* [keep compiler quiet] */ #endif
- for(n=0; digits>0; n++) { /* each output bunch */ + while (digits > 0) { /* each output bunch */ #if DECDPUN==3 /* fast path, 3-at-a-time */ bin=*inu; /* 3 digits ready for convert */ digits-=3; /* [may go negative] */Or we could we backport the upstream fix :)
I did not look on that code on purpose - it's licensed under the GPLv3, so we should not mix that back into our GPLv2 version.
Thomas
Philippe Mathieu-Daudé
Reviewed-byQuoted 18 lines · Thomas Huth
Quoted 17 lines · Philippe Mathieu-Daudé
Quoted 14 lines · Thomas Huth
Clang 15 from Fedora 37 complains:
../libdecnumber/dpd/decimal64.c:620:8: error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable]
Int n; /* output bunch counter */ ^
1 error generated.Remove the unused variable to silence the compiler warning.
Signed-off-by Thomas Huth <[email protected]>---
libdecnumber/dpd/decimal64.c| 3 +--1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 5 lines
Quoted 3 lines
Or we could we backport the upstream fix :)
I did not look on that code on purpose - it's licensed under the GPLv3, so we should not mix that back into our GPLv2 version.
Sigh, right. So: