7b76bb
From 80628047a6cc83f82e0c410a82b8f7facd9d50f2 Mon Sep 17 00:00:00 2001
7b76bb
From: Eric Blake <eblake@redhat.com>
7b76bb
Date: Wed, 14 Sep 2016 19:21:42 -0500
7b76bb
Subject: [PATCH] mountlist: include sysmacros.h for glibc
7b76bb
7b76bb
On Fedora rawhide (glibc 2.25), './gnulib-tool --test mountlist'
7b76bb
reports:
7b76bb
../../gllib/mountlist.c: In function 'read_file_system_list':
7b76bb
../../gllib/mountlist.c:534:13: warning: '__makedev_from_sys_types' is deprecated:
7b76bb
  In the GNU C Library, `makedev' is defined by <sys/sysmacros.h>.
7b76bb
  For historical compatibility, it is currently defined by
7b76bb
  <sys/types.h> as well, but we plan to remove this soon.
7b76bb
  To use `makedev', include <sys/sysmacros.h> directly.
7b76bb
  If you did not intend to use a system-defined macro `makedev',
7b76bb
  you should #undef it after including <sys/types.h>.
7b76bb
  [-Wdeprecated-declarations]
7b76bb
             me->me_dev = makedev (devmaj, devmin);
7b76bb
             ^~
7b76bb
In file included from /usr/include/features.h:397:0,
7b76bb
                 from /usr/include/sys/types.h:25,
7b76bb
                 from ./sys/types.h:28,
7b76bb
                 from ../../gllib/mountlist.h:23,
7b76bb
                 from ../../gllib/mountlist.c:20:
7b76bb
/usr/include/sys/sysmacros.h:89:1: note: declared here
7b76bb
 __SYSMACROS_DEFINE_MAKEDEV (__SYSMACROS_FST_IMPL_TEMPL)
7b76bb
 ^
7b76bb
7b76bb
Fix it by including the right headers.  We also need a fix to
7b76bb
autoconf's AC_HEADER_MAJOR, but that's a separate patch.
7b76bb
7b76bb
* m4/mountlist.m4 (gl_PREREQ_MOUTLIST_EXTRA): Include
7b76bb
AC_HEADER_MAJOR.
7b76bb
* lib/mountlist.c (includes): Use correct headers.
7b76bb
7b76bb
Signed-off-by: Eric Blake <eblake@redhat.com>
7b76bb
7b76bb
Upstream-commit: 4da63c5881f60f71999a943612da9112232b9161
7b76bb
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
7b76bb
---
7b76bb
 gl/lib/mountlist.c | 6 ++++++
7b76bb
 gl/m4/mountlist.m4 | 3 ++-
7b76bb
 2 files changed, 8 insertions(+), 1 deletion(-)
7b76bb
7b76bb
diff --git a/gl/lib/mountlist.c b/gl/lib/mountlist.c
7b76bb
index c3d2852..0b6f92e 100644
7b76bb
--- a/gl/lib/mountlist.c
7b76bb
+++ b/gl/lib/mountlist.c
7b76bb
@@ -37,6 +37,12 @@
7b76bb
 # include <sys/param.h>
7b76bb
 #endif
7b76bb
 
7b76bb
+#if MAJOR_IN_MKDEV
7b76bb
+# include <sys/mkdev.h>
7b76bb
+#elif MAJOR_IN_SYSMACROS
7b76bb
+# include <sys/sysmacros.h>
7b76bb
+#endif
7b76bb
+
7b76bb
 #if defined MOUNTED_GETFSSTAT   /* OSF_1 and Darwin1.3.x */
7b76bb
 # if HAVE_SYS_UCRED_H
7b76bb
 #  include <grp.h> /* needed on OSF V4.0 for definition of NGROUPS,
7b76bb
diff --git a/gl/m4/mountlist.m4 b/gl/m4/mountlist.m4
7b76bb
index ec58dc8..82b2dcb 100644
7b76bb
--- a/gl/m4/mountlist.m4
7b76bb
+++ b/gl/m4/mountlist.m4
7b76bb
@@ -1,4 +1,4 @@
7b76bb
-# serial 11
7b76bb
+# serial 12
7b76bb
 dnl Copyright (C) 2002-2006, 2009-2015 Free Software Foundation, Inc.
7b76bb
 dnl This file is free software; the Free Software Foundation
7b76bb
 dnl gives unlimited permission to copy and/or distribute it,
7b76bb
@@ -15,5 +15,6 @@ AC_DEFUN([gl_PREREQ_MOUNTLIST_EXTRA],
7b76bb
 [
7b76bb
   dnl Note gl_LIST_MOUNTED_FILE_SYSTEMS checks for mntent.h, not sys/mntent.h.
7b76bb
   AC_CHECK_HEADERS([sys/mntent.h])
7b76bb
+  AC_HEADER_MAJOR()dnl for use of makedev ()
7b76bb
   gl_FSTYPENAME
7b76bb
 ])
7b76bb
-- 
7b76bb
2.16.2
7b76bb