Hi Brian, Please give this change a try. It should clear up the gcc -pedantic warnings and also replaces the NULL entries with noops since that seems to be done in other tables as well (eg: indirect_init.c).
Thanks, Jeremy diff --git a/src/mapi/glapi/gen/gl_gentable.py b/src/mapi/glapi/gen/gl_gentable.py index 73986f2..4420e3a 100644 --- a/src/mapi/glapi/gen/gl_gentable.py +++ b/src/mapi/glapi/gen/gl_gentable.py @@ -34,6 +34,10 @@ import gl_XML, glX_XML import sys, getopt header = """ +#if defined(DEBUG) && !defined(_WIN32_WCE) +#include <execinfo.h> +#endif + #include <dlfcn.h> #include <stdlib.h> #include <stdio.h> @@ -43,6 +47,40 @@ header = """ #include "glapi.h" #include "glapitable.h" +static void +__glapi_gentable_NoOp(void) { +#if defined(DEBUG) && !defined(_WIN32_WCE) + if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) { + const char *fstr = "Unknown"; + void *frames[2]; + + if(backtrace(frames, 2) == 2) { + Dl_info info; + dladdr(frames[1], &info); + if(info.dli_sname) + fstr = info.dli_sname; + } + + fprintf(stderr, "Call to unimplemented API: %s\\n", fstr); + } +#endif +} + +static void +__glapi_gentable_set_remaining_noop(struct _glapi_table *disp) { + GLuint entries = _glapi_get_dispatch_table_size(); + void **dispatch = (void **) disp; + int i; + + /* ISO C is annoying sometimes */ + union {_glapi_proc p; void *v;} p; + p.p = __glapi_gentable_NoOp; + + for(i=0; i < entries; i++) + if(dispatch[i] == NULL) + dispatch[i] = p.v; +} + struct _glapi_table * _glapi_create_table_from_handle(void *handle, const char *symbol_prefix) { struct _glapi_table *disp = calloc(1, sizeof(struct _glapi_table)); @@ -56,6 +94,8 @@ _glapi_create_table_from_handle(void *handle, const char *symbol_prefix) { """ footer = """ + __glapi_gentable_set_remaining_noop(disp); + return disp; } """ @@ -63,8 +103,8 @@ footer = """ body_template = """ if(!disp->%(name)s) { snprintf(symboln, sizeof(symboln), "%%s%(entry_point)s", symbol_prefix); - _glapi_proc *procp = (_glapi_proc *)&disp->%(name)s; - *procp = (_glapi_proc) dlsym(handle, symboln); + void ** procp = (void **) &disp->%(name)s; + *procp = dlsym(handle, symboln); } """ On Jun 13, 2011, at 3:13 PM, Brian Paul wrote: > On 06/13/2011 03:53 PM, Jeremy Huddleston wrote: >> b44d13e67bfe81b2d7af4aeda2c3caf7f252bd0f should work for you. Thanks for >> letting me know. > > Another warning: > > > glapi_gentable.c: In function ‘_glapi_create_table_from_handle’: > glapi_gentable.c:54:9: warning: ISO C90 forbids mixed declarations and code > glapi_gentable.c:55:18: warning: ISO C forbids conversion of object pointer > to f > unction pointer type > glapi_gentable.c:61:9: warning: ISO C90 forbids mixed declarations and code > glapi_gentable.c:62:18: warning: ISO C forbids conversion of object pointer > to f > unction pointer type > glapi_gentable.c:68:9: warning: ISO C90 forbids mixed declarations and code > glapi_gentable.c:69:18: warning: ISO C forbids conversion of object pointer > to f > unction pointer type > > > Need to put the _glapi_proc declaration first. > > -Brian > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev