Re: [Mesa-dev] [Mesa-stable] [PATCH] meson: don't use compiler.has_header

2018-04-11 Thread Dylan Baker
Awesome, thanks Juan!

Quoting Juan A. Suarez Romero (2018-04-11 06:47:24)
> On Thu, 2018-03-29 at 11:20 -0700, Dylan Baker wrote:
> > This should be nominated for stable
> > 
> 
> Queued for next 18.0 stable release.
> 
> J.A.
> 
> 
> 
> > Quoting Dylan Baker (2018-03-12 11:23:23)
> > > 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 
> > > Signed-off-by: Dylan Baker 
> > > ---
> > >  meson.build | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/meson.build b/meson.build
> > > index 3c63f384381..51b470253f5 100644
> > > --- a/meson.build
> > > +++ b/meson.build
> > > @@ -912,7 +912,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major')
> > >  endif
> > >  
> > >  foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h']
> > > -  if cc.has_header(h)
> > > +  if cc.compiles('#include <@0@>'.format(h), name : '@0@ 
> > > works'.format(h))
> > >  pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
> > >endif
> > >  endforeach
> > > -- 
> > > 2.16.2
> > > 
> > 
> > ___
> > mesa-stable mailing list
> > mesa-sta...@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-stable


signature.asc
Description: signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [Mesa-stable] [PATCH] meson: don't use compiler.has_header

2018-04-11 Thread Juan A. Suarez Romero
On Thu, 2018-03-29 at 11:20 -0700, Dylan Baker wrote:
> This should be nominated for stable
> 

Queued for next 18.0 stable release.

J.A.



> Quoting Dylan Baker (2018-03-12 11:23:23)
> > 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 
> > Signed-off-by: Dylan Baker 
> > ---
> >  meson.build | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/meson.build b/meson.build
> > index 3c63f384381..51b470253f5 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -912,7 +912,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major')
> >  endif
> >  
> >  foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h']
> > -  if cc.has_header(h)
> > +  if cc.compiles('#include <@0@>'.format(h), name : '@0@ works'.format(h))
> >  pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
> >endif
> >  endforeach
> > -- 
> > 2.16.2
> > 
> 
> ___
> mesa-stable mailing list
> mesa-sta...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-stable
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev