diff --git a/libc/chmod.cpp b/libc/chmod.cpp index 01c4e146..c27eadc2 100644 --- a/libc/chmod.cpp +++ b/libc/chmod.cpp @@ -29,6 +29,8 @@ // TODO: Implement this in the kernel. extern "C" int chmod(const char* path, mode_t mode) { + (void) path; + (void) mode; errno = ENOSYS; return -1; } diff --git a/libc/dlfcn.cpp b/libc/dlfcn.cpp index 8d476770..7a94884d 100644 --- a/libc/dlfcn.cpp +++ b/libc/dlfcn.cpp @@ -29,6 +29,7 @@ static const char* dlerrormsg = NULL; extern "C" void* dlopen(const char* filename, int mode) { + (void) mode; dlerrormsg = "Sortix does not yet support dynamic linking"; fprintf(stderr, "%s: loading file: %s\n", dlerrormsg, filename); return NULL; @@ -36,6 +37,7 @@ extern "C" void* dlopen(const char* filename, int mode) extern "C" void* dlsym(void* handle, const char* name) { + (void) handle; dlerrormsg = "Sortix does not yet support dynamic linking"; fprintf(stderr, "%s: resolving symbol: %s\n", dlerrormsg, name); return NULL; @@ -43,12 +45,13 @@ extern "C" void* dlsym(void* handle, const char* name) extern "C" int dlclose(void* handle) { + (void) handle; return 0; } -extern "C" char* dlerror(void* handle) +extern "C" char* dlerror() { const char* result = dlerrormsg; dlerrormsg = NULL; - return (char*) dlerrormsg; + return (char*) result; } diff --git a/libc/fchmod.cpp b/libc/fchmod.cpp index 0ab58ca7..3306b44c 100644 --- a/libc/fchmod.cpp +++ b/libc/fchmod.cpp @@ -29,6 +29,8 @@ // TODO: Implement this in the kernel. extern "C" int fchmod(int fd, mode_t mode) { + (void) fd; + (void) mode; errno = ENOSYS; return -1; } diff --git a/libc/fputs.cpp b/libc/fputs.cpp index 6bd755a6..82e7e249 100644 --- a/libc/fputs.cpp +++ b/libc/fputs.cpp @@ -1,6 +1,6 @@ /******************************************************************************* - Copyright(C) Jonas 'Sortie' Termansen 2011, 2012. + Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013. This file is part of the Sortix C Library. @@ -28,7 +28,8 @@ extern "C" int fputs(const char* str, FILE* fp) { size_t stringlen = strlen(str); - int result = fwrite(str, 1, stringlen, fp); - if ( result < stringlen ) { return EOF; } + size_t result = fwrite(str, 1, stringlen, fp); + if ( result < stringlen ) + return EOF; return result; } diff --git a/libc/heap.cpp b/libc/heap.cpp index c47e3a27..37191807 100644 --- a/libc/heap.cpp +++ b/libc/heap.cpp @@ -375,6 +375,7 @@ static void InsertChunk(Chunk* chunk) assert(chunk->IsSane()); } +__attribute__((unused)) static bool ValidateHeap() { bool foundbin[NUMBINS]; @@ -524,7 +525,6 @@ extern "C" void* malloc(size_t size) chunk->size -= left; chunk->GetTrailer()->size = chunk->size; - size_t leftbinindex = BSR(left); Chunk* leftchunk = chunk->RightNeighbor(); leftchunk->size = left; Trailer* lefttrailer = leftchunk->GetTrailer(); diff --git a/libc/include/dlfcn.h b/libc/include/dlfcn.h index c5bf2fe2..38e84ff3 100644 --- a/libc/include/dlfcn.h +++ b/libc/include/dlfcn.h @@ -35,7 +35,7 @@ __BEGIN_DECLS #define RTLD_LOCAL 0 /* Bit 8 is not set. */ int dlclose(void* handle); -char* dlerror(void* handle); +char* dlerror(); void* dlopen(const char* filename, int mode); void* dlsym(void* handle, const char* name); diff --git a/libc/readparamstring.cpp b/libc/readparamstring.cpp index 43f4fec6..9706c63f 100644 --- a/libc/readparamstring.cpp +++ b/libc/readparamstring.cpp @@ -29,7 +29,6 @@ static char* Substring(const char* src, size_t offset, size_t length) { - size_t srclen = strlen(src); char* dest = new char[length + 1]; if ( !dest ) { return NULL; } memcpy(dest, src + offset, length * sizeof(char)); diff --git a/libc/setjmp.c b/libc/setjmp.c index ef27aba1..d4bd4179 100644 --- a/libc/setjmp.c +++ b/libc/setjmp.c @@ -28,12 +28,15 @@ void longjmp(jmp_buf env, int val) { + (void) env; + (void) val; fprintf(stderr, "setjmp(3) and longjmp(3) are unimplemented, abort!\n"); abort(); } int setjmp(jmp_buf env) { + (void) env; return 0; } diff --git a/libc/umask.cpp b/libc/umask.cpp index 3a35d87a..e2d73d07 100644 --- a/libc/umask.cpp +++ b/libc/umask.cpp @@ -30,5 +30,6 @@ // TODO: Implement this in the kernel. extern "C" mode_t umask(mode_t mask) { + (void) mask; return 0; } diff --git a/libc/utime.cpp b/libc/utime.cpp index d852d62d..effd6f92 100644 --- a/libc/utime.cpp +++ b/libc/utime.cpp @@ -28,6 +28,8 @@ extern "C" int utime(const char* filepath, const struct utimbuf* times) { + (void) filepath; + (void) times; // TODO: Sure, I did that! There is no kernel support for this yet. return 0; } diff --git a/libc/vfscanf.cpp b/libc/vfscanf.cpp index 24253014..cac64b8e 100644 --- a/libc/vfscanf.cpp +++ b/libc/vfscanf.cpp @@ -75,25 +75,25 @@ extern "C" int vfscanf(FILE* fp, const char* origformat, va_list ap) union { const char* format; const unsigned char* formatuc; }; format = origformat; int matcheditems = 0; - size_t fieldwidth; + size_t fieldwidth = 0; bool escaped = false; - bool discard; - bool negint; - bool intunsigned; - bool leadingzero; - bool hasprefix; - bool string; - size_t intparsed; - uintmax_t intvalue; + bool discard = false; + bool negint = false; + bool intunsigned = false; + bool leadingzero = false; + bool hasprefix = false; + bool string = false; + size_t intparsed = 0; + uintmax_t intvalue = 0; int ic; - int base; + int base = 0; int cval; const size_t UNDO_MAX = 4; int undodata[UNDO_MAX]; size_t undoable = 0; - size_t strwritten; - char* strdest; - enum scantype scantype; + size_t strwritten = 0; + char* strdest = NULL; + enum scantype scantype = TYPE_INT; enum scanmode scanmode = MODE_INIT; while ( true ) {