[Mesa-dev] [PATCH] i965: Shut up major()/minor() warnings.

Jonathan Gray jsg at jsg.id.au
Tue Mar 21 04:23:55 UTC 2017


On Mon, Mar 20, 2017 at 04:05:04PM -0700, Kenneth Graunke wrote:
> 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.

This header is only present on glibc so it should be gated by an ifdef
or it will break all other systems.

minor()/major() are documented as needing sys/types.h and there is no
sys/sysmacro.h on OpenBSD for instance.

> ---
>  src/mesa/drivers/dri/i965/brw_performance_query.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c b/src/mesa/drivers/dri/i965/brw_performance_query.c
> index 2e04e091d29..17e0d6f0cdf 100644
> --- a/src/mesa/drivers/dri/i965/brw_performance_query.c
> +++ b/src/mesa/drivers/dri/i965/brw_performance_query.c
> @@ -42,6 +42,7 @@
>  #include <limits.h>
>  #include <dirent.h>
>  
> +#include <sys/sysmacros.h>
>  #include <sys/types.h>
>  #include <sys/stat.h>
>  #include <fcntl.h>
> -- 
> 2.12.0
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list