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

Emil Velikov emil.l.velikov at gmail.com
Tue Mar 21 10:43:04 UTC 2017


On 21 March 2017 at 07:20, Kenneth Graunke <kenneth at whitecape.org> 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.
>
> v2: Use the AC_HEADER_MAJOR defines to figure out the right header.
> ---
>  src/mesa/drivers/dri/i965/brw_performance_query.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c b/src/mesa/drivers/dri/i965/brw_performance_query.c
> index 2e04e091d29..b77a3904a2c 100644
> --- a/src/mesa/drivers/dri/i965/brw_performance_query.c
> +++ b/src/mesa/drivers/dri/i965/brw_performance_query.c
> @@ -42,6 +42,12 @@
>  #include <limits.h>
>  #include <dirent.h>
>
> +#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>
Please add a small comment - "Keep X above Y otherwise GCC Z will
throw a warning"

With that
Reviewed-by: Emil Velikov <emli.velikov at collabora.com>

Thanks
Emi


More information about the mesa-dev mailing list