Merge pull request #373 from mika314/master

Fix compilation warnings about unused vars
pull/500/head
Marc 2021-01-31 19:44:04 +00:00 committed by GitHub
commit bdba7b4866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 14 deletions

View File

@ -149,7 +149,7 @@ struct _ArgCast<Variant> {
// instance and destroy funcs // instance and destroy funcs
template <class T> template <class T>
void *_godot_class_instance_func(godot_object *p, void *method_data) { void *_godot_class_instance_func(godot_object *p, void * /*method_data*/) {
T *d = new T(); T *d = new T();
d->_owner = p; d->_owner = p;
d->_type_tag = typeid(T).hash_code(); d->_type_tag = typeid(T).hash_code();
@ -158,7 +158,7 @@ void *_godot_class_instance_func(godot_object *p, void *method_data) {
} }
template <class T> template <class T>
void _godot_class_destroy_func(godot_object *p, void *method_data, void *data) { void _godot_class_destroy_func(godot_object * /*p*/, void * /*method_data*/, void *data) {
T *d = (T *)data; T *d = (T *)data;
delete d; delete d;
} }
@ -210,13 +210,13 @@ void register_tool_class() {
typedef godot_variant (*__godot_wrapper_method)(godot_object *, void *, void *, int, godot_variant **); typedef godot_variant (*__godot_wrapper_method)(godot_object *, void *, void *, int, godot_variant **);
template <class T, class R, class... args> template <class T, class R, class... args>
const char *___get_method_class_name(R (T::*p)(args... a)) { const char *___get_method_class_name(R (T::*/*p*/)(args... a)) {
static_assert(T::___CLASS_IS_SCRIPT, "This function must only be used on custom classes"); static_assert(T::___CLASS_IS_SCRIPT, "This function must only be used on custom classes");
return T::___get_class_name(); return T::___get_class_name();
} }
template <class T, class R, class... args> template <class T, class R, class... args>
const char *___get_method_class_name(R (T::*p)(args... a) const) { const char *___get_method_class_name(R (T::*/*p*/)(args... a) const) {
static_assert(T::___CLASS_IS_SCRIPT, "This function must only be used on custom classes"); static_assert(T::___CLASS_IS_SCRIPT, "This function must only be used on custom classes");
return T::___get_class_name(); return T::___get_class_name();
} }
@ -256,13 +256,13 @@ struct _WrappedMethod<T, void, As...> {
void (T::*f)(As...); void (T::*f)(As...);
template <int... I> template <int... I>
void apply(Variant *ret, T *obj, Variant **args, __Sequence<I...>) { void apply(Variant * /*ret*/, T *obj, Variant **args, __Sequence<I...>) {
(obj->*f)(_ArgCast<As>::_arg_cast(*args[I])...); (obj->*f)(_ArgCast<As>::_arg_cast(*args[I])...);
} }
}; };
template <class T, class R, class... As> template <class T, class R, class... As>
godot_variant __wrapped_method(godot_object *, void *method_data, void *user_data, int num_args, godot_variant **args) { godot_variant __wrapped_method(godot_object *, void *method_data, void *user_data, int /*num_args*/, godot_variant **args) {
godot_variant v; godot_variant v;
godot::api->godot_variant_new_nil(&v); godot::api->godot_variant_new_nil(&v);
@ -286,7 +286,7 @@ void *___make_wrapper_function(R (T::*f)(As...)) {
} }
template <class T, class R, class... As> template <class T, class R, class... As>
__godot_wrapper_method ___get_wrapper_function(R (T::*f)(As...)) { __godot_wrapper_method ___get_wrapper_function(R (T::* /*f*/)(As...)) {
return (__godot_wrapper_method)&__wrapped_method<T, R, As...>; return (__godot_wrapper_method)&__wrapped_method<T, R, As...>;
} }
@ -326,7 +326,7 @@ void register_method_explicit(const char *name, R (B::*method_ptr)(As...),
template <class T, class P> template <class T, class P>
struct _PropertySetFunc { struct _PropertySetFunc {
void (T::*f)(P); void (T::*f)(P);
static void _wrapped_setter(godot_object *object, void *method_data, void *user_data, godot_variant *value) { static void _wrapped_setter(godot_object * /*object*/, void *method_data, void *user_data, godot_variant *value) {
_PropertySetFunc<T, P> *set_func = (_PropertySetFunc<T, P> *)method_data; _PropertySetFunc<T, P> *set_func = (_PropertySetFunc<T, P> *)method_data;
T *obj = (T *)user_data; T *obj = (T *)user_data;
@ -340,7 +340,7 @@ template <class T, class P>
struct _PropertyGetFunc { struct _PropertyGetFunc {
P(T::*f) P(T::*f)
(); ();
static godot_variant _wrapped_getter(godot_object *object, void *method_data, void *user_data) { static godot_variant _wrapped_getter(godot_object * /*object*/, void *method_data, void *user_data) {
_PropertyGetFunc<T, P> *get_func = (_PropertyGetFunc<T, P> *)method_data; _PropertyGetFunc<T, P> *get_func = (_PropertyGetFunc<T, P> *)method_data;
T *obj = (T *)user_data; T *obj = (T *)user_data;
@ -358,7 +358,7 @@ struct _PropertyGetFunc {
template <class T, class P> template <class T, class P>
struct _PropertyDefaultSetFunc { struct _PropertyDefaultSetFunc {
P(T::*f); P(T::*f);
static void _wrapped_setter(godot_object *object, void *method_data, void *user_data, godot_variant *value) { static void _wrapped_setter(godot_object * /*object*/, void *method_data, void *user_data, godot_variant *value) {
_PropertyDefaultSetFunc<T, P> *set_func = (_PropertyDefaultSetFunc<T, P> *)method_data; _PropertyDefaultSetFunc<T, P> *set_func = (_PropertyDefaultSetFunc<T, P> *)method_data;
T *obj = (T *)user_data; T *obj = (T *)user_data;
@ -371,7 +371,7 @@ struct _PropertyDefaultSetFunc {
template <class T, class P> template <class T, class P>
struct _PropertyDefaultGetFunc { struct _PropertyDefaultGetFunc {
P(T::*f); P(T::*f);
static godot_variant _wrapped_getter(godot_object *object, void *method_data, void *user_data) { static godot_variant _wrapped_getter(godot_object * /*object*/, void *method_data, void *user_data) {
_PropertyDefaultGetFunc<T, P> *get_func = (_PropertyDefaultGetFunc<T, P> *)method_data; _PropertyDefaultGetFunc<T, P> *get_func = (_PropertyDefaultGetFunc<T, P> *)method_data;
T *obj = (T *)user_data; T *obj = (T *)user_data;

View File

@ -394,19 +394,22 @@ float String::similarity(String text) const {
return godot::api->godot_string_similarity(&_godot_string, &text._godot_string); return godot::api->godot_string_similarity(&_godot_string, &text._godot_string);
} }
PoolStringArray String::split(String divisor, bool allow_empty) const { // TODO Suport allow_empty
PoolStringArray String::split(String divisor, bool /*allow_empty*/) const {
godot_array arr = godot::api->godot_string_split(&_godot_string, &divisor._godot_string); godot_array arr = godot::api->godot_string_split(&_godot_string, &divisor._godot_string);
return *(Array *)&arr; return *(Array *)&arr;
} }
PoolIntArray String::split_ints(String divisor, bool allow_empty) const { // TODO Suport allow_empty
PoolIntArray String::split_ints(String divisor, bool /*allow_empty*/) const {
godot_array arr = godot::api->godot_string_split_floats(&_godot_string, &divisor._godot_string); godot_array arr = godot::api->godot_string_split_floats(&_godot_string, &divisor._godot_string);
return *(Array *)&arr; return *(Array *)&arr;
} }
PoolRealArray String::split_floats(String divisor, bool allow_empty) const { // TODO Suport allow_empty
PoolRealArray String::split_floats(String divisor, bool /*allow_empty*/) const {
godot_array arr = godot::api->godot_string_split_floats(&_godot_string, &divisor._godot_string); godot_array arr = godot::api->godot_string_split_floats(&_godot_string, &divisor._godot_string);
return *(Array *)&arr; return *(Array *)&arr;