Skip to content

Commit

Permalink
Set clang-format RemoveSemicolon rule to true
Browse files Browse the repository at this point in the history
- Set clang-format `Standard` rule to `c++20`
- Add core/macros.h
  • Loading branch information
adamscott committed Oct 7, 2024
1 parent db66bd3 commit 120802c
Show file tree
Hide file tree
Showing 170 changed files with 606 additions and 572 deletions.
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ PackConstructorInitializers: NextLine
# ReflowComments: true
# RemoveBracesLLVM: false
# RemoveParentheses: Leave
# RemoveSemicolon: false
RemoveSemicolon: true
# RequiresClausePosition: OwnLine
# RequiresExpressionIndentation: OuterScope
# SeparateDefinitionBlocks: Leave
Expand Down Expand Up @@ -231,7 +231,7 @@ SpacesInLineCommentPrefix:
# InEmptyParentheses: false
# Other: false
# SpacesInSquareBrackets: false
Standard: c++17
Standard: c++20
# StatementAttributeLikeMacros:
# - Q_EMIT
# StatementMacros:
Expand Down
4 changes: 2 additions & 2 deletions core/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,11 +468,11 @@ Error OS::set_thread_name(const String &p_name) {

::Thread::ID OS::get_thread_caller_id() const {
return ::Thread::get_caller_id();
};
}

::Thread::ID OS::get_main_thread_id() const {
return ::Thread::get_main_id();
};
}

