1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-22 15:06:45 +00:00

Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks

Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
This commit is contained in:
Rémi Verschelde
2020-05-14 13:23:58 +02:00
parent 710b34b702
commit 0be6d925dc
1552 changed files with 1 additions and 33876 deletions

View File

@@ -37,17 +37,14 @@
MessageQueue *MessageQueue::singleton = nullptr;
MessageQueue *MessageQueue::get_singleton() {
return singleton;
}
Error MessageQueue::push_call(ObjectID p_id, const StringName &p_method, const Variant **p_args, int p_argcount, bool p_show_error) {
return push_callable(Callable(p_id, p_method), p_args, p_argcount, p_show_error);
}
Error MessageQueue::push_call(ObjectID p_id, const StringName &p_method, VARIANT_ARG_DECLARE) {
VARIANT_ARGPTRS;
int argc = 0;
@@ -62,7 +59,6 @@ Error MessageQueue::push_call(ObjectID p_id, const StringName &p_method, VARIANT
}
Error MessageQueue::push_set(ObjectID p_id, const StringName &p_prop, const Variant &p_value) {
_THREAD_SAFE_METHOD_
uint8_t room_needed = sizeof(Message) + sizeof(Variant);
@@ -91,7 +87,6 @@ Error MessageQueue::push_set(ObjectID p_id, const StringName &p_prop, const Vari
}
Error MessageQueue::push_notification(ObjectID p_id, int p_notification) {
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(p_notification < 0, ERR_INVALID_PARAMETER);
@@ -117,21 +112,17 @@ Error MessageQueue::push_notification(ObjectID p_id, int p_notification) {
}
Error MessageQueue::push_call(Object *p_object, const StringName &p_method, VARIANT_ARG_DECLARE) {
return push_call(p_object->get_instance_id(), p_method, VARIANT_ARG_PASS);
}
Error MessageQueue::push_notification(Object *p_object, int p_notification) {
return push_notification(p_object->get_instance_id(), p_notification);
}
Error MessageQueue::push_set(Object *p_object, const StringName &p_prop, const Variant &p_value) {
return push_set(p_object->get_instance_id(), p_prop, p_value);
}
Error MessageQueue::push_callable(const Callable &p_callable, const Variant **p_args, int p_argcount, bool p_show_error) {
_THREAD_SAFE_METHOD_
int room_needed = sizeof(Message) + sizeof(Variant) * p_argcount;
@@ -152,7 +143,6 @@ Error MessageQueue::push_callable(const Callable &p_callable, const Variant **p_
buffer_end += sizeof(Message);
for (int i = 0; i < p_argcount; i++) {
Variant *v = memnew_placement(&buffer[buffer_end], Variant);
buffer_end += sizeof(Variant);
*v = *p_args[i];
@@ -162,7 +152,6 @@ Error MessageQueue::push_callable(const Callable &p_callable, const Variant **p_
}
void MessageQueue::statistics() {
Map<StringName, int> set_count;
Map<int, int> notify_count;
Map<Callable, int> call_count;
@@ -175,11 +164,8 @@ void MessageQueue::statistics() {
Object *target = message->callable.get_object();
if (target != nullptr) {
switch (message->type & FLAG_MASK) {
case TYPE_CALL: {
if (!call_count.has(message->callable))
call_count[message->callable] = 0;
@@ -187,7 +173,6 @@ void MessageQueue::statistics() {
} break;
case TYPE_NOTIFICATION: {
if (!notify_count.has(message->notification))
notify_count[message->notification] = 0;
@@ -195,7 +180,6 @@ void MessageQueue::statistics() {
} break;
case TYPE_SET: {
StringName t = message->callable.get_method();
if (!set_count.has(t))
set_count[t] = 0;
@@ -234,12 +218,10 @@ void MessageQueue::statistics() {
}
int MessageQueue::get_max_buffer_usage() const {
return buffer_max_used;
}
void MessageQueue::_call_function(const Callable &p_callable, const Variant *p_args, int p_argcount, bool p_show_error) {
const Variant **argptrs = nullptr;
if (p_argcount) {
argptrs = (const Variant **)alloca(sizeof(Variant *) * p_argcount);
@@ -252,13 +234,11 @@ void MessageQueue::_call_function(const Callable &p_callable, const Variant *p_a
Variant ret;
p_callable.call(argptrs, p_argcount, ret, ce);
if (p_show_error && ce.error != Callable::CallError::CALL_OK) {
ERR_PRINT("Error calling deferred method: " + Variant::get_callable_error_text(p_callable, argptrs, p_argcount, ce) + ".");
}
}
void MessageQueue::flush() {
if (buffer_end > buffer_max_used) {
buffer_max_used = buffer_end;
}
@@ -275,7 +255,6 @@ void MessageQueue::flush() {
flushing = true;
while (read_pos < buffer_end) {
//lock on each iteration, so a call can re-add itself to the message queue
Message *message = (Message *)&buffer[read_pos];
@@ -292,10 +271,8 @@ void MessageQueue::flush() {
Object *target = message->callable.get_object();
if (target != nullptr) {
switch (message->type & FLAG_MASK) {
case TYPE_CALL: {
Variant *args = (Variant *)(message + 1);
// messages don't expect a return value
@@ -304,13 +281,11 @@ void MessageQueue::flush() {
} break;
case TYPE_NOTIFICATION: {
// messages don't expect a return value
target->notification(message->notification);
} break;
case TYPE_SET: {
Variant *arg = (Variant *)(message + 1);
// messages don't expect a return value
target->set(message->callable.get_method(), *arg);
@@ -337,12 +312,10 @@ void MessageQueue::flush() {
}
bool MessageQueue::is_flushing() const {
return flushing;
}
MessageQueue::MessageQueue() {
ERR_FAIL_COND_MSG(singleton != nullptr, "A MessageQueue singleton already exists.");
singleton = this;
@@ -353,11 +326,9 @@ MessageQueue::MessageQueue() {
}
MessageQueue::~MessageQueue() {
uint32_t read_pos = 0;
while (read_pos < buffer_end) {
Message *message = (Message *)&buffer[read_pos];
Variant *args = (Variant *)(message + 1);
int argc = message->args;