aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Nazar <nazard@nazar.ca>2020-07-14 13:49:56 -0400
committerSteve Dickson <steved@redhat.com>2020-07-14 14:26:42 -0400
commitb8092b05b64b0bef9d6226814e341e619848a9c6 (patch)
tree737b7545d445cb95b29d910eec4d3cfe6cda69d8
parentc86594575ba7888125dade90a8793650a1fbfdb0 (diff)
downloadnfs-utils-b8092b05b64b0bef9d6226814e341e619848a9c6.tar.gz
Fix various clang warnings.
Signed-off-by: Doug Nazar <nazard@nazar.ca> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--configure.ac6
-rw-r--r--support/include/xcommon.h2
-rw-r--r--utils/mount/network.c4
-rw-r--r--utils/mount/stropts.c2
-rw-r--r--utils/mountd/cache.c2
5 files changed, 7 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac
index 942f3c05..dbb795f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -638,13 +638,12 @@ my_am_cflags="\
-Werror=parentheses \
-Werror=aggregate-return \
-Werror=unused-result \
- -Wno-cast-function-type \
-fno-strict-aliasing \
"
AC_DEFUN([CHECK_CCSUPPORT], [
my_save_cflags="$CFLAGS"
- CFLAGS=$1
+ CFLAGS="-Werror $1"
AC_MSG_CHECKING([whether CC supports $1])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])]
@@ -658,9 +657,10 @@ CHECK_CCSUPPORT([-Werror=format-overflow=2], [flg1])
CHECK_CCSUPPORT([-Werror=int-conversion], [flg2])
CHECK_CCSUPPORT([-Werror=incompatible-pointer-types], [flg3])
CHECK_CCSUPPORT([-Werror=misleading-indentation], [flg4])
+CHECK_CCSUPPORT([-Wno-cast-function-type], [flg5])
AX_GCC_FUNC_ATTRIBUTE([format])
-AC_SUBST([AM_CFLAGS], ["$my_am_cflags $flg1 $flg2 $flg3 $flg4"])
+AC_SUBST([AM_CFLAGS], ["$my_am_cflags $flg1 $flg2 $flg3 $flg4 $flg5"])
# Make sure that $ACLOCAL_FLAGS are used during a rebuild
AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \$(ACLOCAL_FLAGS)"])
diff --git a/support/include/xcommon.h b/support/include/xcommon.h
index 30b0403b..efde83c9 100644
--- a/support/include/xcommon.h
+++ b/support/include/xcommon.h
@@ -7,7 +7,7 @@
*/
#ifndef _XMALLOC_H
-#define _MALLOC_H
+#define _XMALLOC_H
#ifdef HAVE_CONFIG_H
#include <config.h>
diff --git a/utils/mount/network.c b/utils/mount/network.c
index 6ac913d9..d9c0b513 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -1268,14 +1268,14 @@ nfs_nfs_program(struct mount_options *options, unsigned long *program)
int
nfs_nfs_version(char *type, struct mount_options *options, struct nfs_version *version)
{
- char *version_key, *version_val, *cptr;
+ char *version_key, *version_val = NULL, *cptr;
int i, found = 0;
version->v_mode = V_DEFAULT;
for (i = 0; nfs_version_opttbl[i]; i++) {
if (po_contains_prefix(options, nfs_version_opttbl[i],
- &version_key) == PO_FOUND) {
+ &version_key) == PO_FOUND) {
found++;
break;
}
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 901f995a..91a976b4 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -1094,9 +1094,7 @@ static int nfsmount_fg(struct nfsmount_info *mi)
if (nfs_try_mount(mi))
return EX_SUCCESS;
-#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
if (errno == EBUSY && is_mountpoint(mi->node)) {
-#pragma GCC diagnostic warning "-Wdiscarded-qualifiers"
/*
* EBUSY can happen when mounting a filesystem that
* is already mounted or when the context= are
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 6cba2883..ea740672 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -57,7 +57,7 @@ enum nfsd_fsid {
};
#undef is_mountpoint
-static int is_mountpoint(char *path)
+static int is_mountpoint(const char *path)
{
return check_is_mountpoint(path, nfsd_path_lstat);
}