bool OS::has_feature(const String &p_feature) const {
const bool *value_ptr = feature_cache.getptr(p_feature);
Expand Down
2 changes: 1 addition & 1 deletion core/debugger/engine_debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class EngineDebugger {
_FORCE_INLINE_ static EngineDebugger *get_singleton() { return singleton; }
_FORCE_INLINE_ static bool is_active() { return singleton != nullptr && script_debugger != nullptr; }

_FORCE_INLINE_ static ScriptDebugger *get_script_debugger() { return script_debugger; };
_FORCE_INLINE_ static ScriptDebugger *get_script_debugger() { return script_debugger; }

static void initialize(const String &p_uri, bool p_skip_breakpoints, const Vector<String> &p_breakpoints, void (*p_allow_focus_steal_fn)());
static void deinitialize();
Expand Down
4 changes: 2 additions & 2 deletions core/io/dir_access.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ class DirAccess : public RefCounted {

virtual bool file_exists(String p_file) = 0;
virtual bool dir_exists(String p_dir) = 0;
virtual bool is_readable(String p_dir) { return true; };
virtual bool is_writable(String p_dir) { return true; };
virtual bool is_readable(String p_dir) { return true; }
virtual bool is_writable(String p_dir) { return true; }
static bool exists(const String &p_dir);
virtual uint64_t get_space_left() = 0;

Expand Down
4 changes: 2 additions & 2 deletions core/io/file_access.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ class FileAccess : public RefCounted {
static bool get_read_only_attribute(const String &p_file);
static Error set_read_only_attribute(const String &p_file, bool p_ro);

static void set_backup_save(bool p_enable) { backup_save = p_enable; };
static bool is_backup_save_enabled() { return backup_save; };
static void set_backup_save(bool p_enable) { backup_save = p_enable; }
static bool is_backup_save_enabled() { return backup_save; }

static String get_md5(const String &p_file);
static String get_sha256(const String &p_file);
Expand Down
2 changes: 1 addition & 1 deletion core/io/ip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct _IP_ResolverPrivate {
response.clear();
type = IP::TYPE_NONE;
hostname = "";
};
}

QueueItem() {
clear();
Expand Down
2 changes: 1 addition & 1 deletion core/io/resource_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class ResourceLoader {
static ThreadLoadStatus load_threaded_get_status(const String &p_path, float *r_progress = nullptr);
static Ref<Resource> load_threaded_get(const String &p_path, Error *r_error = nullptr);

static bool is_within_load() { return load_nesting > 0; };
static bool is_within_load() { return load_nesting > 0; }

static void resource_changed_connect(Resource *p_source, const Callable &p_callable, uint32_t p_flags);
static void resource_changed_disconnect(Resource *p_source, const Callable &p_callable);
Expand Down
36 changes: 36 additions & 0 deletions core/macros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**************************************************************************/
/* macros.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef MACROS_H
#define MACROS_H

#define FORCE_SEMICOLON ;

#endif // MACROS_H
2 changes: 1 addition & 1 deletion core/math/basis.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ struct [[nodiscard]] Basis {

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

Basis(const Quaternion &p_quaternion) { set_quaternion(p_quaternion); };
Basis(const Quaternion &p_quaternion) { set_quaternion(p_quaternion); }
Basis(const Quaternion &p_quaternion, const Vector3 &p_scale) { set_quaternion_scale(p_quaternion, p_scale); }

Basis(const Vector3 &p_axis, real_t p_angle) { set_axis_angle(p_axis, p_angle); }
Expand Down
2 changes: 1 addition & 1 deletion core/math/geometry_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct _AtlasWorkRect {
Size2i s;
Point2i p;
int idx = 0;
_FORCE_INLINE_ bool operator<(const _AtlasWorkRect &p_r) const { return s.width > p_r.s.width; };
_FORCE_INLINE_ bool operator<(const _AtlasWorkRect &p_r) const { return s.width > p_r.s.width; }
};

struct _AtlasWorkRectResult {
Expand Down
2 changes: 1 addition & 1 deletion core/math/plane.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct [[nodiscard]] Plane {
real_t d = 0;

void set_normal(const Vector3 &p_normal);
_FORCE_INLINE_ Vector3 get_normal() const { return normal; };
_FORCE_INLINE_ Vector3 get_normal() const { return normal; }

void normalize();
Plane normalized() const;
Expand Down
2 changes: 1 addition & 1 deletion core/object/method_bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class MethodBind {
_FORCE_INLINE_ StringName get_instance_class() const { return instance_class; }
_FORCE_INLINE_ void set_instance_class(const StringName &p_class) { instance_class = p_class; }

_FORCE_INLINE_ int get_argument_count() const { return argument_count; };
_FORCE_INLINE_ int get_argument_count() const { return argument_count; }

#ifdef TOOLS_ENABLED
virtual bool is_valid() const { return true; }
Expand Down
24 changes: 12 additions & 12 deletions core/object/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -685,22 +685,22 @@ class Object {
_ALWAYS_INLINE_ const ObjectGDExtension *_get_extension() const { return _extension; }
_ALWAYS_INLINE_ GDExtensionClassInstancePtr _get_extension_instance() const { return _extension_instance; }
virtual void _initialize_classv() { initialize_class(); }
virtual bool _setv(const StringName &p_name, const Variant &p_property) { return false; };
virtual bool _getv(const StringName &p_name, Variant &r_property) const { return false; };
virtual void _get_property_listv(List<PropertyInfo> *p_list, bool p_reversed) const {};
virtual void _validate_propertyv(PropertyInfo &p_property) const {};
virtual bool _property_can_revertv(const StringName &p_name) const { return false; };
virtual bool _property_get_revertv(const StringName &p_name, Variant &r_property) const { return false; };
virtual bool _setv(const StringName &p_name, const Variant &p_property) { return false; }
virtual bool _getv(const StringName &p_name, Variant &r_property) const { return false; }
virtual void _get_property_listv(List<PropertyInfo> *p_list, bool p_reversed) const {}
virtual void _validate_propertyv(PropertyInfo &p_property) const {}
virtual bool _property_can_revertv(const StringName &p_name) const { return false; }
virtual bool _property_get_revertv(const StringName &p_name, Variant &r_property) const { return false; }
virtual void _notificationv(int p_notification, bool p_reversed) {}

static void _bind_methods();
static void _bind_compatibility_methods() {}
bool _set(const StringName &p_name, const Variant &p_property) { return false; };
bool _get(const StringName &p_name, Variant &r_property) const { return false; };
void _get_property_list(List<PropertyInfo> *p_list) const {};
void _validate_property(PropertyInfo &p_property) const {};
bool _property_can_revert(const StringName &p_name) const { return false; };
bool _property_get_revert(const StringName &p_name, Variant &r_property) const { return false; };
bool _set(const StringName &p_name, const Variant &p_property) { return false; }
bool _get(const StringName &p_name, Variant &r_property) const { return false; }
void _get_property_list(List<PropertyInfo> *p_list) const {}
void _validate_property(PropertyInfo &p_property) const {}
bool _property_can_revert(const StringName &p_name) const { return false; }
bool _property_get_revert(const StringName &p_name, Variant &r_property) const { return false; }
void _notification(int p_notification) {}

_FORCE_INLINE_ static void (*_get_bind_methods())() {
Expand Down
4 changes: 2 additions & 2 deletions core/object/script_language.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,8 @@ class PlaceHolderScriptInstance : public ScriptInstance {
virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = nullptr) const override;
virtual void validate_property(PropertyInfo &p_property) const override {}

virtual bool property_can_revert(const StringName &p_name) const override { return false; };
virtual bool property_get_revert(const StringName &p_name, Variant &r_ret) const override { return false; };
virtual bool property_can_revert(const StringName &p_name) const override { return false; }
virtual bool property_get_revert(const StringName &p_name, Variant &r_ret) const override { return false; }

virtual void get_method_list(List<MethodInfo> *p_list) const override;
virtual bool has_method(const StringName &p_method) const override;
Expand Down
8 changes: 4 additions & 4 deletions core/os/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ class OS {
void set_delta_smoothing(bool p_enabled);
bool is_delta_smoothing_enabled() const;

virtual Vector<String> get_system_fonts() const { return Vector<String>(); };
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(); };
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>(); };
virtual Vector<String> get_system_fonts() const { return Vector<String>(); }
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(); }
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>(); }
virtual String get_executable_path() const;
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;
virtual Dictionary execute_with_pipe(const String &p_path, const List<String> &p_arguments, bool p_blocking = true) { return Dictionary(); }
virtual Error create_process(const String &p_path, const List<String> &p_arguments, ProcessID *r_child_id = nullptr, bool p_open_console = false) = 0;
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); };
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); }
virtual Error kill(const ProcessID &p_pid) = 0;
virtual int get_process_id() const;
virtual bool is_process_running(const ProcessID &p_pid) const = 0;
Expand Down
2 changes: 1 addition & 1 deletion core/string/translation_domain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ String TranslationDomain::_double_vowels(const String &p_message) const {
}
}
return res;
};
}

String TranslationDomain::_replace_with_accented_string(const String &p_message) const {
String res;
Expand Down
4 changes: 2 additions & 2 deletions core/string/ustring.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class Char16String {
Char16String &operator+=(char16_t p_char);
int length() const { return size() ? size() - 1 : 0; }
const char16_t *get_data() const;
operator const char16_t *() const { return get_data(); };
operator const char16_t *() const { return get_data(); }

protected:
void copy_from(const char16_t *p_cstr);
Expand Down Expand Up @@ -160,7 +160,7 @@ class CharString {
CharString &operator+=(char p_char);
int length() const { return size() ? size() - 1 : 0; }
const char *get_data() const;
operator const char *() const { return get_data(); };
operator const char *() const { return get_data(); }

protected:
void copy_from(const char *p_cstr);
Expand Down
2 changes: 1 addition & 1 deletion core/templates/cowdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class CowData {

_FORCE_INLINE_ CowData() {}
_FORCE_INLINE_ ~CowData();
_FORCE_INLINE_ CowData(CowData<T> &p_from) { _ref(p_from); };
_FORCE_INLINE_ CowData(CowData<T> &p_from) { _ref(p_from); }
};

template <typename T>
Expand Down
2 changes: 1 addition & 1 deletion core/templates/lru.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class LRUCache {
CRASH_COND(!e);
_list.move_to_front(*e);
return (*e)->get().data;
};
}

const TData *getptr(const TKey &p_key) {
Element *e = _map.getptr(p_key);
Expand Down
2 changes: 1 addition & 1 deletion core/templates/rb_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class RBSet {
}
const T &get() const {
return value;
};
}
Element() {}
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/coreaudio/audio_driver_coreaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class AudioDriverCoreAudio : public AudioDriver {
public:
virtual const char *get_name() const override {
return "CoreAudio";
};
}

virtual Error init() override;
virtual void start() override;
Expand Down
2 changes: 1 addition & 1 deletion drivers/d3d12/rendering_device_driver_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6574,7 +6574,7 @@ static Error create_command_signature(ID3D12Device *device, D3D12_INDIRECT_ARGUM
HRESULT res = device->CreateCommandSignature(&cs_desc, nullptr, IID_PPV_ARGS(r_cmd_sig->GetAddressOf()));
ERR_FAIL_COND_V_MSG(!SUCCEEDED(res), ERR_CANT_CREATE, "CreateCommandSignature failed with error " + vformat("0x%08ux", (uint64_t)res) + ".");
return OK;
};
}

Error RenderingDeviceDriverD3D12::_initialize_frames(uint32_t p_frame_count) {
Error err;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gles3/storage/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class Config {
PFNEGLIMAGETARGETTEXTURE2DOESPROC eglEGLImageTargetTexture2DOES = nullptr;
#endif

static Config *get_singleton() { return singleton; };
static Config *get_singleton() { return singleton; }

Config();
~Config();
Expand Down
22 changes: 11 additions & 11 deletions drivers/gles3/storage/light_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ class LightStorage : public RendererLightStorage {

/* Light API */

Light *get_light(RID p_rid) { return light_owner.get_or_null(p_rid); };
bool owns_light(RID p_rid) { return light_owner.owns(p_rid); };
Light *get_light(RID p_rid) { return light_owner.get_or_null(p_rid); }
bool owns_light(RID p_rid) { return light_owner.owns(p_rid); }

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

Expand Down Expand Up @@ -431,8 +431,8 @@ class LightStorage : public RendererLightStorage {

/* LIGHT INSTANCE API */

LightInstance *get_light_instance(RID p_rid) { return light_instance_owner.get_or_null(p_rid); };
bool owns_light_instance(RID p_rid) { return light_instance_owner.owns(p_rid); };
LightInstance *get_light_instance(RID p_rid) { return light_instance_owner.get_or_null(p_rid); }
bool owns_light_instance(RID p_rid) { return light_instance_owner.owns(p_rid); }

virtual RID light_instance_create(RID p_light) override;
virtual void light_instance_free(RID p_light_instance) override;
Expand Down Expand Up @@ -630,8 +630,8 @@ class LightStorage : public RendererLightStorage {

/* PROBE API */

ReflectionProbe *get_reflection_probe(RID p_rid) { return reflection_probe_owner.get_or_null(p_rid); };
bool owns_reflection_probe(RID p_rid) { return reflection_probe_owner.owns(p_rid); };
ReflectionProbe *get_reflection_probe(RID p_rid) { return reflection_probe_owner.get_or_null(p_rid); }
bool owns_reflection_probe(RID p_rid) { return reflection_probe_owner.owns(p_rid); }

virtual RID reflection_probe_allocate() override;
virtual void reflection_probe_initialize(RID p_rid) override;
Expand Down Expand Up @@ -712,8 +712,8 @@ class LightStorage : public RendererLightStorage {

/* LIGHTMAP CAPTURE */

Lightmap *get_lightmap(RID p_rid) { return lightmap_owner.get_or_null(p_rid); };
bool owns_lightmap(RID p_rid) { return lightmap_owner.owns(p_rid); };
Lightmap *get_lightmap(RID p_rid) { return lightmap_owner.get_or_null(p_rid); }
bool owns_lightmap(RID p_rid) { return lightmap_owner.owns(p_rid); }

virtual RID lightmap_allocate() override;
virtual void lightmap_initialize(RID p_rid) override;
Expand All @@ -736,15 +736,15 @@ class LightStorage : public RendererLightStorage {

/* LIGHTMAP INSTANCE */

LightmapInstance *get_lightmap_instance(RID p_rid) { return lightmap_instance_owner.get_or_null(p_rid); };
bool owns_lightmap_instance(RID p_rid) { return lightmap_instance_owner.owns(p_rid); };
LightmapInstance *get_lightmap_instance(RID p_rid) { return lightmap_instance_owner.get_or_null(p_rid); }
bool owns_lightmap_instance(RID p_rid) { return lightmap_instance_owner.owns(p_rid); }

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

/* SHADOW ATLAS API */
bool owns_shadow_atlas(RID p_rid) { return shadow_atlas_owner.owns(p_rid); };
bool owns_shadow_atlas(RID p_rid) { return shadow_atlas_owner.owns(p_rid); }

virtual RID shadow_atlas_create() override;
virtual void shadow_atlas_free(RID p_atlas) override;
Expand Down
8 changes: 4 additions & 4 deletions drivers/gles3/storage/material_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@ class MaterialStorage : public RendererMaterialStorage {

/* SHADER API */

Shader *get_shader(RID p_rid) { return shader_owner.get_or_null(p_rid); };
bool owns_shader(RID p_rid) { return shader_owner.owns(p_rid); };
Shader *get_shader(RID p_rid) { return shader_owner.get_or_null(p_rid); }
bool owns_shader(RID p_rid) { return shader_owner.owns(p_rid); }

void _shader_make_dirty(Shader *p_shader);

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

/* MATERIAL API */

Material *get_material(RID p_rid) { return material_owner.get_or_null(p_rid); };
bool owns_material(RID p_rid) { return material_owner.owns(p_rid); };
Material *get_material(RID p_rid) { return material_owner.get_or_null(p_rid); }
bool owns_material(RID p_rid) { return material_owner.owns(p_rid); }

void _material_queue_update(Material *material, bool p_uniform, bool p_texture);
void _update_queued_materials();
Expand Down
Loading

0 comments on commit 120802c

Please sign in to comment.