* [PATCH libdrm] meson: don't use compiler.has_header
@ 2018-03-12 18:18 Dylan Baker
2018-03-13 14:49 ` Eric Engestrom
0 siblings, 1 reply; 5+ messages in thread
From: Dylan Baker @ 2018-03-12 18:18 UTC (permalink / raw)
To: dri-devel; +Cc: Dylan Baker
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@gmail.com>
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
---
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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH libdrm] meson: don't use compiler.has_header
2018-03-12 18:18 [PATCH libdrm] meson: don't use compiler.has_header Dylan Baker
@ 2018-03-13 14:49 ` Eric Engestrom
2018-03-13 14:54 ` [PATCH libdrm 1/2] meson: make it easy to add headers to check Eric Engestrom
0 siblings, 1 reply; 5+ messages in thread
From: Eric Engestrom @ 2018-03-13 14:49 UTC (permalink / raw)
To: Dylan Baker; +Cc: dri-devel
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@gmail.com>
> Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Nvm my comment on your mesa patch, you've done this already :)
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
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@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH libdrm 1/2] meson: make it easy to add headers to check
2018-03-13 14:49 ` Eric Engestrom
@ 2018-03-13 14:54 ` Eric Engestrom
2018-03-13 14:54 ` [PATCH libdrm 2/2] meson: detect alloca.h Eric Engestrom
0 siblings, 1 reply; 5+ messages in thread
From: Eric Engestrom @ 2018-03-13 14:54 UTC (permalink / raw)
To: dri-devel; +Cc: Dylan Baker
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
meson.build | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/meson.build b/meson.build
index f4c95394c52e65672f24..3a33928d02a6dce5f075 100644
--- a/meson.build
+++ b/meson.build
@@ -186,12 +186,11 @@ else
dep_rt = []
endif
dep_m = cc.find_library('m', required : false)
-if cc.compiles('#include <sys/sysctl.h>', name : 'sys/sysctl.h works')
- config.set10('HAVE_SYS_SYSCTL_H', true)
-endif
-if cc.compiles('#include <sys/select.h>', name : 'sys/select.h works')
- config.set10('HAVE_SYS_SELECT_H', true)
-endif
+foreach header : ['sys/sysctl.h', 'sys/select.h']
+ if cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header))
+ config.set10('HAVE_' + header.underscorify().to_upper(), true)
+ endif
+endforeach
if cc.has_header_symbol('sys/sysmacros.h', 'major')
config.set10('MAJOR_IN_SYSMACROS', true)
elif cc.has_header_symbol('sys/mkdev.h', 'major')
--
Cheers,
Eric
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH libdrm 2/2] meson: detect alloca.h
2018-03-13 14:54 ` [PATCH libdrm 1/2] meson: make it easy to add headers to check Eric Engestrom
@ 2018-03-13 14:54 ` Eric Engestrom
2018-03-13 18:38 ` Dylan Baker
0 siblings, 1 reply; 5+ messages in thread
From: Eric Engestrom @ 2018-03-13 14:54 UTC (permalink / raw)
To: dri-devel; +Cc: Dylan Baker
amdgpu makes use of it
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 3a33928d02a6dce5f075..f7986af9bb5259be5da5 100644
--- a/meson.build
+++ b/meson.build
@@ -186,7 +186,7 @@ else
dep_rt = []
endif
dep_m = cc.find_library('m', required : false)
-foreach header : ['sys/sysctl.h', 'sys/select.h']
+foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h']
if cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header))
config.set10('HAVE_' + header.underscorify().to_upper(), true)
endif
--
Cheers,
Eric
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH libdrm 2/2] meson: detect alloca.h
2018-03-13 14:54 ` [PATCH libdrm 2/2] meson: detect alloca.h Eric Engestrom
@ 2018-03-13 18:38 ` Dylan Baker
0 siblings, 0 replies; 5+ messages in thread
From: Dylan Baker @ 2018-03-13 18:38 UTC (permalink / raw)
To: Eric Engestrom, dri-devel
[-- Attachment #1.1: Type: text/plain, Size: 862 bytes --]
Quoting Eric Engestrom (2018-03-13 07:54:12)
> amdgpu makes use of it
>
> Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
> ---
> meson.build | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meson.build b/meson.build
> index 3a33928d02a6dce5f075..f7986af9bb5259be5da5 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -186,7 +186,7 @@ else
> dep_rt = []
> endif
> dep_m = cc.find_library('m', required : false)
> -foreach header : ['sys/sysctl.h', 'sys/select.h']
> +foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h']
> if cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header))
> config.set10('HAVE_' + header.underscorify().to_upper(), true)
> endif
> --
> Cheers,
> Eric
>
for the series:
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
[-- Attachment #1.2: signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
-----BEGIN PGP SIGNATURE-----
iHUEABYKAB0WIQRxxLdWILx1cItL2yVMlfqrPrBz7AUCWqgavwAKCRBMlfqrPrBz
7B0BAP9OWjg8h4qEScHGbdsfRbUhpBuiPVsAwZS77Og5hfeVKwD/ctrqQVB7aX/6
6kikuxnVOizkUaJx9A+fHJVP1WcwDw8=
=lvnZ
-----END PGP SIGNATURE-----
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-03-13 18:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-12 18:18 [PATCH libdrm] meson: don't use compiler.has_header Dylan Baker
2018-03-13 14:49 ` Eric Engestrom
2018-03-13 14:54 ` [PATCH libdrm 1/2] meson: make it easy to add headers to check Eric Engestrom
2018-03-13 14:54 ` [PATCH libdrm 2/2] meson: detect alloca.h Eric Engestrom
2018-03-13 18:38 ` Dylan Baker
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.