diff --git a/conf/pam_conv1/Makefile.am b/conf/pam_conv1/Makefile.am
index ce50b68..2e64330 100644
--- a/conf/pam_conv1/Makefile.am
+++ b/conf/pam_conv1/Makefile.am
@@ -8,6 +8,8 @@ EXTRA_DIST = README
 
 AM_YFLAGS = -d
 
+pam_conv1_CFLAGS = -Wno-unused-function -Wno-sign-compare
+
 BUILT_SOURCES = pam_conv_y.h
 
 noinst_PROGRAMS = pam_conv1
diff --git a/doc/specs/Makefile.am b/doc/specs/Makefile.am
index 99ecc70..de20dec 100644
--- a/doc/specs/Makefile.am
+++ b/doc/specs/Makefile.am
@@ -16,6 +16,8 @@ CPPFLAGS = @BUILD_CPPFLAGS@
 CFLAGS = @BUILD_CFLAGS@
 LDFLAGS = @BUILD_LDFLAGS@
 
+padout_CFLAGS = -Wno-unused-function -Wno-sign-compare
+
 BUILT_SOURCES = parse_y.h
 
 noinst_PROGRAMS = padout
diff --git a/libpamc/include/security/pam_client.h b/libpamc/include/security/pam_client.h
index 47e41aa..b63ca3b 100644
--- a/libpamc/include/security/pam_client.h
+++ b/libpamc/include/security/pam_client.h
@@ -109,7 +109,7 @@ char **pamc_list_agents(pamc_handle_t pch);
 
 #define PAM_BP_RENEW(old_p, cntrl, data_length)                            \
 do {                                                                       \
-    if (old_p) {                                                           \
+    if (old_p != NULL) {                                                   \
 	if (*(old_p)) {                                                    \
 	    u_int32_t __size;                                              \
             __size = PAM_BP_SIZE(*(old_p));                                \
diff --git a/modules/pam_access/pam_access.c b/modules/pam_access/pam_access.c
index 80d885d..128da01 100644
--- a/modules/pam_access/pam_access.c
+++ b/modules/pam_access/pam_access.c
@@ -806,7 +806,7 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED,
     const char *user=NULL;
     const void *void_from=NULL;
     const char *from;
-    const char const *default_config = PAM_ACCESS_CONFIG;
+    const char *default_config = PAM_ACCESS_CONFIG;
     struct passwd *user_pw;
     char hostname[MAXHOSTNAMELEN + 1];
     int rv;
diff --git a/modules/pam_filter/pam_filter.c b/modules/pam_filter/pam_filter.c
index 8ab7981..de8c35a 100644
--- a/modules/pam_filter/pam_filter.c
+++ b/modules/pam_filter/pam_filter.c
@@ -120,8 +120,8 @@ static int process_args(pam_handle_t *pamh
 
 	/* the "ARGS" variable */
 
-#define ARGS_OFFSET    5                          /*  strlen('ARGS=');  */
 #define ARGS_NAME      "ARGS="
+#define ARGS_OFFSET    (sizeof(ARGS_NAME) - 1)
 
 	size += ARGS_OFFSET;
 
@@ -134,7 +134,7 @@ static int process_args(pam_handle_t *pamh
 	    return -1;
 	}
 
-	strncpy(levp[0],ARGS_NAME,ARGS_OFFSET);
+	strcpy(levp[0], ARGS_NAME);
 	for (i=0,size=ARGS_OFFSET; i<argc; ++i) {
 	    strcpy(levp[0]+size, argv[i]);
 	    size += strlen(argv[i]);
@@ -144,8 +144,8 @@ static int process_args(pam_handle_t *pamh
 
 	/* the "SERVICE" variable */
 
-#define SERVICE_OFFSET    8                    /*  strlen('SERVICE=');  */
 #define SERVICE_NAME      "SERVICE="
+#define SERVICE_OFFSET    (sizeof(SERVICE_NAME) - 1)
 
 	retval = pam_get_item(pamh, PAM_SERVICE, &tmp);
 	if (retval != PAM_SUCCESS || tmp == NULL) {
@@ -168,14 +168,14 @@ static int process_args(pam_handle_t *pamh
 	    return -1;
 	}
 
-	strncpy(levp[1],SERVICE_NAME,SERVICE_OFFSET);
+	strcpy(levp[1], SERVICE_NAME);
 	strcpy(levp[1]+SERVICE_OFFSET, tmp);
 	levp[1][size] = '\0';                      /* <NUL> terminate */
 
 	/* the "USER" variable */
 
-#define USER_OFFSET    5                          /*  strlen('USER=');  */
 #define USER_NAME      "USER="
+#define USER_OFFSET    (sizeof(USER_NAME) - 1)
 
 	if (pam_get_user(pamh, &user, NULL) != PAM_SUCCESS ||
 	    user == NULL) {
@@ -194,14 +194,14 @@ static int process_args(pam_handle_t *pamh
 	    return -1;
 	}
 
-	strncpy(levp[2],USER_NAME,USER_OFFSET);
+	strcpy(levp[2], USER_NAME);
 	strcpy(levp[2]+USER_OFFSET, user);
 	levp[2][size] = '\0';                      /* <NUL> terminate */
 
 	/* the "USER" variable */
 
-#define TYPE_OFFSET    5                          /*  strlen('TYPE=');  */
 #define TYPE_NAME      "TYPE="
+#define TYPE_OFFSET    (sizeof(TYPE_NAME) - 1)
 
 	size = TYPE_OFFSET+strlen(type);
 
@@ -217,7 +217,7 @@ static int process_args(pam_handle_t *pamh
 	    return -1;
 	}
 
-	strncpy(levp[3],TYPE_NAME,TYPE_OFFSET);
+	strcpy(levp[3], TYPE_NAME);
 	strcpy(levp[3]+TYPE_OFFSET, type);
 	levp[3][size] = '\0';                      /* <NUL> terminate */
 
diff --git a/modules/pam_group/pam_group.c b/modules/pam_group/pam_group.c
index 8cd178c..66252c7 100644
--- a/modules/pam_group/pam_group.c
+++ b/modules/pam_group/pam_group.c
@@ -183,6 +183,7 @@ read_field(const pam_handle_t *pamh, int fd, char **buf, int *from, int *state)
 		    ++src; /* skip it */
 		    break;
 		}
+	    /* fallthrough */
 	    default:
 		*to++ = c;
 		onspace = 0;
diff --git a/modules/pam_limits/pam_limits.c b/modules/pam_limits/pam_limits.c
index cac3699..02967f3 100644
--- a/modules/pam_limits/pam_limits.c
+++ b/modules/pam_limits/pam_limits.c
@@ -384,7 +384,7 @@ static void parse_kernel_limits(pam_handle_t *pamh, struct pam_limit_s *pl, int
     FILE *limitsfile;
     const char *proclimits = "/proc/1/limits";
     char line[256];
-    char *units, *hard, *soft, *name;
+    char *hard, *soft, *name;
 
     if (!(limitsfile = fopen(proclimits, "r"))) {
         pam_syslog(pamh, LOG_WARNING, "Could not read %s (%s), using PAM defaults", proclimits, strerror(errno));
@@ -410,10 +410,7 @@ static void parse_kernel_limits(pam_handle_t *pamh, struct pam_limit_s *pl, int
         if (pos == maxlen) {
             /* step backwards over "Units" name */
             LIMITS_SKIP_WHITESPACE;
-            LIMITS_MARK_ITEM(units);
-        }
-        else {
-            units = "";
+            LIMITS_MARK_ITEM(hard); /* not a typo, units unused */
         }
 
         /* step backwards over "Hard Limit" value */
diff --git a/modules/pam_listfile/pam_listfile.c b/modules/pam_listfile/pam_listfile.c
index 5723598..1fe5f49 100644
--- a/modules/pam_listfile/pam_listfile.c
+++ b/modules/pam_listfile/pam_listfile.c
@@ -65,14 +65,14 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED,
     char mybuf[256],myval[256];
     struct stat fileinfo;
     FILE *inf;
-    char apply_val[256];
+    const char *apply_val;
     int apply_type;
 
     /* Stuff for "extended" items */
     struct passwd *userinfo;
 
     apply_type=APPLY_TYPE_NULL;
-    memset(apply_val,0,sizeof(apply_val));
+    apply_val="";
 
     for(i=0; i < argc; i++) {
 	{
@@ -140,13 +140,12 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED,
 		    citem = 0;
 	    } else if(!strcmp(mybuf,"apply")) {
 		apply_type=APPLY_TYPE_NONE;
-		memset(apply_val,'\0',sizeof(apply_val));
 		if (myval[0]=='@') {
 		    apply_type=APPLY_TYPE_GROUP;
-		    strncpy(apply_val,myval+1,sizeof(apply_val)-1);
+		    apply_val=myval+1;
 		} else {
 		    apply_type=APPLY_TYPE_USER;
-		    strncpy(apply_val,myval,sizeof(apply_val)-1);
+		    apply_val=myval;
 		}
 	    } else {
 		free(ifname);
diff --git a/modules/pam_rootok/pam_rootok.c b/modules/pam_rootok/pam_rootok.c
index 17baabe..80a67f6 100644
--- a/modules/pam_rootok/pam_rootok.c
+++ b/modules/pam_rootok/pam_rootok.c
@@ -61,7 +61,7 @@ _pam_parse (const pam_handle_t *pamh, int argc, const char **argv)
 
 #ifdef WITH_SELINUX
 static int
-log_callback (int type, const char *fmt, ...)
+log_callback (int type UNUSED, const char *fmt, ...)
 {
     int audit_fd;
     va_list ap;
diff --git a/modules/pam_selinux/pam_selinux.c b/modules/pam_selinux/pam_selinux.c
index 9b3fe22..5affec4 100644
--- a/modules/pam_selinux/pam_selinux.c
+++ b/modules/pam_selinux/pam_selinux.c
@@ -63,8 +63,6 @@
 
 #include <selinux/selinux.h>
 #include <selinux/get_context_list.h>
-#include <selinux/flask.h>
-#include <selinux/av_permissions.h>
 #include <selinux/selinux.h>
 #include <selinux/context.h>
 #include <selinux/get_default_type.h>
@@ -591,7 +589,7 @@ compute_tty_context(const pam_handle_t *pamh, module_data_t *data)
   }
 
   if (security_compute_relabel(data->exec_context, data->prev_tty_context,
-			       SECCLASS_CHR_FILE, &data->tty_context)) {
+			       string_to_security_class("chr_file"), &data->tty_context)) {
     data->tty_context = NULL;
     pam_syslog(pamh, LOG_ERR, "Failed to compute new context for %s: %m",
 	       data->tty_path);
diff --git a/modules/pam_sepermit/pam_sepermit.c b/modules/pam_sepermit/pam_sepermit.c
index c653290..f37af0f 100644
--- a/modules/pam_sepermit/pam_sepermit.c
+++ b/modules/pam_sepermit/pam_sepermit.c
@@ -353,7 +353,7 @@ sepermit_match(pam_handle_t *pamh, const char *cfgfile, const char *user,
 		if (*sense == PAM_SUCCESS) {
 			if (ignore)
 				*sense = PAM_IGNORE;
-			if (geteuid() == 0 && exclusive && get_loginuid(pamh) == -1)
+			if (geteuid() == 0 && exclusive && get_loginuid(pamh) == (uid_t)-1)
 				if (sepermit_lock(pamh, user, debug) < 0)
 					*sense = PAM_AUTH_ERR;
 		}
diff --git a/modules/pam_succeed_if/pam_succeed_if.c b/modules/pam_succeed_if/pam_succeed_if.c
index afa61b3..2a791d2 100644
--- a/modules/pam_succeed_if/pam_succeed_if.c
+++ b/modules/pam_succeed_if/pam_succeed_if.c
@@ -229,9 +229,16 @@ evaluate_notingroup(pam_handle_t *pamh, const char *user, const char *group)
 		return PAM_SUCCESS;
 	return PAM_AUTH_ERR;
 }
+
+#ifdef HAVE_INNETGR
+# define SOMETIMES_UNUSED UNUSED
+#else
+# define SOMETIMES_UNUSED
+#endif
+
 /* Return PAM_SUCCESS if the (host,user) is in the netgroup. */
 static int
-evaluate_innetgr(const pam_handle_t* pamh, const char *host, const char *user, const char *group)
+evaluate_innetgr(const pam_handle_t* pamh SOMETIMES_UNUSED, const char *host, const char *user, const char *group)
 {
 #ifdef HAVE_INNETGR
 	if (innetgr(group, host, user, NULL) == 1)
@@ -244,7 +251,7 @@ evaluate_innetgr(const pam_handle_t* pamh, const char *host, const char *user, c
 }
 /* Return PAM_SUCCESS if the (host,user) is NOT in the netgroup. */
 static int
-evaluate_notinnetgr(const pam_handle_t* pamh, const char *host, const char *user, const char *group)
+evaluate_notinnetgr(const pam_handle_t* pamh SOMETIMES_UNUSED, const char *host, const char *user, const char *group)
 {
 #ifdef HAVE_INNETGR
 	if (innetgr(group, host, user, NULL) == 0)
diff --git a/modules/pam_time/pam_time.c b/modules/pam_time/pam_time.c
index 26a374b..4863ea4 100644
--- a/modules/pam_time/pam_time.c
+++ b/modules/pam_time/pam_time.c
@@ -213,6 +213,7 @@ read_field(const pam_handle_t *pamh, int fd, char **buf, int *from, int *state)
 		    ++src; /* skip it */
 		    break;
 		}
+		/* fallthrough */
 	    default:
 		*to++ = c;
 		onspace = 0;
diff --git a/modules/pam_unix/pam_unix_passwd.c b/modules/pam_unix/pam_unix_passwd.c
index 87db7cf..6dd0ec5 100644
--- a/modules/pam_unix/pam_unix_passwd.c
+++ b/modules/pam_unix/pam_unix_passwd.c
@@ -350,7 +350,7 @@ static int _unix_run_update_binary(pam_handle_t *pamh, unsigned long long ctrl,
 static int check_old_password(const char *forwho, const char *newpass)
 {
 	static char buf[16384];
-	char *s_luser, *s_uid, *s_npas, *s_pas;
+	char *s_pas;
 	int retval = PAM_SUCCESS;
 	FILE *opwfile;
 	size_t len = strlen(forwho);
@@ -364,9 +364,9 @@ static int check_old_password(const char *forwho, const char *newpass)
 			buf[len] == ',')) {
 			char *sptr;
 			buf[strlen(buf) - 1] = '\0';
-			s_luser = strtok_r(buf, ":,", &sptr);
-			s_uid = strtok_r(NULL, ":,", &sptr);
-			s_npas = strtok_r(NULL, ":,", &sptr);
+			/* s_luser = */ strtok_r(buf, ":,", &sptr);
+			/* s_uid = */ strtok_r(NULL, ":,", &sptr);
+			/* s_npas = */ strtok_r(NULL, ":,", &sptr);
 			s_pas = strtok_r(NULL, ":,", &sptr);
 			while (s_pas != NULL) {
 				char *md5pass = Goodcrypt_md5(newpass, s_pas);
@@ -581,7 +581,7 @@ static int _pam_unix_approve_pass(pam_handle_t * pamh
 		remark = _("You must choose a shorter password.");
 		D(("length exceeded [%s]", remark));
 	} else if (off(UNIX__IAMROOT, ctrl)) {
-		if (strlen(pass_new) < pass_min_len)
+		if ((int)strlen(pass_new) < pass_min_len)
 		  remark = _("You must choose a longer password.");
 		D(("length check [%s]", remark));
 		if (on(UNIX_REMEMBER_PASSWD, ctrl)) {
diff --git a/modules/pam_unix/support.c b/modules/pam_unix/support.c
index 4f15b61..814d4c0 100644
--- a/modules/pam_unix/support.c
+++ b/modules/pam_unix/support.c
@@ -211,11 +211,6 @@ unsigned long long _set_ctrl(pam_handle_t *pamh, int flags, int *remember,
 	return ctrl;
 }
 
-static void _cleanup(pam_handle_t * pamh UNUSED, void *x, int error_status UNUSED)
-{
-	_pam_delete(x);
-}
-
 /* ************************************************************** *
  * Useful non-trivial functions                                   *
  * ************************************************************** */
