This patchset only contains harmless warning fixes. That's a first effort for code cleanup.
Yann Sionneau (6): Fix unused variable warning in dl-startup.c Fix warning about missing const qualifier Fix warning about macro redefinition Fix warning due to unused variable in strlen Fix warning due to relaxed function declaration prototype Fix warning due to unused label in NPTL
ldso/ldso/dl-startup.c | 6 ++++-- libc/misc/fnmatch/fnmatch_loop.c | 4 ++-- libc/misc/internals/tempname.c | 12 ++++++------ libc/string/generic/strlen.c | 21 ++------------------- libintl/libintl.c | 2 +- libpthread/nptl/allocatestack.c | 2 ++ 6 files changed, 17 insertions(+), 30 deletions(-)
SEND_STDERR_DEBUG does nothing if __SUPPORT_LD_DEBUG_EARLY__ is not defined thus causing a warning.
Fixes this:
In file included from ldso/ldso/ldso.c:86:0: ldso/ldso/dl-startup.c: In function '_dl_start': ldso/ldso/dl-startup.c:313:13: warning: variable 'strtab' set but not used [-Wunused-but-set-variable] char *strtab; ^~~~~~
Signed-off-by: Yann Sionneau ysionneau@kalray.eu --- ldso/ldso/dl-startup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c index 1b559a855..24b046c62 100644 --- a/ldso/ldso/dl-startup.c +++ b/ldso/ldso/dl-startup.c @@ -310,11 +310,13 @@ DL_START(unsigned long args) symbol_addr = 0; sym = NULL; if (symtab_index) { - char *strtab; ElfW(Sym) *symtab; +#if !defined(EARLY_STDERR_SPECIAL) && defined(__SUPPORT_LD_DEBUG_EARLY__) + char *strtab; + strtab = (char *) tpnt->dynamic_info[DT_STRTAB]; +#endif
symtab = (ElfW(Sym) *) tpnt->dynamic_info[DT_SYMTAB]; - strtab = (char *) tpnt->dynamic_info[DT_STRTAB]; sym = &symtab[symtab_index]; symbol_addr = (unsigned long) DL_RELOC_ADDR(load_addr, sym->st_value); #if !defined(EARLY_STDERR_SPECIAL)
Fixes this:
In file included from libc/misc/fnmatch/fnmatch.c:235:0: libc/misc/fnmatch/fnmatch_loop.c: In function 'internal_fnmatch': libc/misc/fnmatch/fnmatch_loop.c:207:21: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] CHAR *p_init = p; ^ libc/misc/fnmatch/fnmatch_loop.c:208:21: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] CHAR *n_init = n;
Signed-off-by: Yann Sionneau ysionneau@kalray.eu --- libc/misc/fnmatch/fnmatch_loop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libc/misc/fnmatch/fnmatch_loop.c b/libc/misc/fnmatch/fnmatch_loop.c index a09cfbb11..fdd451d43 100644 --- a/libc/misc/fnmatch/fnmatch_loop.c +++ b/libc/misc/fnmatch/fnmatch_loop.c @@ -204,8 +204,8 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, case L('['): { /* Nonzero if the sense of the character class is inverted. */ - CHAR *p_init = p; - CHAR *n_init = n; + const CHAR *p_init = p; + const CHAR *n_init = n; register int not; CHAR cold; UCHAR fn;
Fixes this:
libc/misc/internals/tempname.c: In function 'brain_damaged_fillrand': libc/misc/internals/tempname.c:155:0: warning: "L" redefined #define L ((UINT32_MAX % NUM_LETTERS + 1) % NUM_LETTERS)
In file included from ./libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.h:24:0, from ./include/bits/libc-lock.h:35, from ./include/bits/stdio-lock.h:22, from ./include/bits/uClibc_mutex.h:73, from ./include/bits/uClibc_stdio.h:83, from ./include/stdio.h:71, from libc/misc/internals/tempname.c:35: ./libc/sysdeps/linux/kvx/sysdep.h:40:0: note: this is the location of the previous definition # define L(name) $L##name
Signed-off-by: Yann Sionneau ysionneau@kalray.eu --- libc/misc/internals/tempname.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c index ca87b0c06..d3a8ccbd8 100644 --- a/libc/misc/internals/tempname.c +++ b/libc/misc/internals/tempname.c @@ -152,12 +152,12 @@ static void brain_damaged_fillrand(unsigned char *buf, unsigned int len) for (i = 0; i < len; ++i) { rh = high % NUM_LETTERS; high /= NUM_LETTERS; -#define L ((UINT32_MAX % NUM_LETTERS + 1) % NUM_LETTERS) - k = (low % NUM_LETTERS) + (L * rh); -#undef L -#define H ((UINT32_MAX / NUM_LETTERS) + ((UINT32_MAX % NUM_LETTERS + 1) / NUM_LETTERS)) - low = (low / NUM_LETTERS) + (H * rh) + (k / NUM_LETTERS); -#undef H +#define _L ((UINT32_MAX % NUM_LETTERS + 1) % NUM_LETTERS) + k = (low % NUM_LETTERS) + (_L * rh); +#undef _L +#define _H ((UINT32_MAX / NUM_LETTERS) + ((UINT32_MAX % NUM_LETTERS + 1) / NUM_LETTERS)) + low = (low / NUM_LETTERS) + (_H * rh) + (k / NUM_LETTERS); +#undef _H k %= NUM_LETTERS; buf[i] = letters[k]; }
Fixes this:
libc/string/generic/strlen.c: In function 'strlen': libc/string/generic/strlen.c:31:31: warning: variable 'magic_bits' set but not used [-Wunused-but-set-variable] unsigned long int longword, magic_bits, himagic, lomagic; ^~~~~~~~~~
Signed-off-by: Yann Sionneau ysionneau@kalray.eu --- libc/string/generic/strlen.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)
diff --git a/libc/string/generic/strlen.c b/libc/string/generic/strlen.c index dc383398b..dcc032ddc 100644 --- a/libc/string/generic/strlen.c +++ b/libc/string/generic/strlen.c @@ -28,7 +28,7 @@ size_t strlen (const char *str) { const char *char_ptr; const unsigned long int *longword_ptr; - unsigned long int longword, magic_bits, himagic, lomagic; + unsigned long int longword, himagic, lomagic;
/* Handle the first few characters by reading one character at a time. Do this until CHAR_PTR is aligned on a longword boundary. */ @@ -52,14 +52,12 @@ size_t strlen (const char *str)
The 1-bits make sure that carries propagate to the next 0-bit. The 0-bits provide holes for carries to fall into. */ - magic_bits = 0x7efefeffL; himagic = 0x80808080L; lomagic = 0x01010101L; if (sizeof (longword) > 4) { /* 64-bit version of the magic. */ /* Do the shift in two steps to avoid a warning if long has 32 bits. */ - magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; himagic = ((himagic << 16) << 16) | himagic; lomagic = ((lomagic << 16) << 16) | lomagic; } @@ -102,22 +100,7 @@ size_t strlen (const char *str)
longword = *longword_ptr++;
- if ( -#if 0 - /* Add MAGIC_BITS to LONGWORD. */ - (((longword + magic_bits) - - /* Set those bits that were unchanged by the addition. */ - ^ ~longword) - - /* Look at only the hole bits. If any of the hole bits - are unchanged, most likely one of the bytes was a - zero. */ - & ~magic_bits) -#else - ((longword - lomagic) & himagic) -#endif - != 0) + if (((longword - lomagic) & himagic) != 0) { /* Which of the bytes was the zero? If none of them were, it was a misfire; continue the search. */
Fixes this:
libintl/libintl.c:81:13: warning: function declaration isn't a prototype [-Wstrict-prototypes] const char *_nl_expand_alias () { return NULL; } ^~~~~~~~~~~~~~~~
Signed-off-by: Yann Sionneau ysionneau@kalray.eu --- libintl/libintl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libintl/libintl.c b/libintl/libintl.c index 0851fac1c..b100ef542 100644 --- a/libintl/libintl.c +++ b/libintl/libintl.c @@ -78,5 +78,5 @@ char *bind_textdomain_codeset(const char *domainname, const char *codeset) }
/* trick configure tests checking for gnu libintl, as in the copy included in gdb */ -const char *_nl_expand_alias () { return NULL; } +const char *_nl_expand_alias (void) { return NULL; } int _nl_msg_cat_cntr = 0;
Fixes this:
In file included from libpthread/nptl/pthread_create.c:48:0: libpthread/nptl/allocatestack.c: In function 'allocate_stack': libpthread/nptl/allocatestack.c:602:6: warning: label 'mprot_error' defined but not used [-Wunused-label] mprot_error: ^~~~~~~~~~~
Signed-off-by: Yann Sionneau ysionneau@kalray.eu --- libpthread/nptl/allocatestack.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/libpthread/nptl/allocatestack.c b/libpthread/nptl/allocatestack.c index 137979542..7ef884543 100644 --- a/libpthread/nptl/allocatestack.c +++ b/libpthread/nptl/allocatestack.c @@ -599,7 +599,9 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, if (mprotect (guard, guardsize, PROT_NONE) != 0) { int err; +#ifdef NEED_SEPARATE_REGISTER_STACK mprot_error: +#endif err = errno;
lll_lock (stack_cache_lock, LLL_PRIVATE);
Hi Yannn,
thanks, applied and pushed,
best regards Waldemar
Yann Sionneau wrote,
This patchset only contains harmless warning fixes. That's a first effort for code cleanup.
Yann Sionneau (6): Fix unused variable warning in dl-startup.c Fix warning about missing const qualifier Fix warning about macro redefinition Fix warning due to unused variable in strlen Fix warning due to relaxed function declaration prototype Fix warning due to unused label in NPTL
ldso/ldso/dl-startup.c | 6 ++++-- libc/misc/fnmatch/fnmatch_loop.c | 4 ++-- libc/misc/internals/tempname.c | 12 ++++++------ libc/string/generic/strlen.c | 21 ++------------------- libintl/libintl.c | 2 +- libpthread/nptl/allocatestack.c | 2 ++ 6 files changed, 17 insertions(+), 30 deletions(-)
-- 2.17.1
devel mailing list devel@uclibc-ng.org https://mailman.uclibc-ng.org/cgi-bin/mailman/listinfo/devel