Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-format config changes to discuss #29848

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ AlignAfterOpenBracket: DontAlign
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
# AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
# AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: true
# AllowShortIfStatementsOnASingleLine: false
# AllowShortLoopsOnASingleLine: false
# AlwaysBreakAfterDefinitionReturnType: None
# AlwaysBreakAfterReturnType: None
Expand Down
24 changes: 16 additions & 8 deletions core/bind/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,14 +516,22 @@ String _OS::get_locale() const {

String _OS::get_latin_keyboard_variant() const {
switch (OS::get_singleton()->get_latin_keyboard_variant()) {
case OS::LATIN_KEYBOARD_QWERTY: return "QWERTY";
case OS::LATIN_KEYBOARD_QWERTZ: return "QWERTZ";
case OS::LATIN_KEYBOARD_AZERTY: return "AZERTY";
case OS::LATIN_KEYBOARD_QZERTY: return "QZERTY";
case OS::LATIN_KEYBOARD_DVORAK: return "DVORAK";
case OS::LATIN_KEYBOARD_NEO: return "NEO";
case OS::LATIN_KEYBOARD_COLEMAK: return "COLEMAK";
default: return "ERROR";
case OS::LATIN_KEYBOARD_QWERTY:
return "QWERTY";
case OS::LATIN_KEYBOARD_QWERTZ:
return "QWERTZ";
case OS::LATIN_KEYBOARD_AZERTY:
return "AZERTY";
case OS::LATIN_KEYBOARD_QZERTY:
return "QZERTY";
case OS::LATIN_KEYBOARD_DVORAK:
return "DVORAK";
case OS::LATIN_KEYBOARD_NEO:
return "NEO";
case OS::LATIN_KEYBOARD_COLEMAK:
return "COLEMAK";
default:
return "ERROR";
}
}

Expand Down
3 changes: 2 additions & 1 deletion core/color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ bool Color::html_is_valid(const String &p_color) {
}

Color Color::named(const String &p_name) {
if (_named_colors.empty()) _populate_named_colors(); // from color_names.inc
if (_named_colors.empty())
_populate_named_colors(); // from color_names.inc
String name = p_name;
// Normalize name
name = name.replace(" ", "");
Expand Down
3 changes: 2 additions & 1 deletion core/color_names.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

static Map<String, Color> _named_colors;
static void _populate_named_colors() {
if (!_named_colors.empty()) return;
if (!_named_colors.empty())
return;
_named_colors.insert("aliceblue", Color(0.94, 0.97, 1.00));
_named_colors.insert("antiquewhite", Color(0.98, 0.92, 0.84));
_named_colors.insert("aqua", Color(0.00, 1.00, 1.00));
Expand Down
24 changes: 16 additions & 8 deletions core/command_queue_mt.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@
cmd->method = p_method; \
SEMIC_SEP_LIST(CMD_ASSIGN_PARAM, N); \
unlock(); \
if (sync) sync->post(); \
if (sync) \
sync->post(); \
}

#define CMD_RET_TYPE(N) CommandRet##N<T, M, COMMA_SEP_LIST(TYPE_ARG, N) COMMA(N) R>
Expand All @@ -253,7 +254,8 @@
cmd->ret = r_ret; \
cmd->sync_sem = ss; \
unlock(); \
if (sync) sync->post(); \
if (sync) \
sync->post(); \
ss->sem->wait(); \
ss->in_use = false; \
}
Expand All @@ -270,7 +272,8 @@
SEMIC_SEP_LIST(CMD_ASSIGN_PARAM, N); \
cmd->sync_sem = ss; \
unlock(); \
if (sync) sync->post(); \
if (sync) \
sync->post(); \
ss->sem->wait(); \
ss->in_use = false; \
}
Expand Down Expand Up @@ -402,12 +405,14 @@ class CommandQueueMT {
}

bool flush_one(bool p_lock = true) {
if (p_lock) lock();
if (p_lock)
lock();
tryagain:

// tried to read an empty queue
if (read_ptr == write_ptr) {
if (p_lock) unlock();
if (p_lock)
unlock();
return false;
}

Expand All @@ -426,15 +431,18 @@ class CommandQueueMT {

read_ptr += size;

if (p_lock) unlock();
if (p_lock)
unlock();
cmd->call();
if (p_lock) lock();
if (p_lock)
lock();

cmd->post();
cmd->~CommandBase();
*(uint32_t *)&command_mem[size_ptr] &= ~1;

if (p_lock) unlock();
if (p_lock)
unlock();
return true;
}

Expand Down
3 changes: 2 additions & 1 deletion core/cowdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ class CowData {
return false;
}
*out = next_power_of_2(o);
if (_add_overflow(o, static_cast<size_t>(32), &p)) return false; //no longer allocated here
if (_add_overflow(o, static_cast<size_t>(32), &p))
return false; //no longer allocated here
return true;
#else
// Speed is more important than correctness here, do the operations unchecked
Expand Down
Loading