Mesa (master): glapi/glx: Generate glapi_gentable. c so that the xserver can use it

Ian Romanick idr at kemper.freedesktop.org
Wed Dec 14 00:08:25 UTC 2011


Module: Mesa
Branch: master
Commit: bc35da409baff63a9928eca4c0ce673dd9288786
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc35da409baff63a9928eca4c0ce673dd9288786

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Mon Dec  5 15:24:49 2011 -0800

glapi/glx: Generate glapi_gentable.c so that the xserver can use it

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Adam Jackson <ajax at redhat.com>

---

 src/mapi/glapi/gen/gl_gentable.py |   38 ++++++++++++++++++++++++++++++++----
 1 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_gentable.py b/src/mapi/glapi/gen/gl_gentable.py
index 814238a..5657e32 100644
--- a/src/mapi/glapi/gen/gl_gentable.py
+++ b/src/mapi/glapi/gen/gl_gentable.py
@@ -33,8 +33,20 @@ import license
 import gl_XML, glX_XML
 import sys, getopt
 
-header = """
-#if defined(DEBUG) && !defined(_WIN32_WCE)
+header = """/* GLXEXT is the define used in the xserver when the GLX extension is being
+ * built.  Hijack this to determine whether this file is being built for the
+ * server or the client.
+ */
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#if (defined(GLXEXT) && defined(HAVE_BACKTRACE)) \\
+	|| (!defined(GLXEXT) && defined(DEBUG) && !defined(_WIN32_WCE))
+#define USE_BACKTRACE
+#endif
+
+#ifdef USE_BACKTRACE
 #include <execinfo.h>
 #endif
 
@@ -47,11 +59,22 @@ header = """
 #include "glapi.h"
 #include "glapitable.h"
 
+#ifdef GLXEXT
+#include "os.h"
+#endif
+
 static void
 __glapi_gentable_NoOp(void) {
-#if defined(DEBUG) && !defined(_WIN32_WCE)
-    if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) {
-        const char *fstr = "Unknown";
+    const char *fstr = "Unknown";
+
+    /* Silence potential GCC warning for some #ifdef paths.
+     */
+    (void) fstr;
+#if defined(USE_BACKTRACE)
+#if !defined(GLXEXT)
+    if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"))
+#endif
+    {
         void *frames[2];
 
         if(backtrace(frames, 2) == 2) {
@@ -61,9 +84,14 @@ __glapi_gentable_NoOp(void) {
                 fstr = info.dli_sname;
         }
 
+#if !defined(GLXEXT)
         fprintf(stderr, "Call to unimplemented API: %s\\n", fstr);
+#endif
     }
 #endif
+#if defined(GLXEXT)
+    LogMessage(X_ERROR, "GLX: Call to unimplemented API: %s\\n", fstr);
+#endif
 }
 
 static void




More information about the mesa-commit mailing list