Skip to content

Commit e9a7d1e

Browse files
committed
chore(template): whitespace fixes for generated C headers
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
1 parent 643211c commit e9a7d1e

1 file changed

Lines changed: 25 additions & 16 deletions

File tree

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

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959
# define GLOAM_HAS_ENUM_BASE_TYPE 0
6060
#endif
6161
#endif
62-
{% if fs.is_vulkan %}
62+
{%- if fs.is_vulkan %}
63+
6364
#ifndef GLOAM_FORCE_INLINE
6465
#if defined(_MSC_VER)
6566
# define GLOAM_FORCE_INLINE static __forceinline
@@ -69,16 +70,19 @@
6970
# define GLOAM_FORCE_INLINE static inline
7071
#endif
7172
#endif
72-
{% endif %}
73-
{% if fs.spec_name == "glx" %}
73+
{%- endif %}
74+
{%- if fs.spec_name == "glx" %}
75+
7476
#ifdef GLOAM_PLATFORM_LINUX
7577

78+
#include <gloam/gl.h>
79+
7680
#include <X11/X.h>
7781
#include <X11/Xlib.h>
7882
#include <X11/Xutil.h>
7983

80-
#include <gloam/gl.h>
81-
{% elif fs.spec_name == "wgl" %}
84+
{%- elif fs.spec_name == "wgl" %}
85+
8286
#ifdef GLOAM_PLATFORM_WINDOWS
8387

8488
#ifndef WIN32_LEAN_AND_MEAN
@@ -91,8 +95,9 @@
9195
/* These are defined in wingdi.h and we're redefining them. */
9296
#undef wglUseFontBitmaps
9397
#undef wglUseFontOutlines
94-
{% endif %}
95-
{% if fs.is_vulkan and external_headers -%}
98+
{%- endif %}
99+
{%- if fs.is_vulkan and external_headers %}
100+
96101
{# ---- External Vulkan headers mode ----------------------------------------
97102
Include upstream Vulkan-Headers instead of embedding type definitions.
98103
Uses forward declarations for heavyweight platform types (Win32, Xlib)
@@ -197,13 +202,16 @@ typedef unsigned long RROutput;
197202

198203
#endif /* !defined(VULKAN_H_) */
199204

200-
{% else -%}
205+
{%- else %}
206+
201207
#include <stddef.h>
202208
#include <stdint.h>
203-
209+
{% if fs.required_headers | length > 0 %}
204210
{% for hdr in fs.required_headers -%}
205211
#include "{{ hdr }}"
206-
{% endfor %}
212+
{% endfor -%}
213+
{%- endif %}
214+
{%- if fs.include_type_groups | length > 0 %}
207215
{# Platform / WSI system headers: include-category types whose protection
208216
guards were inferred at generation time from which extensions require them.
209217
An empty protect list means the include is unconditional.
@@ -216,12 +224,13 @@ typedef unsigned long RROutput;
216224
{% endfor -%}
217225
{{ u.protect_end(group.protect) -}}
218226
{% endfor -%}
219-
{% endif -%}
227+
{%- endif %}
228+
{%- endif %}
220229
#ifdef __cplusplus
221230
extern "C" {
222231
#endif
232+
{%- if fs.is_gl_family %}
223233

224-
{% if fs.is_gl_family -%}
225234
/* Calling convention */
226235
#ifndef APIENTRY
227236
# if defined(GLOAM_PLATFORM_WINDOWS)
@@ -261,10 +270,10 @@ extern "C" {
261270
/* Forward declarations for OpenCL interop types. */
262271
struct _cl_context;
263272
struct _cl_event;
273+
{%- endif %}
274+
{%- if not (fs.is_vulkan and external_headers) %}
275+
{%- if fs.features | length > 0 %}
264276

265-
{% endif %}
266-
{%- if not (fs.is_vulkan and external_headers) -%}
267-
{%- if fs.features | length > 0 -%}
268277
/* ---- Version feature guards ----------------------------------------------
269278
* These mirror the upstream vulkan_core.h / gl.h definitions so that code
270279
* guarded by e.g. #ifdef GL_VERSION_3_3 compiles correctly against this
@@ -273,7 +282,7 @@ struct _cl_event;
273282
{% for feat in fs.features -%}
274283
#define {{ feat.full_name }} 1
275284
{% endfor -%}
276-
{% endif -%}
285+
{%- endif %}
277286
{%- if fs.ext_guard_groups | length > 0 %}
278287
/* ---- Extension compile-time guards ---------------------------------------
279288
* These mirror the definitions in standard glext.h/gl2ext.h/eglext.h so

0 commit comments

Comments
 (0)