[PATCH xserver 2/2] Replace all checks for 'linux' macro with '__linux__'

Julien Cristau jcristau at debian.org
Thu May 11 06:42:16 UTC 2017


gcc -std=c99 does not define the former, and it's a horrible namespace
confusion anyway.

Signed-off-by: Julien Cristau <jcristau at debian.org>
---
 hw/xfree86/common/compiler.h           | 14 +++++++-------
 hw/xfree86/common/xf86Config.c         |  2 +-
 hw/xfree86/common/xf86Configure.c      |  2 +-
 hw/xfree86/common/xf86Init.c           |  2 +-
 hw/xfree86/common/xf86str.h            |  2 +-
 hw/xfree86/os-support/bus/Pci.h        |  4 ++--
 hw/xfree86/os-support/bus/Sbus.c       |  2 +-
 hw/xfree86/os-support/bus/xf86Sbus.h   |  2 +-
 hw/xfree86/os-support/linux/lnx_agp.c  |  6 +++---
 hw/xfree86/os-support/misc/SlowBcopy.c |  2 +-
 10 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 5a1fdac96f..eea29dfb52 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -98,9 +98,9 @@
 #if defined(DO_PROTOTYPES)
 #if !defined(__arm__)
 #if !defined(__sparc__) && !defined(__arm32__) && !defined(__nds32__) \
-      && !(defined(__alpha__) && defined(linux)) \
-      && !(defined(__ia64__) && defined(linux)) \
-      && !(defined(__mips64) && defined(linux)) \
+      && !(defined(__alpha__) && defined(__linux__)) \
+      && !(defined(__ia64__) && defined(__linux__)) \
+      && !(defined(__mips64) && defined(__linux__)) \
 
 extern _X_EXPORT void outb(unsigned short, unsigned char);
 extern _X_EXPORT void outw(unsigned short, unsigned short);
@@ -215,7 +215,7 @@ extern _X_EXPORT void xf86WriteMmio32Le (void *, unsigned long, unsigned int);
 #ifdef __GNUC__
 #if defined(__alpha__)
 
-#ifdef linux
+#ifdef __linux__
 /* for Linux on Alpha, we use the LIBC _inx/_outx routines */
 /* note that the appropriate setup via "ioperm" needs to be done */
 /*  *before* any inx/outx is done. */
@@ -263,7 +263,7 @@ inl(unsigned long port)
     return _inl(port);
 }
 
-#endif                          /* linux */
+#endif                          /* __linux__ */
 
 #if (defined(__FreeBSD__) || defined(__OpenBSD__)) \
       && !defined(DO_PROTOTYPES)
@@ -570,7 +570,7 @@ inl(unsigned PORT_SIZE port)
 }
 
 #if defined(__mips__)
-#ifdef linux                    /* don't mess with other OSs */
+#ifdef __linux__                    /* don't mess with other OSs */
 #if X_BYTE_ORDER == X_BIG_ENDIAN
 static __inline__ unsigned int
 xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset)
@@ -594,7 +594,7 @@ xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
                          :"r"(val), "r"(addr));
 }
 #endif
-#endif                          /* !linux */
+#endif                          /* !__linux__ */
 #endif                          /* __mips__ */
 
 #elif defined(__powerpc__)
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index c2b522a184..fa04a3f119 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -868,7 +868,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
 
     /* when forcing input devices, we use kbd. otherwise evdev, so use the
      * evdev rules set. */
-#if defined(linux)
+#if defined(__linux__)
     if (!xf86Info.forceInputDevices)
         rules = "evdev";
     else
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 668a55151a..5f9643a52d 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -61,7 +61,7 @@ static Bool foundMouse = FALSE;
 #if   defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
 static const char *DFLT_MOUSE_DEV = "/dev/sysmouse";
 static const char *DFLT_MOUSE_PROTO = "auto";
-#elif defined(linux)
+#elif defined(__linux__)
 static const char *DFLT_MOUSE_DEV = "/dev/input/mice";
 static const char *DFLT_MOUSE_PROTO = "auto";
 #elif defined(WSCONS_SUPPORT)
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index d0bd6e95bb..994b63b430 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -183,7 +183,7 @@ xf86PrintBanner(void)
             xf86ErrorFVerb(0, "Current Operating System: %s %s %s %s %s\n",
                            name.sysname, name.nodename, name.release,
                            name.version, name.machine);
