From e9803436f78b20cb4f3ab7646585f20f63a7078d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 24 Apr 2014 06:21:57 +0200 Subject: enable more warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 16 ++++++++++------ src/auth/pam.c | 7 +++++-- src/login.h | 2 +- src/quit.h | 4 ++-- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 2507ff9..c90d533 100644 --- a/Makefile +++ b/Makefile @@ -53,12 +53,16 @@ VRB_CPPFLAGS = $(foreach D, $(VRB_DEFS), -D'$(D)=$($(D))') -DAUTH=$(auth_$(AUTH) OPTIMISE = -Os STD=gnu99 -WARN = -Wall -Wextra -Wdouble-promotion -Wformat=2 -Winit-self -Wmissing-include-dirs \ - -Wfloat-equal -Wmissing-prototypes -Wmissing-declarations -Wtrampolines -Wnested-externs \ - -Wno-variadic-macros -Wdeclaration-after-statement -Wundef -Wpacked -Wunsafe-loop-optimizations \ - -Wbad-function-cast -Wwrite-strings -Wlogical-op -Wstrict-prototypes -Wold-style-definition \ - -Wvector-operation-performance -Wstack-protector -Wunsuffixed-float-constants -Wcast-align \ - -Wsync-nand -Wshadow -Wredundant-decls -Winline -Wcast-qual -Wsign-conversion -Wstrict-overflow +WARN = -Wall -Wextra -Wdouble-promotion -Wformat=2 -Winit-self -Wmissing-include-dirs \ + -Wtrampolines -Wfloat-equal -Wshadow -Wmissing-prototypes -Wmissing-declarations \ + -Wredundant-decls -Wnested-externs -Winline -Wno-variadic-macros -Wsync-nand \ + -Wunsafe-loop-optimizations -Wcast-align -Wstrict-overflow -Wdeclaration-after-statement \ + -Wundef -Wbad-function-cast -Wcast-qual -Wwrite-strings -Wlogical-op -Waggregate-return \ + -Wstrict-prototypes -Wold-style-definition -Wpacked -Wvector-operation-performance \ + -Wunsuffixed-float-constants -Wsuggest-attribute=const -Wsuggest-attribute=noreturn \ + -Wsuggest-attribute=pure -Wsuggest-attribute=format -Wnormalized=nfkc -Wconversion \ + -fstrict-aliasing -fstrict-overflow -fipa-pure-const -ftree-vrp -fstack-usage \ + -funsafe-loop-optimizations # excluded: -pedantic CPPFLAGS = $(EXTRA_CPP_FLAGS) $(STR_CPPFLAGS) $(VRB_CPPFLAGS) CFLAGS = -std=$(STD) $(WARN) diff --git a/src/auth/pam.c b/src/auth/pam.c index 94cf28a..d61e7c2 100644 --- a/src/auth/pam.c +++ b/src/auth/pam.c @@ -32,9 +32,9 @@ #define __failed(RC) ((RC) != PAM_SUCCESS) -void quit_pam(int sig); +static void quit_pam(int sig) __attribute__((noreturn)); -int conv_pam(int num_msg, const struct pam_message** msg, struct pam_response** resp, void* appdata_ptr); +static int conv_pam(int num_msg, const struct pam_message** msg, struct pam_response** resp, void* appdata_ptr); /** @@ -73,6 +73,8 @@ static char auto_authenticated = 1; static char* (*passphrase_reader)(void) = NULL; +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" /** * Exit if a PAM instruction failed * @@ -90,6 +92,7 @@ static void do_pam(int rc) _exit(1); } } +# pragma GCC diagnostic pop /** diff --git a/src/login.h b/src/login.h index e335e7c..e7f2a82 100644 --- a/src/login.h +++ b/src/login.h @@ -56,7 +56,7 @@ void set_environ(struct passwd* entry, char preserve_env); * * @param entry The user entry in the password file */ -void exec_shell(struct passwd* entry); +void exec_shell(struct passwd* entry) __attribute__((noreturn)); #endif diff --git a/src/quit.h b/src/quit.h index d42c524..cbae77c 100644 --- a/src/quit.h +++ b/src/quit.h @@ -25,14 +25,14 @@ * * @param signal The signal the program received */ -void timeout_quit(int signal); +void timeout_quit(int signal) __attribute__((noreturn)); /** * Quit function for user aborts * * @param signal The signal the program received */ -void user_quit(int signal); +void user_quit(int signal) __attribute__((noreturn)); #endif -- cgit v1.2.3-70-g09d2