Linux: Must use "__linux__" instead of "PLATFORM_LINUX".
authorIan Elliott <ian@lunarg.com>
Thu, 26 Feb 2015 21:34:52 +0000 (14:34 -0700)
committerCourtney Goeltzenleuchter <courtney@LunarG.com>
Tue, 3 Mar 2015 00:21:11 +0000 (17:21 -0700)
There are some places (e.g. glave) where PLATFORM_LINUX is #define'd, but
normally we need to rely on "__linux__", which is #define'd by the compiler
(i.e. we can rely on it being there).

include/xglLayer.h
xgl-generate.py
xgl-layer-generate.py

index 6a81c90..d6a7fbb 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "xgl.h"
 #include "xglDbg.h"
-#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+#if defined(__linux__) || defined(XCB_NVIDIA)
 #include "xglWsiX11Ext.h"
 #endif
 #if defined(__GNUC__) && __GNUC__ >= 4
@@ -149,7 +149,7 @@ typedef struct _XGL_LAYER_DISPATCH_TABLE
     xglDbgSetDeviceOptionType DbgSetDeviceOption;
     xglCmdDbgMarkerBeginType CmdDbgMarkerBegin;
     xglCmdDbgMarkerEndType CmdDbgMarkerEnd;
-#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)
+#if defined(__linux__) || defined(XCB_NVIDIA)
     xglWsiX11AssociateConnectionType WsiX11AssociateConnection;
     xglWsiX11GetMSCType WsiX11GetMSC;
     xglWsiX11CreatePresentableImageType WsiX11CreatePresentableImage;
index f4dd548..44ba04c 100755 (executable)
@@ -121,7 +121,7 @@ class LoaderEntrypointsSubcommand(Subcommand):
             if not self._is_dispatchable(proto):
                 continue
             if 'WsiX11AssociateConnection' == proto.name:
-                funcs.append("#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)")
+                funcs.append("#if defined(__linux__) || defined(XCB_NVIDIA)")
             decl = proto.c_func(prefix="xgl", attr="XGLAPI")
             stmt = "(*disp)->%s" % proto.c_call()
             if proto.name == "CreateDevice":
@@ -265,7 +265,7 @@ class DispatchTableOpsSubcommand(Subcommand):
         stmts = []
         for proto in self.protos:
             if 'WsiX11AssociateConnection' == proto.name:
-                stmts.append("#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)")
+                stmts.append("#if defined(__linux__) || defined(XCB_NVIDIA)")
             if proto.name == "GetProcAddr":
                 stmts.append("table->%s = gpa; /* direct assignment */" %
                         proto.name)
@@ -291,7 +291,7 @@ class DispatchTableOpsSubcommand(Subcommand):
         lookups = []
         for proto in self.protos:
             if 'WsiX11AssociateConnection' == proto.name:
-                lookups.append("#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)")
+                lookups.append("#if defined(__linux__) || defined(XCB_NVIDIA)")
             lookups.append("if (!strcmp(name, \"%s\"))" % (proto.name))
             lookups.append("    return (void *) table->%s;"
                     % (proto.name))
@@ -367,7 +367,7 @@ class IcdGetProcAddrSubcommand(IcdDummyEntrypointsSubcommand):
         lookups = []
         for proto in self.protos:
             if 'WsiX11AssociateConnection' == proto.name:
-                lookups.append("#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)")
+                lookups.append("#if defined(__linux__) || defined(XCB_NVIDIA)")
             lookups.append("if (!strcmp(%s, \"%s\"))" %
                     (gpa_pname, proto.name))
             lookups.append("    return (%s) %s%s;" %
@@ -412,7 +412,7 @@ class LayerInterceptProcSubcommand(Subcommand):
                 continue
 
             if 'WsiX11AssociateConnection' == proto.name:
-                lookups.append("#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)")
+                lookups.append("#if defined(__linux__) || defined(XCB_NVIDIA)")
             lookups.append("if (!strcmp(name, \"%s\"))" % proto.name)
             lookups.append("    return (%s) %s%s;" %
                     (self.gpa.ret, self.prefix, proto.name))
index aa3832d..6cb2bef 100755 (executable)
@@ -196,7 +196,7 @@ class Subcommand(object):
                         ret_val = "XGL_RESULT result = "
                         stmt = "    return result;\n"
                     if 'WsiX11AssociateConnection' == proto.name:
-                        funcs.append("#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)")
+                        funcs.append("#if defined(__linux__) || defined(XCB_NVIDIA)")
                     if proto.name == "EnumerateLayers":
                         c_call = proto.c_call().replace("(" + proto.params[0].name, "((XGL_PHYSICAL_GPU)gpuw->nextObject", 1)
                         funcs.append('%s%s\n'
@@ -370,7 +370,7 @@ class Subcommand(object):
                                     #log_func += '\n        fflush(stdout);'
                                 log_func += '\n    }'
                     if 'WsiX11AssociateConnection' == proto.name:
-                        funcs.append("#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)")
+                        funcs.append("#if defined(__linux__) || defined(XCB_NVIDIA)")
                     if proto.name == "EnumerateLayers":
                         c_call = proto.c_call().replace("(" + proto.params[0].name, "((XGL_PHYSICAL_GPU)gpuw->nextObject", 1)
                         funcs.append('%s%s\n'
@@ -519,7 +519,7 @@ class Subcommand(object):
                                     log_func += '\n        fflush(stdout);'
                                 log_func += '\n        free(pTmpStr);\n    }'
                     if 'WsiX11AssociateConnection' == proto.name:
-                        funcs.append("#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)")
+                        funcs.append("#if defined(__linux__) || defined(XCB_NVIDIA)")
                     if proto.name == "EnumerateLayers":
                         c_call = proto.c_call().replace("(" + proto.params[0].name, "((XGL_PHYSICAL_GPU)gpuw->nextObject", 1)
                         funcs.append('%s%s\n'
@@ -658,7 +658,7 @@ class Subcommand(object):
                         ret_val = "XGL_RESULT result = "
                         stmt = "    return result;\n"
                     if 'WsiX11AssociateConnection' == proto.name:
-                        funcs.append("#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)")
+                        funcs.append("#if defined(__linux__) || defined(XCB_NVIDIA)")
                     if proto.name == "EnumerateLayers":
                         c_call = proto.c_call().replace("(" + proto.params[0].name, "((XGL_PHYSICAL_GPU)gpuw->nextObject", 1)
                         funcs.append('%s%s\n'
@@ -767,7 +767,7 @@ class Subcommand(object):
                         ret_val = "XGL_RESULT result = "
                         stmt = "    return result;\n"
                     if 'WsiX11AssociateConnection' == proto.name:
-                        funcs.append("#if defined(PLATFORM_LINUX) || defined(XCB_NVIDIA)")
+                        funcs.append("#if defined(__linux__) || defined(XCB_NVIDIA)")
                     if proto.name == "EnumerateLayers":
                         c_call = proto.c_call().replace("(" + proto.params[0].name, "((XGL_PHYSICAL_GPU)gpuw->nextObject", 1)
                         funcs.append('%s%s\n'