Fix warnings

This change fixes Cosmopolitan so it has fewer opinions about compiler
warnings. The whole repository had to be cleaned up to be buildable in
-Werror -Wall mode. This lets us benefit from things like strict const
checking. Some actual bugs might have been caught too.
This commit is contained in:
Justine Tunney 2023-09-01 20:49:13 -07:00
parent e2b3c3618e
commit 0d748ad58e
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
571 changed files with 1306 additions and 1888 deletions

View file

@ -70,7 +70,7 @@ static dontasan void __munmap_impl(char *p, size_t n) {
char *q;
size_t m;
intptr_t a, b, c;
int i, l, r, rc, beg, end;
int i, l, r, beg, end;
KERNTRACE("__munmap_impl(%p, %'zu)", p, n);
l = FRAME(p);
r = FRAME(p + n - 1);
@ -113,9 +113,6 @@ static dontasan void __munmap_impl(char *p, size_t n) {
}
dontasan int __munmap_unlocked(char *p, size_t n) {
unsigned i;
char poison;
intptr_t a, b, x, y;
unassert(!__vforked);
if (UNLIKELY(!n)) {
STRACE("munmap n is 0");
@ -154,11 +151,10 @@ dontasan int __munmap_unlocked(char *p, size_t n) {
*/
int munmap(void *p, size_t n) {
int rc;
size_t toto;
__mmi_lock();
rc = __munmap_unlocked(p, n);
#if SYSDEBUG
toto = __strace > 0 ? __get_memtrack_size(&_mmi) : 0;
size_t toto = __strace > 0 ? __get_memtrack_size(&_mmi) : 0;
#endif
__mmi_unlock();
STRACE("munmap(%.12p, %'zu) → %d% m (%'zu bytes total)", p, n, rc, toto);