From 074947ee4be95f9b88558ab052e46cb0653a8a8f Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Wed, 7 Nov 2018 15:00:24 +0000 Subject: [PATCH] meson: always define whether headers exist Combined with -Wundef (added in 75758d2ccf & enforced in ba17673eed), this provides absolute safety against #ifdef typos. Signed-off-by: Eric Engestrom Reviewed-by: Emil Velikov --- Android.common.mk | 3 +++ amdgpu/amdgpu_cs.c | 2 +- meson.build | 2 +- tests/amdgpu/basic_tests.c | 2 +- tests/amdgpu/deadlock_tests.c | 2 +- tests/kms/kms-steal-crtc.c | 2 +- tests/kms/kms-universal-planes.c | 2 +- tests/modetest/modetest.c | 2 +- tests/vbltest/vbltest.c | 2 +- xf86drmMode.c | 2 +- 10 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Android.common.mk b/Android.common.mk index d0e5d559..37c2b23a 100644 --- a/Android.common.mk +++ b/Android.common.mk @@ -1,6 +1,9 @@ # XXX: Consider moving these to config.h analogous to autoconf. LOCAL_CFLAGS += \ -DMAJOR_IN_SYSMACROS=1 \ + -DHAVE_ALLOCA_H=0 \ + -DHAVE_SYS_SELECT_H=0 \ + -DHAVE_SYS_SYSCTL_H=0 \ -DHAVE_VISIBILITY=1 \ -fvisibility=hidden \ -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1 diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c index b4b7dcf3..1bd974f7 100644 --- a/amdgpu/amdgpu_cs.c +++ b/amdgpu/amdgpu_cs.c @@ -28,7 +28,7 @@ #include #include #include -#ifdef HAVE_ALLOCA_H +#if HAVE_ALLOCA_H # include #endif diff --git a/meson.build b/meson.build index 4468ac3d..ddcb8846 100644 --- a/meson.build +++ b/meson.build @@ -187,7 +187,7 @@ dep_m = cc.find_library('m', required : false) # FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the # includes when checking for headers. foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h'] - config.set('HAVE_' + header.underscorify().to_upper(), + config.set10('HAVE_' + header.underscorify().to_upper(), cc.compiles('#include \n#include <@0@>'.format(header), name : '@0@ works'.format(header))) endforeach if (cc.has_header_symbol('sys/sysmacros.h', 'major') and diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c index f5caf8d5..57496c82 100644 --- a/tests/amdgpu/basic_tests.c +++ b/tests/amdgpu/basic_tests.c @@ -30,7 +30,7 @@ #endif #include #include -#ifdef HAVE_ALLOCA_H +#if HAVE_ALLOCA_H # include #endif #include diff --git a/tests/amdgpu/deadlock_tests.c b/tests/amdgpu/deadlock_tests.c index d6eb35b1..a18d578f 100644 --- a/tests/amdgpu/deadlock_tests.c +++ b/tests/amdgpu/deadlock_tests.c @@ -24,7 +24,7 @@ #include #include #include -#ifdef HAVE_ALLOCA_H +#if HAVE_ALLOCA_H # include #endif diff --git a/tests/kms/kms-steal-crtc.c b/tests/kms/kms-steal-crtc.c index cd40758d..4d884c07 100644 --- a/tests/kms/kms-steal-crtc.c +++ b/tests/kms/kms-steal-crtc.c @@ -28,7 +28,7 @@ #include #include #include -#ifdef HAVE_SYS_SELECT_H +#if HAVE_SYS_SELECT_H #include #endif diff --git a/tests/kms/kms-universal-planes.c b/tests/kms/kms-universal-planes.c index 2163c987..1d793880 100644 --- a/tests/kms/kms-universal-planes.c +++ b/tests/kms/kms-universal-planes.c @@ -28,7 +28,7 @@ #include #include #include -#ifdef HAVE_SYS_SELECT_H +#if HAVE_SYS_SELECT_H #include #endif diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 09fd5651..b907ab36 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -51,7 +51,7 @@ #include #include #include -#ifdef HAVE_SYS_SELECT_H +#if HAVE_SYS_SELECT_H #include #endif #include diff --git a/tests/vbltest/vbltest.c b/tests/vbltest/vbltest.c index 48708d20..1c2b519e 100644 --- a/tests/vbltest/vbltest.c +++ b/tests/vbltest/vbltest.c @@ -33,7 +33,7 @@ #include #include #include -#ifdef HAVE_SYS_SELECT_H +#if HAVE_SYS_SELECT_H #include #endif diff --git a/xf86drmMode.c b/xf86drmMode.c index 207d7be9..0cf7992c 100644 --- a/xf86drmMode.c +++ b/xf86drmMode.c @@ -42,7 +42,7 @@ #include #include #include -#ifdef HAVE_SYS_SYSCTL_H +#if HAVE_SYS_SYSCTL_H #include #endif #include