summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
Diffstat (limited to 'libc')
-rw-r--r--libc/misc/internals/reloc_static_pie.c2
-rw-r--r--libc/stdio/_scanf.c2
-rw-r--r--libc/stdlib/stdlib.c2
-rw-r--r--libc/string/generic/strnlen.c6
-rw-r--r--libc/sysdeps/linux/common/clock_adjtime.c2
5 files changed, 10 insertions, 4 deletions
diff --git a/libc/misc/internals/reloc_static_pie.c b/libc/misc/internals/reloc_static_pie.c
index cb2c4df87..3bbdef18e 100644
--- a/libc/misc/internals/reloc_static_pie.c
+++ b/libc/misc/internals/reloc_static_pie.c
@@ -107,6 +107,8 @@ reloc_static_pie(ElfW(Addr) load_addr)
PERFORM_BOOTSTRAP_RELOC(rpnt, reloc_addr, symbol_addr, load_addr, sym);
}
}
+#else
+ (void)rel_size;
#endif
}
_dl_load_base = load_addr;
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__
diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c
index f5936630c..c45dd53a5 100644
--- a/libc/stdlib/stdlib.c
+++ b/libc/stdlib/stdlib.c
@@ -822,6 +822,7 @@ libc_hidden_def(_stdlib_mb_cur_max)
#endif
+#if defined(L_mblen) || defined(L_mbtowc) || defined(L_wctomb)
#ifdef __UCLIBC_HAS_LOCALE__
/*
* The following function return 1 if the encoding is stateful, 0 if stateless.
@@ -844,6 +845,7 @@ static __always_inline int is_stateful(unsigned char encoding)
#else
#define is_stateful(encoding) 0
#endif
+#endif
/**********************************************************************/
#ifdef L_mblen
diff --git a/libc/string/generic/strnlen.c b/libc/string/generic/strnlen.c
index 4d4cde84f..82d4122ec 100644
--- a/libc/string/generic/strnlen.c
+++ b/libc/string/generic/strnlen.c
@@ -29,15 +29,17 @@
'\0' terminator is found in that many characters, return MAXLEN. */
size_t strnlen (const char *str, size_t maxlen)
{
- const char *char_ptr, *end_ptr = str + maxlen;
+ const char *char_ptr, *end_ptr;
const unsigned long int *longword_ptr;
unsigned long int longword, himagic, lomagic;
if (maxlen == 0)
return 0;
- if (__builtin_expect (end_ptr < str, 0))
+ if (__builtin_expect ((uintptr_t)str + maxlen < (uintptr_t)str, 0))
end_ptr = (const char *) ~0UL;
+ else
+ end_ptr = str + maxlen;
/* Handle the first few characters by reading one character at a time.
Do this until CHAR_PTR is aligned on a longword boundary. */
diff --git a/libc/sysdeps/linux/common/clock_adjtime.c b/libc/sysdeps/linux/common/clock_adjtime.c
index 53f64e9d5..ada256ccd 100644
--- a/libc/sysdeps/linux/common/clock_adjtime.c
+++ b/libc/sysdeps/linux/common/clock_adjtime.c
@@ -15,5 +15,5 @@ _syscall2_64(int, clock_adjtime, clockid_t, clock_id, struct timex*, ntx)
#elif defined(__NR_clock_adjtime)
_syscall2(int, clock_adjtime, clockid_t, clock_id, struct timex*, ntx)
#else
-#error "clock_adjtime syscall is not defined!"
+#warning "clock_adjtime syscall is not defined!"
#endif