-#ifdef linux
+#ifdef __linux__
             do {
                 char buf[80];
                 int fd = open("/proc/cmdline", O_RDONLY);
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index 1da66e2dd0..edd91c745a 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -249,7 +249,7 @@ typedef struct _DriverRec {
  */
 
 /* Tolerate prior #include <linux/input.h> */
-#if defined(linux)
+#if defined(__linux__)
 #undef BUS_NONE
 #undef BUS_PCI
 #undef BUS_SBUS
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index 776bb637ce..1921e0282c 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -111,7 +111,7 @@
 /*
  * Global Definitions
  */
-#if (defined(__alpha__) || defined(__ia64__)) && defined (linux)
+#if (defined(__alpha__) || defined(__ia64__)) && defined (__linux__)
 #define PCI_DOM_MASK	0x01fful
 #else
 #define PCI_DOM_MASK 0x0ffu
@@ -135,7 +135,7 @@
 #define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu)
 #define PCI_TAG_NO_DOMAIN(tag) ((tag) & 0x00ffff00u)
 
-#if defined(linux)
+#if defined(__linux__)
 #define osPciInit(x) do {} while (0)
 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
 	defined(__OpenBSD__) || defined(__NetBSD__) || \
diff --git a/hw/xfree86/os-support/bus/Sbus.c b/hw/xfree86/os-support/bus/Sbus.c
index a5265770c3..cb14368f88 100644
--- a/hw/xfree86/os-support/bus/Sbus.c
+++ b/hw/xfree86/os-support/bus/Sbus.c
@@ -157,7 +157,7 @@ promSetNode(sbusPromNodePtr pnode)
 static void
 promIsP1275(void)
 {
-#ifdef linux
+#ifdef __linux__
     FILE *f;
     char buffer[1024];
 
diff --git a/hw/xfree86/os-support/bus/xf86Sbus.h b/hw/xfree86/os-support/bus/xf86Sbus.h
index 8a10d64fe9..d702e4e6c3 100644
--- a/hw/xfree86/os-support/bus/xf86Sbus.h
+++ b/hw/xfree86/os-support/bus/xf86Sbus.h
@@ -28,7 +28,7 @@
 #ifndef _XF86_SBUS_H
 #define _XF86_SBUS_H
 
-#if defined(linux)
+#if defined(__linux__)
 #include <asm/types.h>
 #include <linux/fb.h>
 #include <asm/fbio.h>
diff --git a/hw/xfree86/os-support/linux/lnx_agp.c b/hw/xfree86/os-support/linux/lnx_agp.c
index 2a28c6af83..e47bbfa1aa 100644
--- a/hw/xfree86/os-support/linux/lnx_agp.c
+++ b/hw/xfree86/os-support/linux/lnx_agp.c
@@ -17,7 +17,7 @@
 #include "xf86_OSlib.h"
 #include "xf86OSpriv.h"
 
-#if defined(linux)
+#if defined(__linux__)
 #include <asm/ioctl.h>
 #include <linux/agpgart.h>
 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
@@ -91,7 +91,7 @@ GARTInit(int screenNum)
     }
     xf86ReleaseGART(-1);
 
-#if defined(linux)
+#if defined(__linux__)
     /* Per Dave Jones, every effort will be made to keep the
      * agpgart interface backwards compatible, so allow all
      * future versions.
@@ -196,7 +196,7 @@ xf86ReleaseGART(int screenNum)
          * to give up access to the GART, but not to remove any
          * allocations.
          */
-#if !defined(linux)
+#if !defined(__linux__)
         if (screenNum == -1)
 #endif
         {
diff --git a/hw/xfree86/os-support/misc/SlowBcopy.c b/hw/xfree86/os-support/misc/SlowBcopy.c
index 4f4881ce2a..9d82c71bfc 100644
--- a/hw/xfree86/os-support/misc/SlowBcopy.c
+++ b/hw/xfree86/os-support/misc/SlowBcopy.c
@@ -57,7 +57,7 @@ xf86SlowBcopy(unsigned char *src, unsigned char *dst, int len)
 
 #ifdef __alpha__
 
-#ifdef linux
+#ifdef __linux__
 
 unsigned long _bus_base(void);
 
-- 
2.11.0



More information about the xorg-devel mailing list