Skip to content

Commit b7a0971

Browse files
committed
Merge pull request #97934 from adamscott/give-AThousandShips-a-break
[Codestyle] Set clang-format `RemoveSemicolon` rule to `true`
2 parents 64b6819 + 25b28aa commit b7a0971

File tree

170 files changed

+523
-466
lines changed

Some content is hidden

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

170 files changed

+523
-466
lines changed

.clang-format

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ PackConstructorInitializers: NextLine
183183
# ReflowComments: true
184184
# RemoveBracesLLVM: false
185185
# RemoveParentheses: Leave
186-
# RemoveSemicolon: false
186+
RemoveSemicolon: true
187187
# RequiresClausePosition: OwnLine
188188
# RequiresExpressionIndentation: OuterScope
189189
# SeparateDefinitionBlocks: Leave
@@ -231,7 +231,7 @@ SpacesInLineCommentPrefix:
231231
# InEmptyParentheses: false
232232
# Other: false
233233
# SpacesInSquareBrackets: false
234-
Standard: c++17
234+
Standard: c++20
235235
# StatementAttributeLikeMacros:
236236
# - Q_EMIT
237237
# StatementMacros:

.git-blame-ignore-revs

+3
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,6 @@ df61dc4b2bd54a5a40c515493c76f5a458e5b541
5757

5858
# Style: Apply new `clang-format` fixes
5959
b37fc1014abf7adda70dc30b0822d775b3a4433f
60+
61+
# Set clang-format `RemoveSemicolon` rule to `true`
62+
0d350e71086fffce0553811739aae9f6ad66136c

.pre-commit-config.yaml

+12-1
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,25 @@ repos:
1212
rev: v19.1.0
1313
hooks:
1414
- id: clang-format
15-
files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx|m|mm|inc|java|glsl)$
15+
files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx|m|mm|inc|java)$
16+
types_or: [text]
17+
exclude: |
18+
(?x)^(
19+
tests/python_build/.*|
20+
platform/android/java/editor/src/main/java/com/android/.*|
21+
platform/android/java/lib/src/com/.*
22+
)
23+
- id: clang-format
24+
name: clang-format-glsl
25+
files: \.(glsl)$
1626
types_or: [text]
1727
exclude: |
1828
(?x)^(
1929
tests/python_build/.*|
2030
platform/android/java/editor/src/main/java/com/android/.*|
2131
platform/android/java/lib/src/com/.*
2232
)
33+
args: ["-style=file:misc/utility/.clang-format-glsl"]
2334

2435
- repo: https://github.com/pocc/pre-commit-hooks
2536
rev: v1.3.5

core/core_bind.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -468,11 +468,11 @@ Error OS::set_thread_name(const String &p_name) {
468468

469469
::Thread::ID OS::get_thread_caller_id() const {
470470
return ::Thread::get_caller_id();
471-
};
471+
}
472472

473473
::Thread::ID OS::get_main_thread_id() const {
474474
return ::Thread::get_main_id();
475-
};
475+
}
476476

