From 3e0a0dd7ed915b4150ce122e0d67c13ad05ba744 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 9 Nov 2018 10:18:04 +0100 Subject: [PATCH] Fix all current build warnings in the userland. --- Userland/date.cpp | 4 +++- Userland/ft.cpp | 2 ++ Userland/ft2.cpp | 2 ++ Userland/hostname.cpp | 12 +++++++----- Userland/id.cpp | 4 +++- Userland/ls.cpp | 4 +++- Userland/mm.cpp | 4 +++- Userland/ps.cpp | 4 +++- Userland/sh.cpp | 21 ++++++++++----------- Userland/tst.cpp | 2 ++ Userland/tty.cpp | 4 ++-- Userland/uname.cpp | 4 ++-- 12 files changed, 42 insertions(+), 25 deletions(-) diff --git a/Userland/date.cpp b/Userland/date.cpp index 00738773c5..2610f60ca6 100644 --- a/Userland/date.cpp +++ b/Userland/date.cpp @@ -1,8 +1,10 @@ #include #include -int main(int c, char** v) +int main(int argc, char** argv) { + (void) argc; + (void) argv; time_t now = time(nullptr); printf("%u\n", now); return 0; diff --git a/Userland/ft.cpp b/Userland/ft.cpp index 3c66b2b41e..7bfdf5c41f 100644 --- a/Userland/ft.cpp +++ b/Userland/ft.cpp @@ -3,6 +3,8 @@ int main(int argc, char** argv) { + (void) argc; + (void) argv; printf("Testing fork()...\n"); pid_t pid = fork(); if (!pid) { diff --git a/Userland/ft2.cpp b/Userland/ft2.cpp index 3f30ee2c95..dba8f8f73a 100644 --- a/Userland/ft2.cpp +++ b/Userland/ft2.cpp @@ -3,6 +3,8 @@ int main(int argc, char** argv) { + (void) argc; + (void) argv; printf("Testing fork()...\n"); pid_t pid = fork(); if (!pid) { diff --git a/Userland/hostname.cpp b/Userland/hostname.cpp index f33ca87c72..4589da8a5c 100644 --- a/Userland/hostname.cpp +++ b/Userland/hostname.cpp @@ -1,10 +1,12 @@ -#include -#include -#include -#include +#include +#include +#include +#include -int main(int c, char** v) +int main(int argc, char** argv) { + (void) argc; + (void) argv; char buffer[HOST_NAME_MAX]; int rc = gethostname(buffer, sizeof(buffer)); if (rc < 0) { diff --git a/Userland/id.cpp b/Userland/id.cpp index 9c7334a2a1..5b906669dc 100644 --- a/Userland/id.cpp +++ b/Userland/id.cpp @@ -4,8 +4,10 @@ #include #include -int main(int c, char** v) +int main(int argc, char** argv) { + (void) argc; + (void) argv; uid_t uid = getuid(); gid_t gid = getgid(); diff --git a/Userland/ls.cpp b/Userland/ls.cpp index 0f9086c9cb..fa1f3e71db 100644 --- a/Userland/ls.cpp +++ b/Userland/ls.cpp @@ -4,8 +4,10 @@ #include #include -int main(int c, char** v) +int main(int argc, char** argv) { + (void) argc; + (void) argv; bool colorize = true; DIR* dirp = opendir("."); diff --git a/Userland/mm.cpp b/Userland/mm.cpp index 8cd674f255..2be82fce9c 100644 --- a/Userland/mm.cpp +++ b/Userland/mm.cpp @@ -1,8 +1,10 @@ #include #include -int main(int c, char** v) +int main(int argc, char** argv) { + (void) argc; + (void) argv; int fd = open("/proc/mm", O_RDONLY); if (fd == -1) { perror("failed to open /proc/mm"); diff --git a/Userland/ps.cpp b/Userland/ps.cpp index 89f16a06a8..f36f1a224b 100644 --- a/Userland/ps.cpp +++ b/Userland/ps.cpp @@ -1,8 +1,10 @@ #include #include -int main(int c, char** v) +int main(int argc, char** argv) { + (void) argc; + (void) argv; int fd = open("/proc/summary", O_RDONLY); if (fd == -1) { perror("failed to open /proc/summary"); diff --git a/Userland/sh.cpp b/Userland/sh.cpp index 1fa46877ae..ca45d31302 100644 --- a/Userland/sh.cpp +++ b/Userland/sh.cpp @@ -1,11 +1,11 @@ -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -43,7 +43,7 @@ void did_receive_signal(int signum) g_got_signal = true; } -void handle_sigint(int signum) +void handle_sigint(int) { printf("Interrupt received by sh\n"); } @@ -105,7 +105,7 @@ static int sh_wt(int, const char**) { const char* rodata_ptr = "foo"; printf("Writing to rodata=%p...\n", rodata_ptr); - *(char*)rodata_ptr = 0; + *const_cast(rodata_ptr) = 0; char* text_ptr = (char*)sh_fef; printf("Writing to text=%p...\n", text_ptr); @@ -141,7 +141,6 @@ close_it: static int sh_mp(int, const char**) { - int rc; int fd = open("/kernel.map", O_RDONLY); if (fd < 0) { perror("open(/kernel.map)"); diff --git a/Userland/tst.cpp b/Userland/tst.cpp index 0799e161bb..9659a20aab 100644 --- a/Userland/tst.cpp +++ b/Userland/tst.cpp @@ -2,6 +2,8 @@ int main(int argc, char** argv) { + (void) argc; + (void) argv; printf("Counting to 100000: \033[s"); for (unsigned i = 0; i <= 100000; ++i) { printf("\033[u\033[s%u", i); diff --git a/Userland/tty.cpp b/Userland/tty.cpp index a675893917..2d8f380084 100644 --- a/Userland/tty.cpp +++ b/Userland/tty.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include int main(int, char**) { diff --git a/Userland/uname.cpp b/Userland/uname.cpp index f74cd7d3a5..65c584b82c 100644 --- a/Userland/uname.cpp +++ b/Userland/uname.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include int main(int argc, char** argv) {