[PATCH xserver 2/3] Use #ifdef instead of #if for features to make Meson easier.

Eric Anholt eric at anholt.net
Tue Apr 25 23:03:00 UTC 2017


We mostly use #ifdef throughout the tree, and this lets the generated
config.h files just be #define TOKEN instead of #define TOKEN 1.

Signed-off-by: Eric Anholt <eric at anholt.net>
---
 glamor/glamor_priv.h                    |  4 ++--
 hw/xfree86/common/xf86.h                |  2 +-
 hw/xfree86/drivers/modesetting/driver.c | 16 ++++++++--------
 hw/xfree86/loader/loadmod.c             |  4 ++--
 hw/xfree86/sdksyms.sh                   |  8 ++++----
 hw/xwayland/xwayland.c                  |  2 +-
 include/dixstruct.h                     |  2 +-
 include/os.h                            |  2 +-
 include/xserver_poll.h                  |  2 +-
 os/utils.c                              | 16 ++++++++--------
 10 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index 7b92f35705f4..a90879a7bbfd 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -38,7 +38,7 @@
 #endif
 
 #include <epoxy/gl.h>
-#if GLAMOR_HAS_GBM
+#ifdef GLAMOR_HAS_GBM
 #define MESA_EGL_NO_X11_HEADERS
 #include <epoxy/egl.h>
 #endif