477477
bool OS::has_feature(const String &p_feature) const {
478478
const bool *value_ptr = feature_cache.getptr(p_feature);

core/debugger/engine_debugger.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class EngineDebugger {
106106
_FORCE_INLINE_ static EngineDebugger *get_singleton() { return singleton; }
107107
_FORCE_INLINE_ static bool is_active() { return singleton != nullptr && script_debugger != nullptr; }
108108

109-
_FORCE_INLINE_ static ScriptDebugger *get_script_debugger() { return script_debugger; };
109+
_FORCE_INLINE_ static ScriptDebugger *get_script_debugger() { return script_debugger; }
110110

111111
static void initialize(const String &p_uri, bool p_skip_breakpoints, const Vector<String> &p_breakpoints, void (*p_allow_focus_steal_fn)());
112112
static void deinitialize();

core/io/dir_access.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ class DirAccess : public RefCounted {
9696

9797
virtual bool file_exists(String p_file) = 0;
9898
virtual bool dir_exists(String p_dir) = 0;
99-
virtual bool is_readable(String p_dir) { return true; };
100-
virtual bool is_writable(String p_dir) { return true; };
99+
virtual bool is_readable(String p_dir) { return true; }
100+
virtual bool is_writable(String p_dir) { return true; }
101101
static bool exists(const String &p_dir);
102102
virtual uint64_t get_space_left() = 0;
103103

core/io/file_access.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ class FileAccess : public RefCounted {
215215
static bool get_read_only_attribute(const String &p_file);
216216
static Error set_read_only_attribute(const String &p_file, bool p_ro);
217217

218-
static void set_backup_save(bool p_enable) { backup_save = p_enable; };
219-
static bool is_backup_save_enabled() { return backup_save; };
218+
static void set_backup_save(bool p_enable) { backup_save = p_enable; }
219+
static bool is_backup_save_enabled() { return backup_save; }
220220

221221
static String get_md5(const String &p_file);
222222
static String get_sha256(const String &p_file);

core/io/ip.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct _IP_ResolverPrivate {
5151
response.clear();
5252
type = IP::TYPE_NONE;
5353
hostname = "";
54-
};
54+
}
5555

5656
QueueItem() {
5757
clear();

core/io/resource_loader.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ class ResourceLoader {
222222
static ThreadLoadStatus load_threaded_get_status(const String &p_path, float *r_progress = nullptr);
223223
static Ref<Resource> load_threaded_get(const String &p_path, Error *r_error = nullptr);
224224

225-
static bool is_within_load() { return load_nesting > 0; };
225+
static bool is_within_load() { return load_nesting > 0; }
226226

227227
static void resource_changed_connect(Resource *p_source, const Callable &p_callable, uint32_t p_flags);
228228
static void resource_changed_disconnect(Resource *p_source, const Callable &p_callable);

core/math/basis.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ struct [[nodiscard]] Basis {
223223

224224
static Basis looking_at(const Vector3 &p_target, const Vector3 &p_up = Vector3(0, 1, 0), bool p_use_model_front = false);
225225

226-
Basis(const Quaternion &p_quaternion) { set_quaternion(p_quaternion); };
226+
Basis(const Quaternion &p_quaternion) { set_quaternion(p_quaternion); }
227227
Basis(const Quaternion &p_quaternion, const Vector3 &p_scale) { set_quaternion_scale(p_quaternion, p_scale); }
228228

229229
Basis(const Vector3 &p_axis, real_t p_angle) { set_axis_angle(p_axis, p_angle); }

core/math/geometry_2d.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct _AtlasWorkRect {
7676
Size2i s;
7777
Point2i p;
7878
int idx = 0;
79-
_FORCE_INLINE_ bool operator<(const _AtlasWorkRect &p_r) const { return s.width > p_r.s.width; };
79+
_FORCE_INLINE_ bool operator<(const _AtlasWorkRect &p_r) const { return s.width > p_r.s.width; }
8080
};
8181

8282
struct _AtlasWorkRectResult {

core/math/plane.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct [[nodiscard]] Plane {
4040
real_t d = 0;
4141

4242
void set_normal(const Vector3 &p_normal);
43-
_FORCE_INLINE_ Vector3 get_normal() const { return normal; };
43+
_FORCE_INLINE_ Vector3 get_normal() const { return normal; }
4444

4545
void normalize();
4646
Plane normalized() const;

core/object/method_bind.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class MethodBind {
109109
_FORCE_INLINE_ StringName get_instance_class() const { return instance_class; }
110110
_FORCE_INLINE_ void set_instance_class(const StringName &p_class) { instance_class = p_class; }
111111

112-
_FORCE_INLINE_ int get_argument_count() const { return argument_count; };
112+
_FORCE_INLINE_ int get_argument_count() const { return argument_count; }
113113

114114
#ifdef TOOLS_ENABLED
115115
virtual bool is_valid() const { return true; }

core/object/object.h

+12-12
Original file line numberDiff line numberDiff line change
@@ -685,22 +685,22 @@ class Object {
685685
_ALWAYS_INLINE_ const ObjectGDExtension *_get_extension() const { return _extension; }
686686
_ALWAYS_INLINE_ GDExtensionClassInstancePtr _get_extension_instance() const { return _extension_instance; }
687687
virtual void _initialize_classv() { initialize_class(); }
688-
virtual bool _setv(const StringName &p_name, const Variant &p_property) { return false; };
689-
virtual bool _getv(const StringName &p_name, Variant &r_property) const { return false; };
690-
virtual void _get_property_listv(List<PropertyInfo> *p_list, bool p_reversed) const {};
691-
virtual void _validate_propertyv(PropertyInfo &p_property) const {};
692-
virtual bool _property_can_revertv(const StringName &p_name) const { return false; };
693-
virtual bool _property_get_revertv(const StringName &p_name, Variant &r_property) const { return false; };
688+
virtual bool _setv(const StringName &p_name, const Variant &p_property) { return false; }
689+
virtual bool _getv(const StringName &p_name, Variant &r_property) const { return false; }
690+
virtual void _get_property_listv(List<PropertyInfo> *p_list, bool p_reversed) const {}
691+
virtual void _validate_propertyv(PropertyInfo &p_property) const {}
692+
virtual bool _property_can_revertv(const StringName &p_name) const { return false; }
693+
virtual bool _property_get_revertv(const StringName &p_name, Variant &r_property) const { return false; }
694694
virtual void _notificationv(int p_notification, bool p_reversed) {}
695695

696696
static void _bind_methods();
697697
static void _bind_compatibility_methods() {}
698-
bool _set(const StringName &p_name, const Variant &p_property) { return false; };
699-
bool _get(const StringName &p_name, Variant &r_property) const { return false; };
700-
void _get_property_list(List<PropertyInfo> *p_list) const {};
701-
void _validate_property(PropertyInfo &p_property) const {};
702-
bool _property_can_revert(const StringName &p_name) const { return false; };
703-
bool _property_get_revert(const StringName &p_name, Variant &r_property) const { return false; };
698+
bool _set(const StringName &p_name, const Variant &p_property) { return false; }
699+
bool _get(const StringName &p_name, Variant &r_property) const { return false; }
700+
void _get_property_list(List<PropertyInfo> *p_list) const {}
701+
void _validate_property(PropertyInfo &p_property) const {}
702+
bool _property_can_revert(const StringName &p_name) const { return false; }
703+
bool _property_get_revert(const StringName &p_name, Variant &r_property) const { return false; }
704704
void _notification(int p_notification) {}
705705

706706
_FORCE_INLINE_ static void (*_get_bind_methods())() {

core/object/script_language.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,8 @@ class PlaceHolderScriptInstance : public ScriptInstance {
446446
virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = nullptr) const override;
447447
virtual void validate_property(PropertyInfo &p_property) const override {}
448448

449-
virtual bool property_can_revert(const StringName &p_name) const override { return false; };
450-
virtual bool property_get_revert(const StringName &p_name, Variant &r_ret) const override { return false; };
449+
virtual bool property_can_revert(const StringName &p_name) const override { return false; }
450+
virtual bool property_get_revert(const StringName &p_name, Variant &r_ret) const override { return false; }
451451

452452
virtual void get_method_list(List<MethodInfo> *p_list) const override;
453453
virtual bool has_method(const StringName &p_method) const override;

core/os/os.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,14 @@ class OS {
176176
void set_delta_smoothing(bool p_enabled);
177177
bool is_delta_smoothing_enabled() const;
178178

179-
virtual Vector<String> get_system_fonts() const { return Vector<String>(); };
180-
virtual String get_system_font_path(const String &p_font_name, int p_weight = 400, int p_stretch = 100, bool p_italic = false) const { return String(); };
181-
virtual Vector<String> get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale = String(), const String &p_script = String(), int p_weight = 400, int p_stretch = 100, bool p_italic = false) const { return Vector<String>(); };
179+
virtual Vector<String> get_system_fonts() const { return Vector<String>(); }
180+
virtual String get_system_font_path(const String &p_font_name, int p_weight = 400, int p_stretch = 100, bool p_italic = false) const { return String(); }
181+
virtual Vector<String> get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale = String(), const String &p_script = String(), int p_weight = 400, int p_stretch = 100, bool p_italic = false) const { return Vector<String>(); }
182182
virtual String get_executable_path() const;
183183
virtual Error execute(const String &p_path, const List<String> &p_arguments, String *r_pipe = nullptr, int *r_exitcode = nullptr, bool read_stderr = false, Mutex *p_pipe_mutex = nullptr, bool p_open_console = false) = 0;
184184
virtual Dictionary execute_with_pipe(const String &p_path, const List<String> &p_arguments, bool p_blocking = true) { return Dictionary(); }
185185
virtual Error create_process(const String &p_path, const List<String> &p_arguments, ProcessID *r_child_id = nullptr, bool p_open_console = false) = 0;
186-
virtual Error create_instance(const List<String> &p_arguments, ProcessID *r_child_id = nullptr) { return create_process(get_executable_path(), p_arguments, r_child_id); };
186+
virtual Error create_instance(const List<String> &p_arguments, ProcessID *r_child_id = nullptr) { return create_process(get_executable_path(), p_arguments, r_child_id); }
187187
virtual Error kill(const ProcessID &p_pid) = 0;
188188
virtual int get_process_id() const;
189189
virtual bool is_process_running(const ProcessID &p_pid) const = 0;

core/string/translation_domain.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ String TranslationDomain::_double_vowels(const String &p_message) const {
123123
}
124124
}
125125
return res;
126-
};
126+
}
127127

128128
String TranslationDomain::_replace_with_accented_string(const String &p_message) const {
129129
String res;

core/string/ustring.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class Char16String {
118118
Char16String &operator+=(char16_t p_char);
119119
int length() const { return size() ? size() - 1 : 0; }
120120
const char16_t *get_data() const;
121-
operator const char16_t *() const { return get_data(); };
121+
operator const char16_t *() const { return get_data(); }
122122

123123
protected:
124124
void copy_from(const char16_t *p_cstr);
@@ -160,7 +160,7 @@ class CharString {
160160
CharString &operator+=(char p_char);
161161
int length() const { return size() ? size() - 1 : 0; }
162162
const char *get_data() const;
163-
operator const char *() const { return get_data(); };
163+
operator const char *() const { return get_data(); }
164164

165165
protected:
166166
void copy_from(const char *p_cstr);

core/templates/cowdata.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ class CowData {
241241

242242
_FORCE_INLINE_ CowData() {}
243243
_FORCE_INLINE_ ~CowData();
244-
_FORCE_INLINE_ CowData(CowData<T> &p_from) { _ref(p_from); };
244+
_FORCE_INLINE_ CowData(CowData<T> &p_from) { _ref(p_from); }
245245
};
246246

247247
template <typename T>

core/templates/lru.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class LRUCache {
8989
CRASH_COND(!e);
9090
_list.move_to_front(*e);
9191
return (*e)->get().data;
92-
};
92+
}
9393

9494
const TData *getptr(const TKey &p_key) {
9595
Element *e = _map.getptr(p_key);

core/templates/rb_set.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class RBSet {
7676
}
7777
const T &get() const {
7878
return value;
79-
};
79+
}
8080
Element() {}
8181
};
8282

core/typedefs.h

+2
Original file line numberDiff line numberDiff line change
@@ -315,4 +315,6 @@ struct BuildIndexSequence<0, Is...> : IndexSequence<Is...> {};
315315
#define ___gd_is_defined(val) ____gd_is_defined(__GDARG_PLACEHOLDER_##val)
316316
#define GD_IS_DEFINED(x) ___gd_is_defined(x)
317317

318+
#define FORCE_SEMICOLON ;
319+
318320
#endif // TYPEDEFS_H

drivers/coreaudio/audio_driver_coreaudio.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class AudioDriverCoreAudio : public AudioDriver {
8989
public:
9090
virtual const char *get_name() const override {
9191
return "CoreAudio";
92-
};
92+
}
9393

9494
virtual Error init() override;
9595
virtual void start() override;

drivers/d3d12/rendering_device_driver_d3d12.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6583,7 +6583,7 @@ static Error create_command_signature(ID3D12Device *device, D3D12_INDIRECT_ARGUM
65836583
HRESULT res = device->CreateCommandSignature(&cs_desc, nullptr, IID_PPV_ARGS(r_cmd_sig->GetAddressOf()));
65846584
ERR_FAIL_COND_V_MSG(!SUCCEEDED(res), ERR_CANT_CREATE, "CreateCommandSignature failed with error " + vformat("0x%08ux", (uint64_t)res) + ".");
65856585
return OK;
6586-
};
6586+
}
65876587

65886588
Error RenderingDeviceDriverD3D12::_initialize_frames(uint32_t p_frame_count) {
65896589
Error err;

drivers/gles3/storage/config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class Config {
110110
PFNEGLIMAGETARGETTEXTURE2DOESPROC eglEGLImageTargetTexture2DOES = nullptr;
111111
#endif
112112

113-
static Config *get_singleton() { return singleton; };
113+
static Config *get_singleton() { return singleton; }
114114

115115
Config();
116116
~Config();

drivers/gles3/storage/light_storage.h

+11-11
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ class LightStorage : public RendererLightStorage {
306306

307307
/* Light API */
308308

309-
Light *get_light(RID p_rid) { return light_owner.get_or_null(p_rid); };
310-
bool owns_light(RID p_rid) { return light_owner.owns(p_rid); };
309+
Light *get_light(RID p_rid) { return light_owner.get_or_null(p_rid); }
310+
bool owns_light(RID p_rid) { return light_owner.owns(p_rid); }
311311

312312
void _light_initialize(RID p_rid, RS::LightType p_type);
313313

@@ -434,8 +434,8 @@ class LightStorage : public RendererLightStorage {
434434

435435
/* LIGHT INSTANCE API */
436436

437-
LightInstance *get_light_instance(RID p_rid) { return light_instance_owner.get_or_null(p_rid); };
438-
bool owns_light_instance(RID p_rid) { return light_instance_owner.owns(p_rid); };
437+
LightInstance *get_light_instance(RID p_rid) { return light_instance_owner.get_or_null(p_rid); }
438+
bool owns_light_instance(RID p_rid) { return light_instance_owner.owns(p_rid); }
439439

440440
virtual RID light_instance_create(RID p_light) override;
441441
virtual void light_instance_free(RID p_light_instance) override;
@@ -633,8 +633,8 @@ class LightStorage : public RendererLightStorage {
633633

634634
/* PROBE API */
635635

636-
ReflectionProbe *get_reflection_probe(RID p_rid) { return reflection_probe_owner.get_or_null(p_rid); };
637-
bool owns_reflection_probe(RID p_rid) { return reflection_probe_owner.owns(p_rid); };
636+
ReflectionProbe *get_reflection_probe(RID p_rid) { return reflection_probe_owner.get_or_null(p_rid); }
637+
bool owns_reflection_probe(RID p_rid) { return reflection_probe_owner.owns(p_rid); }
638638

639639
virtual RID reflection_probe_allocate() override;
640640
virtual void reflection_probe_initialize(RID p_rid) override;
@@ -715,8 +715,8 @@ class LightStorage : public RendererLightStorage {
715715

716716
/* LIGHTMAP CAPTURE */
717717

718-
Lightmap *get_lightmap(RID p_rid) { return lightmap_owner.get_or_null(p_rid); };
719-
bool owns_lightmap(RID p_rid) { return lightmap_owner.owns(p_rid); };
718+
Lightmap *get_lightmap(RID p_rid) { return lightmap_owner.get_or_null(p_rid); }
719+
bool owns_lightmap(RID p_rid) { return lightmap_owner.owns(p_rid); }
720720

721721
virtual RID lightmap_allocate() override;
722722
virtual void lightmap_initialize(RID p_rid) override;
@@ -739,15 +739,15 @@ class LightStorage : public RendererLightStorage {
739739

740740
/* LIGHTMAP INSTANCE */
741741

742-
LightmapInstance *get_lightmap_instance(RID p_rid) { return lightmap_instance_owner.get_or_null(p_rid); };
743-
bool owns_lightmap_instance(RID p_rid) { return lightmap_instance_owner.owns(p_rid); };
742+
LightmapInstance *get_lightmap_instance(RID p_rid) { return lightmap_instance_owner.get_or_null(p_rid); }
743+
bool owns_lightmap_instance(RID p_rid) { return lightmap_instance_owner.owns(p_rid); }
744744

745745
virtual RID lightmap_instance_create(RID p_lightmap) override;
746746
virtual void lightmap_instance_free(RID p_lightmap) override;
747747
virtual void lightmap_instance_set_transform(RID p_lightmap, const Transform3D &p_transform) override;
748748

749749
/* SHADOW ATLAS API */
750-
bool owns_shadow_atlas(RID p_rid) { return shadow_atlas_owner.owns(p_rid); };
750+
bool owns_shadow_atlas(RID p_rid) { return shadow_atlas_owner.owns(p_rid); }
751751

752752
virtual RID shadow_atlas_create() override;
753753
virtual void shadow_atlas_free(RID p_atlas) override;

drivers/gles3/storage/material_storage.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,8 @@ class MaterialStorage : public RendererMaterialStorage {
576576

577577
/* SHADER API */
578578

579-
Shader *get_shader(RID p_rid) { return shader_owner.get_or_null(p_rid); };
580-
bool owns_shader(RID p_rid) { return shader_owner.owns(p_rid); };
579+
Shader *get_shader(RID p_rid) { return shader_owner.get_or_null(p_rid); }
580+
bool owns_shader(RID p_rid) { return shader_owner.owns(p_rid); }
581581

582582
void _shader_make_dirty(Shader *p_shader);
583583

@@ -598,8 +598,8 @@ class MaterialStorage : public RendererMaterialStorage {
598598

599599
/* MATERIAL API */
600600

601-
Material *get_material(RID p_rid) { return material_owner.get_or_null(p_rid); };
602-
bool owns_material(RID p_rid) { return material_owner.owns(p_rid); };
601+
Material *get_material(RID p_rid) { return material_owner.get_or_null(p_rid); }
602+
bool owns_material(RID p_rid) { return material_owner.owns(p_rid); }
603603

604604
void _material_queue_update(Material *material, bool p_uniform, bool p_texture);
605605
void _update_queued_materials();

0 commit comments

Comments
 (0)