Skip to content

Commit 45db598

Browse files
committed
chore(cleanup): ensure -std=c99 -Wall compiles with no warnings
Had some redundant type declarations, but otherwise pretty clean. Signed-off-by: Steven Noonan <steven@uplinklabs.net>
1 parent c38da98 commit 45db598

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

src/generator/c/templates/header.h.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,15 @@ extern {{ fs.context_name }} gloam_{{ fs.spec_name }}_context;
306306

307307
/* ---- API declarations ---------------------------------------------------- */
308308

309+
#ifndef GLOAM_DEFINED_CALLBACK_TYPES_
310+
#define GLOAM_DEFINED_CALLBACK_TYPES_
309311
/* Opaque function pointer type — the common return type for all load
310312
callbacks. Callers cast to the specific PFN type they need. */
311313
typedef void (*GloamAPIProc)(void);
312314

313315
/* Load function pointer type (GL / EGL / GLX / WGL). */
314316
typedef GloamAPIProc (*GloamLoadFunc)(const char *name);
317+
#endif
315318
{%- if fs.is_vulkan %}
316319
/* Vulkan command scope — controls which proc-addr entry point the load
317320
callback should use. Must match the definition in impl_util.j2. */
@@ -402,3 +405,4 @@ void gloamLoaderResetVulkan(void);
402405
#endif /* _WIN32 */
403406
{% endif %}
404407
#endif /* GLOAM_{{ guard }} */
408+

src/generator/c/templates/impl_util.j2

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,6 @@
1919
#define GLOAM_ARRAYSIZE(x) (sizeof(x) / sizeof((x)[0]))
2020
#define GLOAM_UNUSED(x) ((void)(x))
2121

22-
/* Opaque function pointer type — the common return type for all load
23-
callbacks. Callers cast to the specific PFN type they need. */
24-
typedef void (*GloamAPIProc)(void);
25-
26-
/* Load function pointer type: plain proc-addr callback (GL / EGL / GLX / WGL). */
27-
typedef GloamAPIProc (*GloamLoadFunc)(const char *name);
28-
2922
/* Contiguous run of pfnArray slots belonging to one feature or extension.
3023
Used by the range-based PFN loading loop. */
3124
typedef struct {

src/generator/c/templates/source.c.j2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
offset table for O(1) indexing. This avoids one pointer (8 bytes on 64-bit)
5252
plus one relocation entry (~24 bytes in PIC builds) per command compared to
5353
the traditional const char * const [] approach. */
54-
#define kFnCount_{{ fs.spec_name | spec_display }} {{ fs.commands | length }}
54+
static const uint32_t kFnCount_{{ fs.spec_name | spec_display }} = {{ fs.commands | length }};
5555

5656
static const char kFnNameData_{{ fs.spec_name | spec_display }}[] =
5757
{%- for cmd in fs.commands %}
@@ -901,3 +901,4 @@ int gloamLoadVulkan(VkInstance instance, VkPhysicalDevice physical_device, VkDev
901901
{% elif fs.spec_name == "wgl" -%}
902902
#endif /* _WIN32 */
903903
{% endif %}
904+

0 commit comments

Comments
 (0)