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



commit e4819fdd459d812f06ac30bfe577258d6fab7684
Author: Michał Górny <mgorny gentoo org>
Date:   Fri Dec 16 17:22:57 2016 +0100

    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

 src/BlockSpecial.cc |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/src/BlockSpecial.cc b/src/BlockSpecial.cc
index 22062cf..8f6f568 100644
--- a/src/BlockSpecial.cc
+++ b/src/BlockSpecial.cc
@@ -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>
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]