i965: Shut up major()/minor() warnings.
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 20 Mar 2017 23:03:07 +0000 (16:03 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 21 Mar 2017 21:10:17 +0000 (14:10 -0700)
Recent glibc generates this warning:

brw_performance_query.c:1648: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>.

    min = minor(sb.st_rdev);

So, include sys/sysmacros.h to shut up the warning.

v2: Use the AC_HEADER_MAJOR defines to figure out the right header
    (thanks to Jonathan Gray for helping me not break non-glibc systems)

Reviewed-by: Matt Turner <mattst88@gmail.com> [v1]
Reviewed-by: Emil Velikov <emli.velikov@collabora.com>
src/mesa/drivers/dri/i965/brw_performance_query.c

index 2e04e091d294a8029b7a3ef92b6b89d139de63cd..4a94e4b3cc2ccead244bc52409feb7b81d21d6f6 100644 (file)
 #include <limits.h>
 #include <dirent.h>
 
+/* put before sys/types.h to silence glibc warnings */
+#ifdef MAJOR_IN_MKDEV
+#include <sys/mkdev.h>
+#endif
+#ifdef MAJOR_IN_SYSMACROS
+#include <sys/sysmacros.h>
+#endif
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>