From 18603622034c99260db690e091b23cfae43f84d8 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sat, 29 Jul 2017 13:45:21 -0700 Subject: [PATCH] linux: update header used for `major` macro Newer versions of glibc indicate that they intend to move the `major` macro from `sys/types.h` to `sys/sysmacros.h`. Add a check for the header and include that earlier to ensure that the macro is provided by the newer header when available/possible. This avoids an unnecessary warning from the system headers. --- CMakeLists.txt | 1 + cmake/config.h.in | 3 +++ os/linux_base.h | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f34e5146..9a75fa729 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,6 +159,7 @@ check_include_files("sys/cdefs.h" HAVE_SYS_CDEFS_H) check_include_files("sys/guarded.h" HAVE_SYS_GUARDED_H) check_include_files("sys/stat.h" HAVE_SYS_STAT_H) check_include_files("sys/types.h" HAVE_SYS_TYPES_H) +check_include_files("sys/sysmacros.h" HAVE_SYS_SYSMACROS_H) check_include_files("unistd.h" HAVE_UNISTD_H) check_include_files("objc/objc-internal.h" HAVE_OBJC) diff --git a/cmake/config.h.in b/cmake/config.h.in index 6696e9863..3a3245f9a 100644 --- a/cmake/config.h.in +++ b/cmake/config.h.in @@ -188,6 +188,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine01 HAVE_SYS_TYPES_H +/* Define to 1 if you have the header file. */ +#cmakedefine01 HAVE_SYS_SYSMACROS_H + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_TARGETCONDITIONALS_H diff --git a/os/linux_base.h b/os/linux_base.h index c8b9cad7c..f1e72bf09 100644 --- a/os/linux_base.h +++ b/os/linux_base.h @@ -13,6 +13,11 @@ #ifndef __OS_LINUX_BASE__ #define __OS_LINUX_BASE__ +#include + +#if HAVE_SYS_SYSMACROS_H +#include +#endif #include #if HAVE_SYS_CDEFS_H