Skip to contentSkip to conversation

nfs-utils: Use -Werror warning flags to clean up the code.

PATCH In review Steve Dickson 1 participant 9 messages Feb 20, 2018 – Feb 23, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover nfs-utils: Use -Werror warning flags to clean up the code.

I received a patch that tried to turns on some of these -Werror flags but could not get passed the warning that were being generated by the rpcgen code.

After taking care of the rpcgen warnings, I took over the patch and finished it off.

The warning flags I choose to use are pattern after the list in the libostree and the systemd list.

Steve Dickson (7):
configure.ac: clean up
Removed missing-prototypes warnings. Removed format-overflow=2 warnings Removed format=2 warnings
Removed undef warnings
Removed missing-include-dirs warnings Added more -Werror= warning flags

 configure.ac                       | 41 ++++++++++++++++++++++++--------------
 support/misc/mountpoint.c          |  1 +
 support/nfs/atomicio.c             |  2 ++
 support/nfs/cacheio.c              |  2 +-
 support/nfs/closeall.c             |  2 ++
 support/nfs/rpcmisc.c              |  1 +
 support/nfs/strlcat.c              |  2 ++
 support/nfs/strlcpy.c              |  2 ++
 support/nfs/svc_socket.c           |  2 ++
 support/nfs/wildmat.c              |  7 +++++++
 support/nfsidmap/libnfsidmap.c     |  3 ++-
 support/nfsidmap/nfsidmap_plugin.h |  1 +
 support/nfsidmap/nss.c             |  2 +-
 systemd/systemd.c                  |  1 +
 utils/blkmapd/device-discovery.c   | 10 +++++-----
 utils/blkmapd/dm-device.c          |  2 +-
 utils/gssd/Makefile.am             |  2 ++
 utils/gssd/err_util.c              |  1 +
 utils/gssd/gss_names.c             |  1 +
 utils/gssd/gssd_proc.c             |  4 ++--
 utils/gssd/krb5_util.c             |  6 +++---
 utils/gssd/svcgssd.c               |  4 ++--
 utils/gssd/svcgssd_mech2file.c     |  1 +
 utils/idmapd/Makefile.am           |  2 ++
 utils/idmapd/idmapd.c              |  4 ++--
 utils/mount/configfile.c           |  4 ++++
 utils/mount/mount_libmount.c       |  2 ++
 utils/mount/stropts.c              |  2 ++
 utils/mountd/svc_run.c             |  1 +
 utils/nfsdcltrack/sqlite.c         |  3 ++-
 utils/nfsidmap/Makefile.am         |  2 ++
 utils/nfsstat/nfsstat.c            |  4 +++-
 utils/statd/svc_run.c              |  1 +
 33 files changed, 90 insertions(+), 35 deletions(-)
Signature · 1 line
2.14.3
#1 lore raw

PATCH 1/7 configure.ac: clean up

Remove ARCHFLAGS since it has not been needed for years.

---
 configure.ac | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)
configure.ac +6 -14
index 95991c1..b3f6b97 100644
@@ -543,20 +543,12 @@ AC_SUBST(CXXFLAGS_FOR_BUILD)
 AC_SUBST(CPPFLAGS_FOR_BUILD)
 AC_SUBST(LDFLAGS_FOR_BUILD)
 
-dnl *************************************************************
-dnl Set up "global" CFLAGS
-dnl *************************************************************
-dnl Use architecture-specific compile flags
-dnl (We use $host and not $build in case we are cross-compiling)
-dnl *************************************************************
-dnl Note: we no longer have arch specific compile flags, but 
-dnl the stub is left here in case they are needed one day.
-case $host in
-  *)
-    ARCHFLAGS="" ;;
-esac
-
-my_am_cflags="-Wall -Wextra -Wstrict-prototypes $ARCHFLAGS -pipe"
+my_am_cflags="\
+ -pipe \
+ -Wall \
+ -Wextra \
+ -Wstrict-prototypes \
+"
 
 AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
 
Signature · 1 line
2.14.3
#2 lore raw

PATCH 2/7 Removed missing-prototypes warnings.

In reply to Steve Dickson

Added the -Werror=missing-prototypes warning flag
then cleaned up the mess.

---
 configure.ac                       |  4 +++-
 support/misc/mountpoint.c          |  1 +
 support/nfs/atomicio.c             |  2 ++
 support/nfs/closeall.c             |  2 ++
 support/nfs/rpcmisc.c              |  1 +
 support/nfs/strlcat.c              |  2 ++
 support/nfs/strlcpy.c              |  2 ++
 support/nfs/svc_socket.c           |  2 ++
 support/nfs/wildmat.c              |  1 +
 support/nfsidmap/libnfsidmap.c     |  3 ++-
 support/nfsidmap/nfsidmap_plugin.h |  1 +
 support/nfsidmap/nss.c             |  2 +-
 systemd/systemd.c                  |  1 +
 utils/blkmapd/device-discovery.c   | 10 +++++-----
 utils/blkmapd/dm-device.c          |  2 +-
 utils/gssd/err_util.c              |  1 +
 utils/gssd/gss_names.c             |  1 +
 utils/gssd/gssd_proc.c             |  4 ++--
 utils/gssd/svcgssd.c               |  4 ++--
 utils/gssd/svcgssd_mech2file.c     |  1 +
 utils/idmapd/idmapd.c              |  2 +-
 utils/mount/configfile.c           |  4 ++++
 utils/mount/mount_libmount.c       |  2 ++
 utils/mountd/svc_run.c             |  1 +
 utils/nfsdcltrack/sqlite.c         |  3 ++-
 utils/nfsstat/nfsstat.c            |  2 +-
 utils/statd/svc_run.c              |  1 +
 27 files changed, 46 insertions(+), 16 deletions(-)
configure.ac +3 -1
index b3f6b97..31990c3 100644
@@ -547,7 +547,9 @@ my_am_cflags="\
  -pipe \
  -Wall \
  -Wextra \
- -Wstrict-prototypes \
+ -Werror=strict-prototypes \
+ -Werror=missing-prototypes \
+ -Werror=missing-declarations \
 "
 
 AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
support/misc/mountpoint.c +1 -0
index a72fb92..9f9ce44 100644
@@ -6,6 +6,7 @@
 #include <string.h>
 #include "xcommon.h"
 #include <sys/stat.h>
+#include "misc.h"
 
 int
 is_mountpoint(char *path)
support/nfs/atomicio.c +2 -0
index aa819ca..0e81838 100644
@@ -28,6 +28,8 @@
 #include <unistd.h>
 #include <errno.h>
 
+#include "nfslib.h"
+
 /*
  * ensure all of data on socket comes through. f==read || f==write
  */
support/nfs/closeall.c +2 -0
index a69bf35..e07253e 100644
@@ -9,6 +9,8 @@
 #include <dirent.h>
 #include <errno.h>
 
+#include "nfslib.h"
+
 void
 closeall(int min)
 {
support/nfs/rpcmisc.c +1 -0
index ae2c0a6..abe89ba 100644
@@ -32,6 +32,7 @@
 #include <unistd.h>
 #include <time.h>
 #include "nfslib.h"
+#include "rpcmisc.h"
 
 #if SIZEOF_SOCKLEN_T - 0 == 0
 #define socklen_t int
support/nfs/strlcat.c +2 -0
index daedd7a..0edee14 100644
@@ -38,6 +38,8 @@ static char *rcsid = "$OpenBSD: strlcat.c,v 1.8 2001/05/13 15:40:15 deraadt Exp
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
+#include "nfslib.h"
+
 /*
  * Appends src to string dst of size siz (unlike strncat, siz is the
  * full size of dst, not space left).  At most siz-1 characters
support/nfs/strlcpy.c +2 -0
index a2653ee..23e3ae9 100644
@@ -38,6 +38,8 @@ static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
+#include "nfslib.h"
+
 /*
  * Copy src to string dst of size siz.  At most siz-1 characters
  * will be copied.  Always NUL terminates (unless siz == 0).
support/nfs/svc_socket.c +2 -0
index 1fa0d15..1239712 100644
@@ -25,6 +25,8 @@
 #include <sys/fcntl.h>
 #include <errno.h>
 #include "xlog.h"
+#include "rpcmisc.h"
+#include "nfslib.h"
 
 #include "config.h"
 
support/nfs/wildmat.c +1 -0
index c5b4c78..2f40358 100644
@@ -41,6 +41,7 @@
 #endif
 
 #include <ctype.h>
+#include "nfslib.h"
 
 #define TRUE			1
 #define FALSE			0
support/nfsidmap/libnfsidmap.c +2 -1
index 3b44da6..d9d44de 100644
@@ -64,6 +64,7 @@
 
 #pragma GCC visibility push(hidden)
 
+void nfs4_cleanup_name_mapping(void);
 static char *default_domain;
 static struct mapping_plugin **nfs4_plugins = NULL;
 static struct mapping_plugin **gss_plugins = NULL;
@@ -327,7 +328,7 @@ out:
 	return ret;
 }
 
-char * get_default_domain(void)
+static char *get_default_domain(void)
 {
 	int ret;
 
support/nfsidmap/nfsidmap_plugin.h +1 -0
index e19efe5..708874c 100644
@@ -51,6 +51,7 @@ struct trans_func {
 
 extern int idmap_verbosity;
 extern nfs4_idmap_log_function_t idmap_log_func;
+struct trans_func *libnfsidmap_plugin_init(void);
 
 /* Level zero always prints, others print depending on verbosity level */
 #define IDMAP_LOG(LVL, MSG) \
support/nfsidmap/nss.c +1 -1
index 6f024dc..65625a8 100644
@@ -436,7 +436,7 @@ out:
 	return err;
 }
 
-int nss_gss_princ_to_grouplist(char *secname, char *princ,
+static int nss_gss_princ_to_grouplist(char *secname, char *princ,
 			       gid_t *groups, int *ngroups,
 			       extra_mapping_params **UNUSED(ex))
 {
systemd/systemd.c +1 -0
index 17820d4..c7bdb4d 100644
@@ -8,6 +8,7 @@
 #include <stdlib.h>
 #include <ctype.h>
 #include <string.h>
+#include "systemd.h"
 
 static const char hex[16] =
 {
utils/blkmapd/device-discovery.c +5 -5
index cae8c8d..b71c949 100644
@@ -81,7 +81,7 @@ int    bl_watch_fd, bl_pipe_fd, nfs_pipedir_wfd, rpc_pipedir_wfd;
 int    pidfd = -1;
 
 
-struct bl_disk_path *bl_get_path(const char *filepath,
+static struct bl_disk_path *bl_get_path(const char *filepath,
 				 struct bl_disk_path *paths)
 {
 	struct bl_disk_path *tmp = paths;
@@ -103,7 +103,7 @@ struct bl_disk_path *bl_get_path(const char *filepath,
  * exist for each multipath device. If not, active device path will be
  * chosen for device creation.
  */
-int bl_update_path(enum bl_path_state_e state, struct bl_disk *disk)
+static int bl_update_path(enum bl_path_state_e state, struct bl_disk *disk)
 {
 	struct bl_disk_path *valid_path = disk->valid_path;
 
@@ -112,7 +112,7 @@ int bl_update_path(enum bl_path_state_e state, struct bl_disk *disk)
 	return 1;
 }
 
-void bl_release_disk(void)
+static void bl_release_disk(void)
 {
 	struct bl_disk *disk;
 	struct bl_disk_path *path = NULL;
@@ -133,7 +133,7 @@ void bl_release_disk(void)
 	}
 }
 
-void bl_add_disk(char *filepath)
+static void bl_add_disk(char *filepath)
 {
 	struct bl_disk *disk = NULL;
 	int fd = 0;
@@ -435,7 +435,7 @@ static int bl_event_helper(void)
 	return ret;
 }
 
-void sig_die(int signal)
+static void sig_die(int signal)
 {
 	if (pidfd >= 0) {
 		close(pidfd);
utils/blkmapd/dm-device.c +1 -1
index 24ffcbf..f2d4de4 100644
@@ -210,7 +210,7 @@ static int dm_device_remove_byname(const char *dev_name)
 	return ret;
 }
 
-int dm_device_remove(uint64_t dev)
+static int dm_device_remove(uint64_t dev)
 {
 	struct dm_task *dmt;
 	struct dm_names *dmnames;
utils/gssd/err_util.c +1 -0
index fe09eda..2b1132a 100644
@@ -36,6 +36,7 @@
 #include <stdarg.h>
 #include <string.h>
 #include "xlog.h"
+#include "err_util.h"
 
 static int verbosity = 0;
 static int fg = 0;
utils/gssd/gss_names.c +1 -0
index 047069d..2a7f3a1 100644
@@ -51,6 +51,7 @@
 
 #include "svcgssd.h"
 #include "gss_util.h"
+#include "gss_names.h"
 #include "err_util.h"
 #include "context.h"
 #include "misc.h"
utils/gssd/gssd_proc.c +2 -2
index 4fc81c3..ce73777 100644
@@ -473,7 +473,7 @@ change_identity(uid_t uid)
 	return 0;
 }
 
-AUTH *
+static AUTH *
 krb5_not_machine_creds(struct clnt_info *clp, uid_t uid, char *tgtname,
 			int *downcall_err, int *chg_err, CLIENT **rpc_clnt)
 {
@@ -519,7 +519,7 @@ out:
 	return auth;
 }
 
-AUTH *
+static AUTH *
 krb5_use_machine_creds(struct clnt_info *clp, uid_t uid, char *tgtname,
 		    char *service, CLIENT **rpc_clnt)
 {
utils/gssd/svcgssd.c +2 -2
index 23f0c0b..8e918cc 100644
@@ -65,7 +65,7 @@
 
 struct state_paths etab;
 
-void
+static void
 sig_die(int signal)
 {
 	/* destroy krb5 machine creds */
@@ -73,7 +73,7 @@ sig_die(int signal)
 	exit(0);
 }
 
-void
+static void
 sig_hup(int signal)
 {
 	/* don't exit on SIGHUP */
utils/gssd/svcgssd_mech2file.c +1 -0
index ecd908b..c26b435 100644
@@ -41,6 +41,7 @@
 #include <gssapi/gssapi.h>
 #include <string.h>
 
+char * mech2file(gss_OID mech);
 
 #define g_OID_equal(o1,o2) \
    (((o1)->length == (o2)->length) && \
utils/idmapd/idmapd.c +1 -1
index 2b9ecea..c7e75bd 100644
@@ -196,7 +196,7 @@ flush_nfsd_idmap_cache(void)
 	return ret;
 }
 
-void usage(char *progname)
+static void usage(char *progname)
 {
 	fprintf(stderr, "Usage: %s [-hfvCS] [-p path] [-c path]\n",
 		basename(progname));
utils/mount/configfile.c +4 -0
index 64688bf..b48b25e 100644
@@ -35,6 +35,10 @@
 #include "network.h"
 #include "conffile.h"
 
+char *mountopts_convert(char *value);
+char *is_alias(char *opt);
+char *conf_get_mntopts(char *spec, char *mount_point, char *mount_opts);
+
 #define KBYTES(x)     ((x) * (1024))
 #define MEGABYTES(x)  ((x) * (1048576))
 #define GIGABYTES(x)  ((x) * (1073741824))
utils/mount/mount_libmount.c +2 -0
index 2d40657..aa4ac5c 100644
@@ -45,6 +45,8 @@
 #include "error.h"
 #include "utils.h"
 
+char *retrieve_mount_options(struct libmnt_fs *fs);
+
 char *progname;
 int nfs_mount_data_version;
 int verbose;
utils/mountd/svc_run.c +1 -0
index a572441..41b96d7 100644
@@ -57,6 +57,7 @@
 #include <rpc/rpc_com.h>
 #endif
 
+void my_svc_run(void);
 void cache_set_fds(fd_set *fdset);
 int cache_process_req(fd_set *readfds);
 
utils/nfsdcltrack/sqlite.c +2 -1
index 1552eba..c59f777 100644
@@ -51,6 +51,7 @@
 #include <linux/limits.h>
 
 #include "xlog.h"
+#include "sqlite.h"
 
 #define CLTRACK_SQLITE_LATEST_SCHEMA_VERSION 2
 
@@ -203,7 +204,7 @@ rollback:
  * then insert schema version into the parameters table and commit the
  * transaction. On any error, rollback the transaction.
  */
-int
+static int
 sqlite_maindb_init_v2(void)
 {
 	int ret, ret2;
utils/nfsstat/nfsstat.c +1 -1
index eddbe9a..43fe0a8 100644
@@ -300,7 +300,7 @@ int versions[] = {
 	PRNT_V4
 };
 
-void usage(char *name)
+static void usage(char *name)
 {
 	printf("Usage: %s [OPTION]...\n\
 \n\
utils/statd/svc_run.c +1 -0
index 28c1ad6..d1dbd74 100644
@@ -56,6 +56,7 @@
 #include "statd.h"
 #include "notlist.h"
 
+void my_svc_exit(void);
 static int	svc_stop = 0;
 
 /*
Signature · 1 line
2.14.3
#3 lore raw

PATCH 3/7 Removed format-overflow=2 warnings

In reply to Steve Dickson

Added the -Werror=format-overflow=2 warning flag
and then cleaned up the mess

---
 configure.ac          | 1 +
 support/nfs/cacheio.c | 2 +-
 utils/idmapd/idmapd.c | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)
configure.ac +1 -0
index 31990c3..4f9d8c4 100644
@@ -550,6 +550,7 @@ my_am_cflags="\
  -Werror=strict-prototypes \
  -Werror=missing-prototypes \
  -Werror=missing-declarations \
+ -Werror=format-overflow=2 \
 "
 
 AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
support/nfs/cacheio.c +1 -1
index 9912afa..9dc4cf1 100644
@@ -212,7 +212,7 @@ cache_flush(int force)
 {
 	struct stat stb;
 	int c;
-	char stime[20];
+	char stime[32];
 	char path[200];
 	time_t now;
 	/* Note: the order of these caches is important.
utils/idmapd/idmapd.c +1 -1
index c7e75bd..67d115d 100644
@@ -169,7 +169,7 @@ static int
 flush_nfsd_cache(char *path, time_t now)
 {
 	int fd;
-	char stime[20];
+	char stime[32];
 
 	sprintf(stime, "%ld\n", now);
 	fd = open(path, O_RDWR);
Signature · 1 line
2.14.3
#4 lore raw

PATCH 4/7 Removed format=2 warnings

In reply to Steve Dickson

Added the -Werror=format=2 warning flag
and added couple pragma statments to ignore
the warning where it could not be avoided.

---
 configure.ac            | 1 +
 utils/mount/stropts.c   | 2 ++
 utils/nfsstat/nfsstat.c | 2 ++
 3 files changed, 5 insertions(+)
configure.ac +1 -0
index 4f9d8c4..11b994b 100644
@@ -551,6 +551,7 @@ my_am_cflags="\
  -Werror=missing-prototypes \
  -Werror=missing-declarations \
  -Werror=format-overflow=2 \
+ -Werror=format=2 \
 "
 
 AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
utils/mount/stropts.c +2 -0
index 1217823..777de39 100644
@@ -761,9 +761,11 @@ static int nfs_do_mount_v4(struct nfsmount_info *mi,
 			fmt = "vers=%lu.%lu";
 			break;
 		}
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
 		snprintf(version_opt, sizeof(version_opt) - 1,
 			fmt, mi->version.major,
 			mi->version.minor);
+#pragma GCC diagnostic warning "-Wformat-nonliteral"
 
 		if (po_append(options, version_opt) == PO_FAILED) {
 			errno = EINVAL;
utils/nfsstat/nfsstat.c +2 -0
index 43fe0a8..c779053 100644
@@ -980,8 +980,10 @@ more_stats:
 			}
 			bufp = buf;
 			for (; curindex < numvals; curindex++) {
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
 				n = sscanf(bufp, fmt, &ip->valptr[curindex],
 						&numconsumed);
+#pragma GCC diagnostic warning "-Wformat-nonliteral"
 				if (n != 1)
 					break;
 				if (is_proc) {
Signature · 1 line
2.14.3
#5 lore raw

PATCH 5/7 Removed undef warnings

In reply to Steve Dickson

Added the -Werror=undef warning flag and
then fixed a few #ifdefs

---
 configure.ac           | 1 +
 utils/gssd/krb5_util.c | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
configure.ac +1 -0
index 11b994b..2364275 100644
@@ -552,6 +552,7 @@ my_am_cflags="\
  -Werror=missing-declarations \
  -Werror=format-overflow=2 \
  -Werror=format=2 \
+ -Werror=undef \
 "
 
 AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
utils/gssd/krb5_util.c +3 -3
index b64818a..6e61da2 100644
@@ -333,7 +333,7 @@ gssd_get_single_krb5_cred(krb5_context context,
 			  struct gssd_k5_kt_princ *ple,
 			  int nocache)
 {
-#if HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS
+#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS
 	krb5_get_init_creds_opt *init_opts = NULL;
 #else
 	krb5_get_init_creds_opt options;
@@ -372,7 +372,7 @@ gssd_get_single_krb5_cred(krb5_context context,
 	if ((krb5_unparse_name(context, ple->princ, &pname)))
 		pname = NULL;
 
-#if HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS
+#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS
 	code = krb5_get_init_creds_opt_alloc(context, &init_opts);
 	if (code) {
 		k5err = gssd_k5_err_msg(context, code);
@@ -454,7 +454,7 @@ gssd_get_single_krb5_cred(krb5_context context,
 	code = 0;
 	printerr(2, "%s: principal '%s' ccache:'%s'\n", __func__, pname, cc_name);
   out:
-#if HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS
+#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS
 	if (init_opts)
 		krb5_get_init_creds_opt_free(context, init_opts);
 #endif
Signature · 1 line
2.14.3
#6 lore raw

PATCH 6/7 Removed missing-include-dirs warnings

In reply to Steve Dickson

Added the -Werror=missing-include-dirs warning flag then moved some include directories around.

---
 configure.ac               | 3 ++-
 support/nfs/wildmat.c      | 6 ++++++
 utils/gssd/Makefile.am     | 2 ++
 utils/idmapd/Makefile.am   | 2 ++
 utils/nfsidmap/Makefile.am | 2 ++
 5 files changed, 14 insertions(+), 1 deletion(-)
configure.ac +2 -1
index 2364275..b849f43 100644
@@ -448,7 +448,7 @@ if test -n "$path_plugins" ; then
 fi
 AM_CONDITIONAL(PATH_PLUGINS, test -n "$path_plugins")
 
-AC_SUBST(AM_CPPFLAGS, "$AM_CPPFLAGS -I../../support/nfsidmap")
+AC_SUBST(AM_CPPFLAGS, "$AM_CPPFLAGS")
 AC_DEFINE([HAVE_NFS4_SET_DEBUG], 1,
           [Bundled lib always has the `nfs4_set_debug' function.])
 
@@ -553,6 +553,7 @@ my_am_cflags="\
  -Werror=format-overflow=2 \
  -Werror=format=2 \
  -Werror=undef \
+ -Werror=missing-include-dirs \
 "
 
 AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
support/nfs/wildmat.c +6 -0
index 2f40358..437b2d1 100644
@@ -43,8 +43,14 @@
 #include <ctype.h>
 #include "nfslib.h"
 
+#ifndef TRUE
 #define TRUE			1
+#endif
+
+#ifndef FALSE
 #define FALSE			0
+#endif
+
 #define ABORT			-1
 
 
utils/gssd/Makefile.am +2 -0
index beb3e8e..321046b 100644
@@ -5,6 +5,8 @@ if CONFIG_SVCGSS
 man8_MANS	+= svcgssd.man
 endif
 
+AM_CPPFLAGS += -I ../../support/nfsidmap
+
 RPCPREFIX	= rpc.
 KPREFIX		= @kprefix@
 sbin_PREFIXED	= gssd
utils/idmapd/Makefile.am +2 -0
index d768eec..e09e8c5 100644
@@ -2,6 +2,8 @@
 
 man8_MANS	= idmapd.man
 
+AM_CPPFLAGS += -I ../../support/nfsidmap
+
 RPCPREFIX	= rpc.
 KPREFIX		= @kprefix@
 sbin_PROGRAMS	= idmapd
utils/nfsidmap/Makefile.am +2 -0
index 49158df..e5d7d04 100644
@@ -3,6 +3,8 @@
 man8_MANS = nfsidmap.man
 sbin_PROGRAMS	= nfsidmap
 
+AM_CPPFLAGS += -I ../../support/nfsidmap
+
 nfsidmap_SOURCES = nfsidmap.c
 nfsidmap_LDADD = -lkeyutils \
 		 ../../support/nfs/libnfs.la \
Signature · 1 line
2.14.3
#7 lore raw

PATCH 7/7 Added more -Werror= warning flags

In reply to Steve Dickson

Add some more -Werror warning flags that
didn't cause warnings but could catch
some in the future.

---
 configure.ac | 13 +++++++++++++
 1 file changed, 13 insertions(+)
configure.ac +13 -0
index b849f43..f4eba1f 100644
@@ -554,6 +554,19 @@ my_am_cflags="\
  -Werror=format=2 \
  -Werror=undef \
  -Werror=missing-include-dirs \
+ -Werror=strict-aliasing=2 \
+ -Werror=init-self \
+ -Werror=implicit-function-declaration \
+ -Werror=return-type \
+ -Werror=switch \
+ -Werror=overflow \
+ -Werror=int-conversion \
+ -Werror=parentheses \
+ -Werror=incompatible-pointer-types \
+ -Werror=misleading-indentation \
+ -Werror=aggregate-return \
+ -Werror=unused-result \
+ -fno-strict-aliasing \
 "
 
 AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
Signature · 1 line
2.14.3
#8 lore raw
In reply to Steve Dickson
Quoted 47 lines · Steve Dickson

I received a patch that tried to turns on some of these -Werror flags but could not get passed the warning that were being generated by the rpcgen code.

After taking care of the rpcgen warnings, I took over the patch and finished it off.

The warning flags I choose to use are pattern after the list in the libostree and the systemd list.

Steve Dickson (7):
configure.ac: clean up
Removed missing-prototypes warnings. Removed format-overflow=2 warnings Removed format=2 warnings
Removed undef warnings
Removed missing-include-dirs warnings Added more -Werror= warning flags

 configure.ac                       | 41 ++++++++++++++++++++++++--------------
 support/misc/mountpoint.c          |  1 +
 support/nfs/atomicio.c             |  2 ++
 support/nfs/cacheio.c              |  2 +-
 support/nfs/closeall.c             |  2 ++
 support/nfs/rpcmisc.c              |  1 +
 support/nfs/strlcat.c              |  2 ++
 support/nfs/strlcpy.c              |  2 ++
 support/nfs/svc_socket.c           |  2 ++
 support/nfs/wildmat.c              |  7 +++++++
 support/nfsidmap/libnfsidmap.c     |  3 ++-
 support/nfsidmap/nfsidmap_plugin.h |  1 +
 support/nfsidmap/nss.c             |  2 +-
 systemd/systemd.c                  |  1 +
 utils/blkmapd/device-discovery.c   | 10 +++++-----
 utils/blkmapd/dm-device.c          |  2 +-
 utils/gssd/Makefile.am             |  2 ++
 utils/gssd/err_util.c              |  1 +
 utils/gssd/gss_names.c             |  1 +
 utils/gssd/gssd_proc.c             |  4 ++--
 utils/gssd/krb5_util.c             |  6 +++---
 utils/gssd/svcgssd.c               |  4 ++--
 utils/gssd/svcgssd_mech2file.c     |  1 +
 utils/idmapd/Makefile.am           |  2 ++
 utils/idmapd/idmapd.c              |  4 ++--
 utils/mount/configfile.c           |  4 ++++
Quoted 9 lines
 utils/mount/mount_libmount.c       |  2 ++
 utils/mount/stropts.c              |  2 ++
 utils/mountd/svc_run.c             |  1 +
 utils/nfsdcltrack/sqlite.c         |  3 ++-
 utils/nfsidmap/Makefile.am         |  2 ++
 utils/nfsstat/nfsstat.c            |  4 +++-
 utils/statd/svc_run.c              |  1 +
 33 files changed, 90 insertions(+), 35 deletions(-)

Series committed...

steved.