Skip to content

Commit c03cc3a

Browse files
committed
Autopxd2 now currently handle const attributes
1 parent 693f179 commit c03cc3a

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

src/godot/hazmat/gdapi_pxd/meth.pxd.j2

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ cdef inline {{ render_utility_function_signature(builtin) }}:
5858
{# GDExtensionTypePtr ret #}
5959
{{ "NULL" if builtin.return_type.is_nil else "&__ret" }},
6060
{# const GDExtensionTypePtr *p_arguments #}
61-
# Cast on args is required given autopxd2 incorrectly removes the const
62-
# attributes when converting gdextension_interface.c to .pxd
63-
<const void *const*>{{ "NULL" if (builtin.arguments | length) == 0 else "__args" }},
61+
<const void **>{{ "NULL" if (builtin.arguments | length) == 0 else "__args" }},
6462
{# int p_argument_count #}
6563
{{ builtin.arguments | length }}
6664
)
@@ -77,16 +75,12 @@ cdef inline {{ render_utility_function_signature(builtin) }}:
7775
{# to pass a `gd_variant_t**` as parameter) whose size is passed in the number #}
7876
{# of parameters fields... Yes this is very confusing stuff, my brain hurts ! #}
7977
{% if builtin.return_type.is_nil %}
80-
# Cast on args is required given autopxd2 incorrectly removes the const
81-
# attributes when converting gdextension_interface.c to .pxd
82-
gd_utility_{{ builtin.original_name }}_ptr(NULL, <const void *const*>&args, args_count)
78+
gd_utility_{{ builtin.original_name }}_ptr(NULL, <const void **>&args, args_count)
8379
{% else %}
8480
cdef gd_variant_t __ret # TODO: improve return type !
8581
# ptrcall makes us jump right into C++ code (i.e. Godot internals) that expects constructor to be called on each parameter
8682
__ret = gd_variant_new()
87-
# Cast on args is required given autopxd2 incorrectly removes the const
88-
# attributes when converting gdextension_interface.c to .pxd
89-
gd_utility_{{ builtin.original_name }}_ptr(&__ret, <const void *const*>&args, args_count)
83+
gd_utility_{{ builtin.original_name }}_ptr(&__ret, <const void **>&args, args_count)
9084
return __ret
9185
{% endif %}
9286
{% endmacro %}
@@ -167,9 +161,7 @@ cdef inline {{ render_builtin_constructor_signature(builtin, constructor) }}:
167161
{% endif %}
168162
{{ builtin.c_name_prefix }}_constructor_{{ constructor.index }}_ptr(
169163
&obj,
170-
# Cast is required given autopxd2 incorrectly removes the const attributes
171-
# when converting gdextension_interface.c to .pxd
172-
<const void * const*>{{ "NULL" if (constructor.arguments | length) == 0 else "p_args" }}
164+
<const void **>{{ "NULL" if (constructor.arguments | length) == 0 else "p_args" }}
173165
)
174166
return obj
175167
{% endmacro %}
@@ -224,9 +216,7 @@ cdef inline {{ render_builtin_method_signature(builtin, meth) }}:
224216
{# GDExtensionTypePtr p_base #}
225217
self,
226218
{# const GDExtensionTypePtr *__args #}
227-
# Cast is required given autopxd2 incorrectly removes the const attributes
228-
# when converting gdextension_interface.c to .pxd
229-
<const void * const*>__args,
219+
<const void **>__args,
230220
{# GDExtensionTypePtr __ret #}
231221
{{ "NULL" if meth.return_type.is_nil else "&__ret" }},
232222
{# int p_argument_count #}

0 commit comments

Comments
 (0)