Skip to content

Commit c40d3b9

Browse files
committed
Merge pull request #117480 from akien-mga/clangd-misc-fixes
Misc includes or modernize fixes found via clangd-tidy
2 parents 280e06c + 7795057 commit c40d3b9

48 files changed

Lines changed: 138 additions & 107 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clangd

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
# https://clangd.llvm.org/config
2+
23
---
4+
35
# Default conditions, apply everywhere.
46

7+
CompileFlags:
8+
Add:
9+
# Some thirdparty includes seem to require a high -ferror-limit to pass checks.
10+
- -ferror-limit=100
11+
512
Diagnostics:
613
Includes:
714
IgnoreHeader:
815
- \.compat\.inc
16+
917
---
18+
1019
# Header-specific conditions.
1120

1221
If:
@@ -20,11 +29,19 @@ CompileFlags:
2029
- -Wno-unused-const-variable
2130
- -Wno-unused-function
2231
- -Wno-unused-variable
32+
2333
---
24-
# Suppress all third-party warnings.
34+
35+
# Suppress warnings for third-party or partial code.
2536

2637
If:
27-
PathMatch: thirdparty/.*
38+
PathMatch:
39+
- bin/build_deps/.*
40+
- misc/dist/apple_embedded_xcode/.*
41+
- tests/compatibility_test/.*
42+
- thirdparty/.*
43+
- .*/thirdparty/.*
44+
- .*-so_wrap.[ch]
2845

2946
Diagnostics:
3047
Suppress: "*"

core/extension/gdextension_interface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class CallableCustomExtension : public CallableCustom {
7777
const CallableCustomExtension *b = static_cast<const CallableCustomExtension *>(p_b);
7878

7979
if (a->call_func != b->call_func) {
80-
return a->call_func < b->call_func;
80+
return (uintptr_t)a->call_func < (uintptr_t)b->call_func;
8181
}
8282
return a->userdata < b->userdata;
8383
}

core/variant/callable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ bool Callable::operator<(const Callable &p_callable) const {
306306
if (less_a == less_b) {
307307
return less_a(custom, p_callable.custom);
308308
} else {
309-
return less_a < less_b; //it's something..
309+
return (uintptr_t)less_a < (uintptr_t)less_b; //it's something..
310310
}
311311

312312
} else {

drivers/alsa/audio_driver_alsa.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Error AudioDriverALSA::init_output_device() {
9696

9797
ERR_FAIL_COND_V(status < 0, ERR_CANT_OPEN);
9898

99-
snd_pcm_hw_params_alloca(&hwparams);
99+
snd_pcm_hw_params_alloca(&hwparams); // NOLINT(modernize-use-bool-literals)
100100

101101
status = snd_pcm_hw_params_any(pcm_handle, hwparams);
102102
CHECK_FAIL(status < 0);
@@ -140,7 +140,7 @@ Error AudioDriverALSA::init_output_device() {
140140

141141
//snd_pcm_hw_params_free(&hwparams);
142142

143-
snd_pcm_sw_params_alloca(&swparams);
143+
snd_pcm_sw_params_alloca(&swparams); // NOLINT(modernize-use-bool-literals)
144144

145145
status = snd_pcm_sw_params_current(pcm_handle, swparams);
146146
CHECK_FAIL(status < 0);

drivers/d3d12/godot_d3d12ma.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
GODOT_GCC_WARNING_PUSH_AND_IGNORE("-Wnon-virtual-dtor")
3636
GODOT_CLANG_WARNING_PUSH_AND_IGNORE("-Wnon-virtual-dtor")
3737

38+
#include <drivers/d3d12/godot_d3dx12.h>
39+
#include <dxgi1_6.h>
40+
3841
#define D3D12MA_D3D12_HEADERS_ALREADY_INCLUDED
3942
#include <thirdparty/d3d12ma/D3D12MemAlloc.h> // IWYU pragma: export.
4043

drivers/d3d12/rendering_context_driver_d3d12.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include "core/config/project_settings.h"
3535
#include "core/string/ustring.h"
3636
#include "core/templates/local_vector.h"
37-
#include "drivers/d3d12/d3d12_hooks.h"
3837

3938
GODOT_GCC_WARNING_PUSH_AND_IGNORE("-Wnon-virtual-dtor")
4039
GODOT_CLANG_WARNING_PUSH_AND_IGNORE("-Wnon-virtual-dtor")

drivers/d3d12/rendering_device_driver_d3d12.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "drivers/d3d12/rendering_context_driver_d3d12.h"
3838

3939
#include <dxgi1_6.h>
40-
// Ensure d3dx12 and dxgi are included first.
40+
4141
#include <drivers/d3d12/godot_d3d12ma.h>
4242
#include <drivers/d3d12/godot_nir.h>
4343

drivers/d3d12/rendering_shader_container_d3d12.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@
3333
#include "core/templates/sort_array.h"
3434
#include "drivers/d3d12/dxil_hash.h"
3535

36-
#include <drivers/d3d12/godot_d3dx12.h>
37-
#include <dxgi1_6.h>
38-
// Include d3dx12 and dxgi before d3d12ma.
3936
#include <drivers/d3d12/godot_d3d12ma.h>
37+
#include <drivers/d3d12/godot_d3dx12.h>
4038
#include <drivers/d3d12/godot_nir.h>
4139

4240
#include <wrl/client.h>
@@ -430,8 +428,8 @@ bool RenderingShaderContainerD3D12::_convert_spirv_to_nir(Span<ReflectShaderStag
430428
shader->info.inputs_read |= VARYING_BIT_POS;
431429

432430
if (prev_shader) {
433-
dxil_reassign_driver_locations(shader, nir_var_shader_in, prev_shader->info.outputs_written, NULL);
434-
dxil_reassign_driver_locations(prev_shader, nir_var_shader_out, shader->info.inputs_read, NULL);
431+
dxil_reassign_driver_locations(shader, nir_var_shader_in, prev_shader->info.outputs_written, nullptr);
432+
dxil_reassign_driver_locations(prev_shader, nir_var_shader_out, shader->info.inputs_read, nullptr);
435433
}
436434
}
437435
}

drivers/egl/egl_manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
#include "egl_manager.h"
3232

33+
#ifdef EGL_ENABLED
34+
3335
#include "core/config/engine.h"
3436
#include "core/crypto/crypto_core.h"
3537
#include "core/io/dir_access.h"
@@ -40,8 +42,6 @@
4042
#include "drivers/gles3/rasterizer_gles3.h"
4143
#endif
4244

43-
#ifdef EGL_ENABLED
44-
4545
#if defined(EGL_STATIC)
4646

4747
#define GLAD_EGL_VERSION_1_5 true

drivers/gles3/shader_gles3.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,14 @@
3333
#ifdef GLES3_ENABLED
3434

3535
#include "core/io/dir_access.h"
36-
#include "core/io/file_access.h"
3736
#include "core/string/string_builder.h"
3837
#include "drivers/gles3/rasterizer_util_gles3.h"
3938
#include "drivers/gles3/storage/config.h"
4039

40+
#ifndef WEB_ENABLED
41+
#include "core/io/file_access.h"
42+
#endif
43+
4144
static String _mkid(const String &p_id) {
4245
String id = "m_" + p_id.replace("__", "_dus_");
4346
return id.replace("__", "_dus_"); //doubleunderscore is reserved in glsl

0 commit comments

Comments
 (0)