[PATCH 2/2] Replace 'sun' with '__sun'

Richard PALO richard at netbsd.org
Mon Nov 16 22:02:07 PST 2015


From: Richard PALO <richard at NetBSD.org>

Globally replace #ifdef and #if defined usage of 'sun' with '__sun'
such that strict ISO compiler modes such as -ansi or -std=c99 can be used.

Signed-off-by: Richard PALO <richard at NetBSD.org>
---
 hw/kdrive/src/kinput.c             |  2 +-
 hw/xfree86/common/xf86AutoConfig.c | 10 +++++-----
 hw/xfree86/common/xf86Globals.c    |  2 +-
 hw/xfree86/common/xf86Privstr.h    |  2 +-
 hw/xfree86/common/xf86cmap.c       |  2 +-
 hw/xfree86/loader/os.c             |  2 +-
 hw/xfree86/os-support/bus/Sbus.c   |  4 ++--
 hw/xfree86/os-support/xf86_OSlib.h | 22 +++++++++++-----------
 os/access.c                        |  8 ++++----
 os/backtrace.c                     |  2 +-
 os/io.c                            |  2 +-
 os/rpcauth.c                       |  2 +-
 xkb/xkbInit.c                      |  2 +-
 13 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 4bb9315..9685c77 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -34,7 +34,7 @@
 #endif
 #include <signal.h>
 #include <stdio.h>
-#ifdef sun
+#ifdef __sun
 #include <sys/file.h>           /* needed for FNONBLOCK & FASYNC */
 #endif
 
diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 6b8d0eb..e6ab900 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -45,7 +45,7 @@
 #include "xf86sbusBus.h"
 #endif
 
-#ifdef sun
+#ifdef __sun
 #include <sys/visual_io.h>
 #include <ctype.h>
 #endif
@@ -202,7 +202,7 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
 #ifdef XSERVER_PLATFORM_BUS
     i = xf86PlatformMatchDriver(matches, nmatches);
 #endif
