Style: clang-format: Disable AllowShortIfStatementsOnASingleLine

Part of #33027, also discussed in #29848.

Enforcing the use of brackets even on single line statements would be
preferred, but `clang-format` doesn't have this functionality yet.
This commit is contained in:
Rémi Verschelde
2020-05-10 12:56:01 +02:00
parent 03b13e0c69
commit e956e80c1f
130 changed files with 967 additions and 511 deletions

View File

@ -721,14 +721,16 @@ public:
Color get_default_clear_color() const {
return default_clear_color;
}
#define TIMESTAMP_BEGIN() \
{ \
if (RSG::storage->capturing_timestamps) RSG::storage->capture_timestamps_begin(); \
#define TIMESTAMP_BEGIN() \
{ \
if (RSG::storage->capturing_timestamps) \
RSG::storage->capture_timestamps_begin(); \
}
#define RENDER_TIMESTAMP(m_text) \
{ \
if (RSG::storage->capturing_timestamps) RSG::storage->capture_timestamp(m_text); \
#define RENDER_TIMESTAMP(m_text) \
{ \
if (RSG::storage->capturing_timestamps) \
RSG::storage->capture_timestamp(m_text); \
}
bool capturing_timestamps = false;
@ -857,7 +859,8 @@ public:
_FORCE_INLINE_ TextureBinding() { binding_id = 0; }
_FORCE_INLINE_ ~TextureBinding() {
if (binding_id) singleton->free_texture_binding(binding_id);
if (binding_id)
singleton->free_texture_binding(binding_id);
}
};
@ -886,7 +889,8 @@ public:
_FORCE_INLINE_ Polygon() { polygon_id = 0; }
_FORCE_INLINE_ ~Polygon() {
if (polygon_id) singleton->free_polygon(polygon_id);
if (polygon_id)
singleton->free_polygon(polygon_id);
}
};
@ -1288,7 +1292,8 @@ public:
for (int i = 0; i < blocks.size(); i++) {
memfree(blocks[i].memory);
}
if (copy_back_buffer) memdelete(copy_back_buffer);
if (copy_back_buffer)
memdelete(copy_back_buffer);
if (custom_data) {
memdelete(custom_data);
}

View File

@ -184,22 +184,38 @@ void main() {
int index = x + y * 4;
float limit = 0.0;
if (x < 8) {
if (index == 0) limit = 0.0625;
if (index == 1) limit = 0.5625;
if (index == 2) limit = 0.1875;
if (index == 3) limit = 0.6875;
if (index == 4) limit = 0.8125;
if (index == 5) limit = 0.3125;
if (index == 6) limit = 0.9375;
if (index == 7) limit = 0.4375;
if (index == 8) limit = 0.25;
if (index == 9) limit = 0.75;
if (index == 10) limit = 0.125;
if (index == 11) limit = 0.625;
if (index == 12) limit = 1.0;
if (index == 13) limit = 0.5;
if (index == 14) limit = 0.875;
if (index == 15) limit = 0.375;
if (index == 0)
limit = 0.0625;
if (index == 1)
limit = 0.5625;
if (index == 2)
limit = 0.1875;
if (index == 3)
limit = 0.6875;
if (index == 4)
limit = 0.8125;
if (index == 5)
limit = 0.3125;
if (index == 6)
limit = 0.9375;
if (index == 7)
limit = 0.4375;
if (index == 8)
limit = 0.25;
if (index == 9)
limit = 0.75;
if (index == 10)
limit = 0.125;
if (index == 11)
limit = 0.625;
if (index == 12)
limit = 1.0;
if (index == 13)
limit = 0.5;
if (index == 14)
limit = 0.875;
if (index == 15)
limit = 0.375;
}
if (frag_color.a < limit) {
discard;

View File

@ -420,7 +420,8 @@ float SchlickFresnel(float u) {
}
float GTR1(float NdotH, float a) {
if (a >= 1.0) return 1.0 / M_PI;
if (a >= 1.0)
return 1.0 / M_PI;
float a2 = a * a;
float t = 1.0 + (a2 - 1.0) * NdotH * NdotH;
return (a2 - 1.0) / (M_PI * log(a2) * t);

View File

@ -6688,7 +6688,8 @@ static int _get_first_ident_pos(const String &p_code) {
if (GETCHAR(0) == '/' && GETCHAR(1) == '/') {
idx += 2;
while (true) {
if (GETCHAR(0) == 0) return 0;
if (GETCHAR(0) == 0)
return 0;
if (GETCHAR(0) == '\n') {
idx++;
break; // loop
@ -6698,7 +6699,8 @@ static int _get_first_ident_pos(const String &p_code) {
} else if (GETCHAR(0) == '/' && GETCHAR(1) == '*') {
idx += 2;
while (true) {
if (GETCHAR(0) == 0) return 0;
if (GETCHAR(0) == 0)
return 0;
if (GETCHAR(0) == '*' && GETCHAR(1) == '/') {
idx += 2;
break; // loop