@@ -342,7 +342,7 @@ typedef struct glamor_pixmap_private {
     GLuint pbo;
     RegionRec prepare_region;
     Bool prepared;
-#if GLAMOR_HAS_GBM
+#ifdef GLAMOR_HAS_GBM
     EGLImageKHR image;
 #endif
     /** block width of this large pixmap. */
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index f1a5bd6741bd..877b9e9e768e 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -35,7 +35,7 @@
 #ifndef _XF86_H
 #define _XF86_H
 
-#if HAVE_XORG_CONFIG_H
+#ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #elif HAVE_DIX_CONFIG_H
 #include <dix-config.h>
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index d7030e5c2117..a1451fe471e8 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -55,7 +55,7 @@
 #ifdef XSERVER_PLATFORM_BUS
 #include "xf86platformBus.h"
 #endif
-#if XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
 #include <pciaccess.h>
 #endif
 
@@ -227,7 +227,7 @@ check_outputs(int fd, int *count)
         *count = res->count_connectors;
 
     ret = res->count_connectors > 0;
-#if defined DRM_CAP_PRIME && GLAMOR_HAS_GBM_LINEAR
+#if defined(DRM_CAP_PRIME) && defined(GLAMOR_HAS_GBM_LINEAR)
     if (ret == FALSE) {
         uint64_t value = 0;
         if (drmGetCap(fd, DRM_CAP_PRIME, &value) == 0 &&
@@ -244,7 +244,7 @@ probe_hw(const char *dev, struct xf86_platform_device *platform_dev)
 {
     int fd;
 
-#if XF86_PDEV_SERVER_FD
+#ifdef XF86_PDEV_SERVER_FD
     if (platform_dev && (platform_dev->flags & XF86_PDEV_SERVER_FD)) {
         fd = xf86_platform_device_odev_attributes(platform_dev)->fd;
         if (fd == -1)
@@ -366,7 +366,7 @@ ms_setup_entity(ScrnInfoPtr scrn, int entity_num)
         pPriv->ptr = xnfcalloc(sizeof(modesettingEntRec), 1);
 }
 
-#if XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
 static Bool
 ms_pci_probe(DriverPtr driver,
              int entity_num, struct pci_device *dev, intptr_t match_data)
@@ -826,7 +826,7 @@ ms_get_drm_master_fd(ScrnInfoPtr pScrn)
         return TRUE;
     }
 
-#if XSERVER_PLATFORM_BUS
+#ifdef XSERVER_PLATFORM_BUS
     if (pEnt->location.type == BUS_PLATFORM) {
 #ifdef XF86_PDEV_SERVER_FD
         if (pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD)
@@ -844,7 +844,7 @@ ms_get_drm_master_fd(ScrnInfoPtr pScrn)
     }
     else
 #endif
-#if XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
     if (pEnt->location.type == BUS_PCI) {
         char *BusID = NULL;
         struct pci_device *PciInfo;
@@ -1018,7 +1018,7 @@ PreInit(ScrnInfoPtr pScrn, int flags)
             if (ms->drmmode.glamor)
                 pScrn->capabilities |= RR_Capability_SinkOffload;
         }
-#if GLAMOR_HAS_GBM_LINEAR
+#ifdef GLAMOR_HAS_GBM_LINEAR
         if (value & DRM_PRIME_CAP_EXPORT && ms->drmmode.glamor)
             pScrn->capabilities |= RR_Capability_SourceOutput | RR_Capability_SourceOffload;
 #endif
@@ -1189,7 +1189,7 @@ msEnableSharedPixmapFlipping(RRCrtcPtr crtc, PixmapPtr front, PixmapPtr back)
     if (ms->drmmode.reverse_prime_offload_mode)
         return FALSE;
 
-#if XSERVER_PLATFORM_BUS
+#ifdef XSERVER_PLATFORM_BUS
     if (pEnt->location.type == BUS_PLATFORM) {
         char *syspath =
             xf86_platform_device_odev_attributes(pEnt->location.id.plat)->
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 09aae0ea200b..5063500857a7 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -627,10 +627,10 @@ static const char *compiled_in_modules[] = {
     "extmod",
     "dri",
     "dri2",
-#if DRI3
+#ifdef DRI3
     "dri3",
 #endif
-#if PRESENT
+#ifdef PRESENT
     "present",
 #endif
     NULL
diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh
index cb2e5616b3da..9aa1eec4f792 100755
--- a/hw/xfree86/sdksyms.sh
+++ b/hw/xfree86/sdksyms.sh
@@ -58,7 +58,7 @@ cat > sdksyms.c << EOF
 #include "shmint.h"
 #endif
 #include "syncsdk.h"
-#if XINERAMA
+#ifdef XINERAMA
 # include "panoramiXsrv.h"
 # include "panoramiX.h"
 #endif
@@ -97,7 +97,7 @@ cat > sdksyms.c << EOF
 
 
 /* hw/xfree86/dri2/Makefile.am -- module */
-#if DRI2
+#ifdef DRI2
 # include "dri2.h"
 #endif
 
@@ -131,7 +131,7 @@ cat > sdksyms.c << EOF
 #include "xf86str.h"
 #include "xf86Xinput.h"
 #include "xisb.h"
-#if XV
+#ifdef XV
 # include "xf86xv.h"
 # include "xf86xvmc.h"
 # include "xf86xvpriv.h"
@@ -189,7 +189,7 @@ cat > sdksyms.c << EOF
 
 
 /* hw/xfree86/dri/Makefile.am -- module */
-#if XF86DRI
+#ifdef XF86DRI
 # include "dri.h"
 # include "sarea.h"
 # include "dristruct.h"
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index ed6003565e23..9cb4954e9e6f 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -580,7 +580,7 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
     region = DamageRegion(xwl_window->damage);
     pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window);
 
-#if GLAMOR_HAS_GBM
+#ifdef GLAMOR_HAS_GBM
     if (xwl_screen->glamor)
         buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap);
     else
diff --git a/include/dixstruct.h b/include/dixstruct.h
index 21a6b8a8d167..70f87959ea39 100644
--- a/include/dixstruct.h
+++ b/include/dixstruct.h
@@ -132,7 +132,7 @@ extern long SmartScheduleTime;
 extern long SmartScheduleInterval;
 extern long SmartScheduleSlice;
 extern long SmartScheduleMaxSlice;
-#if HAVE_SETITIMER
+#ifdef HAVE_SETITIMER
 extern Bool SmartScheduleSignalEnable;
 #else
 #define SmartScheduleSignalEnable FALSE
diff --git a/include/os.h b/include/os.h
index aa231f55072e..fb09d00c7ab2 100644
--- a/include/os.h
+++ b/include/os.h
@@ -466,7 +466,7 @@ AccessUsingXdmcp(void);
 extern _X_EXPORT void
 DefineSelf(int /*fd */ );
 
-#if XDMCP
+#ifdef XDMCP
 extern _X_EXPORT void
 AugmentSelf(void *from, int len);
 
diff --git a/include/xserver_poll.h b/include/xserver_poll.h
index 110d30cc742c..5a42307df4fe 100644
--- a/include/xserver_poll.h
+++ b/include/xserver_poll.h
@@ -27,7 +27,7 @@
 #error must inclue dix-config.h to use xserver_poll.h
 #endif
 
-#if HAVE_POLL
+#ifdef HAVE_POLL
 #include <poll.h>
 #define xserver_poll(fds, nfds, timeout) poll(fds, nfds, timeout)
 #else
diff --git a/os/utils.c b/os/utils.c
index 3f8bac5c64e5..cb2aea5da5b5 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1008,7 +1008,7 @@ ProcessCommandLine(int argc, char *argv[])
 #endif
         else if (strcmp(argv[i], "-dumbSched") == 0) {
             InputThreadEnable = FALSE;
-#if HAVE_SETITIMER
+#ifdef HAVE_SETITIMER
             SmartScheduleSignalEnable = FALSE;
 #endif
         }
@@ -1210,7 +1210,7 @@ XNFstrdup(const char *s)
 void
 SmartScheduleStopTimer(void)
 {
-#if HAVE_SETITIMER
+#ifdef HAVE_SETITIMER
     struct itimerval timer;
 
     if (!SmartScheduleSignalEnable)
@@ -1226,7 +1226,7 @@ SmartScheduleStopTimer(void)
 void
 SmartScheduleStartTimer(void)
 {
-#if HAVE_SETITIMER
+#ifdef HAVE_SETITIMER
     struct itimerval timer;
 
     if (!SmartScheduleSignalEnable)
@@ -1239,7 +1239,7 @@ SmartScheduleStartTimer(void)
 #endif
 }
 
-#if HAVE_SETITIMER
+#ifdef HAVE_SETITIMER
 static void
 SmartScheduleTimer(int sig)
 {
@@ -1287,7 +1287,7 @@ SmartSchedulePause(void)
 void
 SmartScheduleInit(void)
 {
-#if HAVE_SETITIMER
+#ifdef HAVE_SETITIMER
     if (SmartScheduleEnable() < 0) {
         perror("sigaction for smart scheduler");
         SmartScheduleSignalEnable = FALSE;
@@ -1438,7 +1438,7 @@ Popen(const char *command, const char *type)
     }
 
     /* Ignore the smart scheduler while this is going on */
-#if HAVE_SETITIMER
+#ifdef HAVE_SETITIMER
     if (SmartSchedulePause() < 0) {
         close(pdes[0]);
         close(pdes[1]);
@@ -1453,7 +1453,7 @@ Popen(const char *command, const char *type)
         close(pdes[0]);
         close(pdes[1]);
         free(cur);
-#if HAVE_SETITIMER
+#ifdef HAVE_SETITIMER
         if (SmartScheduleEnable() < 0)
             perror("signal");
 #endif
@@ -1630,7 +1630,7 @@ Pclose(void *iop)
     /* allow EINTR again */
     OsReleaseSignals();
 
-#if HAVE_SETITIMER
+#ifdef HAVE_SETITIMER
     if (SmartScheduleEnable() < 0) {
         perror("signal");
         return -1;
-- 
2.11.0



More information about the xorg-devel mailing list