-#ifdef sun
+#ifdef __sun
     /* Check for driver type based on /dev/fb type and if valid, use
        it instead of PCI bus probe results */
     if (xf86Info.consoleFd >= 0 && (i < (nmatches - 1))) {
@@ -271,7 +271,7 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
     matches[i++] = xnfstrdup("modesetting");
 #endif
 
-#if !defined(sun)
+#if !defined(__sun)
     /* Fallback to platform default frame buffer driver */
     if (i < (nmatches - 1)) {
 #if !defined(__linux__) && defined(__sparc__)
@@ -280,13 +280,13 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
         matches[i++] = xnfstrdup("fbdev");
 #endif
     }
-#endif                          /* !sun */
+#endif                          /* !__sun */
 
     /* Fallback to platform default hardware */
     if (i < (nmatches - 1)) {
 #if defined(__i386__) || defined(__amd64__) || defined(__hurd__)
         matches[i++] = xnfstrdup("vesa");
-#elif defined(__sparc__) && !defined(sun)
+#elif defined(__sparc__) && !defined(__sun)
         matches[i++] = xnfstrdup("sunffb");
 #endif
     }
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 93a35b8..86bf15d 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -98,7 +98,7 @@ xf86InfoRec xf86Info = {
     .vtno = -1,
     .lastEventTime = -1,
     .vtRequestsPending = FALSE,
-#ifdef sun
+#ifdef __sun
     .vtPendingNum = -1,
 #endif
     .dontVTSwitch = FALSE,
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
index cffa14d..2eefeaf 100644
--- a/hw/xfree86/common/xf86Privstr.h
+++ b/hw/xfree86/common/xf86Privstr.h
@@ -55,7 +55,7 @@ typedef struct {
     /* event handler part */
     int lastEventTime;
     Bool vtRequestsPending;
-#ifdef sun
+#ifdef __sun
     int vtPendingNum;
 #endif
     Bool dontVTSwitch;
diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c
index 704e353..ba0b277 100644
--- a/hw/xfree86/common/xf86cmap.c
+++ b/hw/xfree86/common/xf86cmap.c
@@ -29,7 +29,7 @@
 #include <xorg-config.h>
 #endif
 
-#if defined(_XOPEN_SOURCE) || defined(sun) && defined(__SVR4)
+#if defined(_XOPEN_SOURCE) || defined(__sun) && defined(__SVR4)
 #include <math.h>
 #else
 #define _XOPEN_SOURCE           /* to get prototype for pow on some systems */
diff --git a/hw/xfree86/loader/os.c b/hw/xfree86/loader/os.c
index e3a9ac4..8d03721 100644
--- a/hw/xfree86/loader/os.c
+++ b/hw/xfree86/loader/os.c
@@ -50,7 +50,7 @@
 #define OSNAME "openbsd"
 #elif defined(__GNU__)
 #define OSNAME "hurd"
-#elif defined(SVR4) && defined(sun)
+#elif defined(SVR4) && defined(__sun)
 #define OSNAME "solaris"
 #elif defined(SVR5)
 #define OSNAME "svr5"
diff --git a/hw/xfree86/os-support/bus/Sbus.c b/hw/xfree86/os-support/bus/Sbus.c
index 86b4d68..a526577 100644
--- a/hw/xfree86/os-support/bus/Sbus.c
+++ b/hw/xfree86/os-support/bus/Sbus.c
@@ -31,7 +31,7 @@
 #include <stdlib.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
-#ifdef sun
+#ifdef __sun
 #include <sys/utsname.h>
 #endif
 #include "xf86.h"
@@ -173,7 +173,7 @@ promIsP1275(void)
             break;
         }
     fclose(f);
-#elif defined(sun)
+#elif defined(__sun)
     struct utsname buffer;
 
     if ((uname(&buffer) >= 0) && !strcmp(buffer.machine, "sun4u"))
diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h
index c7b295a..5d78c66 100644
--- a/hw/xfree86/os-support/xf86_OSlib.h
+++ b/hw/xfree86/os-support/xf86_OSlib.h
@@ -84,7 +84,7 @@
 /* SYSV386 (SVR3, SVR4), including Solaris                                */
 /**************************************************************************/
 #if (defined(SYSV) || defined(SVR4)) && \
-    (defined(sun) || defined(__i386__))
+    (defined(__sun) || defined(__i386__))
 #include <sys/ioctl.h>
 #include <signal.h>
 #include <termio.h>
@@ -94,21 +94,21 @@
 #include <errno.h>
 
 #if defined(_NEED_SYSI86)
-#if !(defined (sun) && defined (SVR4))
+#if !(defined (__sun) && defined (SVR4))
 #include <sys/immu.h>
 #include <sys/region.h>
 #include <sys/proc.h>
 #endif
 #include <sys/tss.h>
 #include <sys/sysi86.h>
-#if defined(SVR4) && !defined(sun)
+#if defined(SVR4) && !defined(__sun)
 #include <sys/seg.h>
-#endif                          /* SVR4 && !sun */
+#endif                          /* SVR4 && !__sun */
 /* V86SC_IOPL was moved to <sys/sysi86.h> on Solaris 7 and later */
 #if !defined(V86SC_IOPL)        /* Solaris 7 or later? */
 #include <sys/v86.h>            /* Nope */
 #endif
-#if defined(sun) && (defined (__i386__) || defined(__i386) || defined(__x86))  && defined (SVR4)
+#if defined(__sun) && (defined (__i386__) || defined(__i386) || defined(__x86))  && defined (SVR4)
 #include <sys/psw.h>
 #endif
 #endif                          /* _NEED_SYSI86 */
@@ -122,14 +122,14 @@
 #include <sys/mmap.h>           /* MMAP driver header */
 #endif
 
-#if !defined(sun) || defined(HAVE_SYS_VT_H)
+#if !defined(__sun) || defined(HAVE_SYS_VT_H)
 #define HAS_USL_VTS
 #endif
-#if !defined(sun)
+#if !defined(__sun)
 #include <sys/emap.h>
 #endif
 #if   defined(HAS_USL_VTS)
-#if !defined(sun)
+#if !defined(__sun)
 #include <sys/at_ansi.h>
 #endif
 #include <sys/kd.h>
@@ -139,7 +139,7 @@ extern _X_HIDDEN void xf86VTAcquire(int);
 extern _X_HIDDEN void xf86VTRelease(int);
 #endif
 
-#if defined(sun)
+#if defined(__sun)
 #include <sys/fbio.h>
 extern _X_HIDDEN char xf86SolarisFbDev[PATH_MAX];
 
@@ -156,7 +156,7 @@ extern _X_HIDDEN char xf86SolarisFbDev[PATH_MAX];
 #define LED_NUM LED_NUM_LOCK
 #define LED_SCR LED_SCROLL_LOCK
 #define LED_COMP LED_COMPOSE
-#endif                          /* sun */
+#endif                          /* __sun */
 
 #if !defined(VT_ACKACQ)
 #define VT_ACKACQ 2
@@ -164,7 +164,7 @@ extern _X_HIDDEN char xf86SolarisFbDev[PATH_MAX];
 
 #if defined(SVR4)
 #include <sys/mman.h>
-#if !(defined(sun) && defined (SVR4))
+#if !(defined(__sun) && defined (SVR4))
 #define DEV_MEM "/dev/pmem"
 #endif
 #define CLEARDTR_SUPPORT
diff --git a/os/access.c b/os/access.c
index 2499a9f..10a48c3 100644
--- a/os/access.c
+++ b/os/access.c
@@ -112,7 +112,7 @@ SOFTWARE.
 
 #ifdef HAVE_GETPEERUCRED
 #include <ucred.h>
-#ifdef sun
+#ifdef __sun
 #include <zone.h>
 #endif
 #endif
@@ -162,7 +162,7 @@ SOFTWARE.
  * Test for Solaris commented out  --  TSI @ UQV  2003.06.13
  */
 #ifdef SIOCGLIFCONF
-/* #if defined(sun) */
+/* #if defined(__sun) */
 #define USE_SIOCGLIFCONF
 /* #endif */
 #endif
@@ -383,7 +383,7 @@ AccessUsingXdmcp(void)
     LocalHostEnabled = FALSE;
 }
 
-#if  defined(SVR4) && !defined(sun)  && defined(SIOCGIFCONF) && !defined(USE_SIOCGLIFCONF)
+#if  defined(SVR4) && !defined(__sun)  && defined(SIOCGIFCONF) && !defined(USE_SIOCGLIFCONF)
 
 /* Deal with different SIOCGIFCONF ioctl semantics on these OSs */
 
@@ -1145,7 +1145,7 @@ GetLocalClientCreds(ClientPtr client, LocalClientCredRec ** lccp)
     if (client == NULL)
         return -1;
     ci = ((OsCommPtr) client->osPrivate)->trans_conn;
-#if !(defined(sun) && defined(HAVE_GETPEERUCRED))
+#if !(defined(__sun) && defined(HAVE_GETPEERUCRED))
     /* Most implementations can only determine peer credentials for Unix
      * domain sockets - Solaris getpeerucred can work with a bit more, so
      * we just let it tell us if the connection type is supported or not
diff --git a/os/backtrace.c b/os/backtrace.c
index fd129ef..9e3e38e 100644
--- a/os/backtrace.c
+++ b/os/backtrace.c
@@ -155,7 +155,7 @@ xorg_backtrace(void)
 
 #else                           /* not glibc or glibc < 2.1 */
 
-#if defined(sun) && defined(__SVR4)
+#if defined(__sun) && defined(__SVR4)
 #define HAVE_PSTACK
 #endif
 
diff --git a/os/io.c b/os/io.c
index 96a243d..55644ea 100644
--- a/os/io.c
+++ b/os/io.c
@@ -368,7 +368,7 @@ ReadRequestFromClient(ClientPtr client)
                                  oci->size - oci->bufcnt);
         if (result <= 0) {
             if ((result < 0) && ETEST(errno)) {
-#if defined(SVR4) && defined(__i386__) && !defined(sun)
+#if defined(SVR4) && defined(__i386__) && !defined(__sun)
                 if (0)
 #endif
                 {
diff --git a/os/rpcauth.c b/os/rpcauth.c
index 413cc61..5680489 100644
--- a/os/rpcauth.c
+++ b/os/rpcauth.c
@@ -46,7 +46,7 @@ from The Open Group.
 
 #include <rpc/rpc.h>
 
-#ifdef sun
+#ifdef __sun
 /* <rpc/auth.h> only includes this if _KERNEL is #defined... */
 extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *);
 #endif
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 30e10bd..9c772f5 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -60,7 +60,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #define	LED_NUM		5
 #define	PHYS_LEDS	0x1f
 #else
-#ifdef sun
+#ifdef __sun
 #define LED_NUM		1
 #define	LED_SCROLL	2
 #define	LED_COMPOSE	3
-- 
2.6.3





More information about the xorg-devel mailing list