Hi, On Thu, 2017-07-20 at 17:06 +0300, Dmitry V. Levin wrote: > I'm not sure what sys/mkdev.h does, but glibc's sys/sysmacros.h certainly > undefines major, minor, and makedev prior to defining its own versions of > these macros. > > My guess is that these undefs are not needed.
You are right. This makes the patch simpler. Now we only need to fix the AC_HEADER_MAJOR check. Cleaned up patch attached. Retested on rhel7 and fedora26. sys/mkdev.h is a solaris/bsd thing. I checked and they also undef the macros before (re)defining them. Although there they might not be defined in another header in the first place. Thanks, Mark
From 77a745abd88f278b4c29aadefb2f6c5d47bde5e6 Mon Sep 17 00:00:00 2001 From: Mark Wielaard <m...@klomp.org> Date: Wed, 19 Jul 2017 14:43:28 +0200 Subject: [PATCH] config: Detect major/minor warnings and include the correct system header. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glibc 2.25 introduced (really long and annoying) warnings for each use of the major/minor macros from the wrong header: lib/cpio.c: In function ‘rpmcpioHeaderWrite’: lib/cpio.c:245:13: warning: In the GNU C Library, "major" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "major", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "major", you should undefine it after including <sys/types.h>. dev = major(st->st_dev); SET_NUM_FIELD(hdr->devMajor, dev, field); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Adjust the configure check to correctly detect the header to include that doesn't produce those warning producing macros. Tested against RHEL7 (glibc 2.17) and Fedora 26 (glibc 2.25). Signed-off-by: Mark Wielaard <m...@klomp.org> --- configure.ac | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/configure.ac b/configure.ac index cc657ec..017a908 100644 --- a/configure.ac +++ b/configure.ac @@ -561,7 +561,15 @@ AM_ICONV dnl Checks for header files we can live without. AC_HEADER_STDC +dnl glibc and autoconf don't really play well together. +dnl glibc will produce a warning when including the wrong header. +dnl but still define major and minor. Causing us to include the header +dnl that produces a giant warning for each major/minor use. +dnl Use -Werror to work around that. +old_CFLAGS=$CFLAGS +CFLAGS="$CFLAGS -Werror" AC_HEADER_MAJOR +CFLAGS=$old_CFLAGS AC_STRUCT_DIRENT_D_TYPE AC_CHECK_HEADERS(limits.h) -- 1.8.3.1
_______________________________________________ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint