diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-08-28 16:27:01 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-08-28 17:01:18 +0200 |
commit | c34317dc2cbb1d636fd00bd201033acb1ae22016 (patch) | |
tree | 54a1a823562fa7453d8378bde19b45dd657e96e8 /src | |
parent | server: more logging (diff) | |
download | cimple-c34317dc2cbb1d636fd00bd201033acb1ae22016.tar.gz cimple-c34317dc2cbb1d636fd00bd201033acb1ae22016.zip |
make compilers happier
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/compiler.h | 10 | ||||
-rw-r--r-- | src/file.c | 4 | ||||
-rw-r--r-- | src/server.c | 8 | ||||
-rw-r--r-- | src/signal.h | 4 | ||||
-rw-r--r-- | src/worker.c | 2 |
6 files changed, 23 insertions, 7 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e565d78..0d3c7e9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,7 +5,7 @@ project(cimple VERSION 0.0.1 LANGUAGES C) if(MSVC) add_compile_options(/W4 /WX) else() - add_compile_options(-Wall -Wextra -Werror -Wno-error=unused-parameter) + add_compile_options(-Wall -Wextra -Werror) endif() add_compile_definitions(_GNU_SOURCE) diff --git a/src/compiler.h b/src/compiler.h new file mode 100644 index 0000000..de721d9 --- /dev/null +++ b/src/compiler.h @@ -0,0 +1,10 @@ +#ifndef __COMPILER_H__ +#define __COMPILER_H__ + +#ifdef __GNUC__ +#define UNUSED __attribute__((unused)) +#else +#define UNUSED +#endif + +#endif @@ -1,4 +1,5 @@ #include "file.h" +#include "compiler.h" #include "log.h" #include <ftw.h> @@ -7,7 +8,8 @@ #include <sys/stat.h> #include <unistd.h> -static int unlink_cb(const char *fpath, const struct stat *, int, struct FTW *) +static int unlink_cb(const char *fpath, UNUSED const struct stat *sb, UNUSED int typeflag, + UNUSED struct FTW *ftwbuf) { int ret = 0; diff --git a/src/server.c b/src/server.c index 6a4b73c..a84016e 100644 --- a/src/server.c +++ b/src/server.c @@ -1,5 +1,6 @@ #include "server.h" #include "ci_queue.h" +#include "compiler.h" #include "log.h" #include "msg.h" #include "signal.h" @@ -144,7 +145,7 @@ static int worker_requeue_run(struct server *server, struct ci_queue_entry *ci_r static int worker_iteration(struct server *server, int fd) { - struct ci_queue_entry *ci_run; + struct ci_queue_entry *ci_run = NULL; int ret = 0; ret = worker_dequeue_run(server, &ci_run); @@ -177,12 +178,13 @@ static int worker_thread(struct server *server, int fd) return ret; } -static int msg_new_worker_handler(struct server *server, int client_fd, const struct msg *) +static int msg_new_worker_handler(struct server *server, int client_fd, + UNUSED const struct msg *request) { return worker_thread(server, client_fd); } -static int msg_new_worker_parser(const struct msg *) +static int msg_new_worker_parser(UNUSED const struct msg *msg) { return 1; } diff --git a/src/signal.h b/src/signal.h index ac6da9d..d06ab6d 100644 --- a/src/signal.h +++ b/src/signal.h @@ -1,13 +1,15 @@ #ifndef __SIGNAL_H__ #define __SIGNAL_H__ +#include "compiler.h" + #include <pthread.h> #include <signal.h> #include <string.h> extern volatile sig_atomic_t global_stop_flag; -static void signal_handler(int) +static void signal_handler(UNUSED int signum) { global_stop_flag = 1; } diff --git a/src/worker.c b/src/worker.c index 3b48636..fbf609b 100644 --- a/src/worker.c +++ b/src/worker.c @@ -143,7 +143,7 @@ unknown_request: return msg_send(worker->fd, &response); } -int worker_main(struct worker *worker, int, char *[]) +int worker_main(struct worker *worker, UNUSED int argc, UNUSED char *argv[]) { int ret = 0; |