Include sys/sysmacros.h for major and minor macros (#776173)

Glibc 2.25 is deprecating <sys/types.h> including <sys/sysmacros.h>.
    https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=dbab6577c6684c62bd2521c1c29dc25c3cac966f
    Deprecate inclusion of <sys/sysmacros.h> by <sys/types.h>

Building on Fedora Rawhide with Glibc 2.24.90 produces these warnings:

    BlockSpecial.cc:64: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>.
       m_major = major( sb.st_rdev );
                 ^~~~~~~~~~~~~~~~~~~~

    BlockSpecial.cc:65:13: warning: In the GNU C Library, "minor" 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 "minor", include <sys/sysmacros.h>
     directly. If you did not intend to use a system-defined macro
     "minor", you should undefine it after including <sys/types.h>.
       m_minor = minor( sb.st_rdev );
                 ^~~~~~~~~~~~~~~~~~~~

Code needing major and minor macros should include <sys/sysmacros.h>
directly.  As both Glibc and musl-libc have always provided this header
and GParted is a Linux only application, just always include the header
and don't bother with an autoconf check for its existence.

Bug 776173 - Missing sys/sysmacros.h #include, needed for experimental
             glibc versions
This commit is contained in:
Michał Górny 2016-12-16 17:22:57 +01:00 committed by Mike Fleetwood
parent 6cae7b3795
commit e4819fdd45
1 changed files with 1 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include <glibmm/ustring.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/sysmacros.h>
#include <unistd.h>
#include <map>