diff --git a/src/dispatch_common.c b/src/dispatch_common.c index df167d4..013027f 100644 --- a/src/dispatch_common.c +++ b/src/dispatch_common.c @@ -675,25 +675,6 @@ epoxy_get_proc_address(const char *name) #endif } -void -epoxy_print_failure_reasons(const char *name, - const char **provider_names, - const int *providers) -{ - int i; - - fprintf(stderr, "No provider of %s found. Requires one of:\n", name); - - for (i = 0; providers[i] != 0; i++) - fprintf(stderr, " %s\n", - provider_names[providers[i]]); - - if (providers[0] == 0) { - fprintf(stderr, " No known providers. This is likely a bug " - "in libepoxy code generation\n"); - } -} - WRAPPER_VISIBILITY (void) WRAPPER(epoxy_glBegin)(GLenum primtype) { diff --git a/src/dispatch_common.h b/src/dispatch_common.h index eea4e8f..676a4d5 100644 --- a/src/dispatch_common.h +++ b/src/dispatch_common.h @@ -66,6 +66,12 @@ # endif #endif +#if defined(__GNUC__) +#define PACKED __attribute__((__packed__)) +#else +#define PACKED +#endif + /* On win32, we're going to need to keep a per-thread dispatch table, * since the function pointers depend on the device and pixel format * of the current context. @@ -165,9 +171,6 @@ bool epoxy_conservative_has_glx_extension(const char *name); int epoxy_conservative_egl_version(void); bool epoxy_conservative_has_egl_extension(const char *name); bool epoxy_conservative_has_wgl_extension(const char *name); -void epoxy_print_failure_reasons(const char *name, - const char **provider_names, - const int *providers); bool epoxy_extension_in_string(const char *extension_list, const char *ext); diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py index b973415..2b2fe6f 100755 --- a/src/gen_dispatch.py +++ b/src/gen_dispatch.py @@ -637,7 +637,7 @@ class Generator(object): for human_name in sorted_providers: enum = self.provider_enum[human_name] self.outln(' {0},'.format(enum)) - self.outln('};') + self.outln('} PACKED;') self.outln('') def write_provider_enum_strings(self): @@ -696,7 +696,14 @@ class Generator(object): # something useful for the poor application developer before # aborting. (In non-epoxy GL usage, the app developer would # call into some blank stub function and segfault). - self.outln(' epoxy_print_failure_reasons(name, enum_strings, (const int *)providers);') + self.outln(' fprintf(stderr, "No provider of %s found. Requires one of:\\n", name);') + self.outln(' for (i = 0; providers[i] != 0; i++) {') + self.outln(' fprintf(stderr, " %s\\n", enum_strings[providers[i]]);') + self.outln(' }') + self.outln(' if (providers[0] == {0}_provider_terminator) {{'.format(self.target)) + self.outln(' fprintf(stderr, " No known providers. This is likely a bug "') + self.outln(' "in libepoxy code generation\\n");') + self.outln(' }') self.outln(' abort();') self.outln('}')