Re: [PATCH libdrm] meson: don't use compiler.has_header

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

 



On Monday, 2018-03-12 11:18:27 -0700, Dylan Baker wrote:
> Meson's compiler.has_header is completely useless, it only checks that a
> header exists, not whether it's usable. This creates problems if a
> header contains a conditional #error declaration, like so:
> 
> > #if __x86_64__
> > # error "Doesn't work with x86_64!"
> > #endif
> 
> Compiler.has_header will return true in this case, even when compiling
> for x86_64. This is useless.
> 
> Instead, we'll do a compile check so that any #error declarations will
> be treated as errors, and compilation will work.
> 
> Fixes compilation on x32 architecture.
> 
> Gentoo Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=649746
> meson bug: https://github.com/mesonbuild/meson/issues/2246
> CC: Matt Turner <mattst88@xxxxxxxxx>
> Signed-off-by: Dylan Baker <dylan.c.baker@xxxxxxxxx>

Nvm my comment on your mesa patch, you've done this already :)

Reviewed-by: Eric Engestrom <eric.engestrom@xxxxxxxxxx>

Sending a couple patches on this bit of the code, they'll be based on
top of this patch.

> ---
>  meson.build | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index df6f2bd2..a0c79e30 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -186,10 +186,10 @@ else
>    dep_rt = []
>  endif
>  dep_m = cc.find_library('m', required : false)
> -if cc.has_header('sys/sysctl.h')
> +if cc.compiles('#include <sys/sysctl.h>', name : 'sys/sysctl.h works')
>    config.set10('HAVE_SYS_SYSCTL_H', true)
>  endif
> -if cc.has_header('sys/select.h')
> +if cc.compiles('#include <sys/select.h>', name : 'sys/select.h works')
>    config.set10('HAVE_SYS_SELECT_H', true)
>  endif
>  if cc.has_header_symbol('sys/sysmacros.h', 'major')
> -- 
> 2.16.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux