Skip to content

Commit 1cf573f

Browse files
committed
Merge pull request #105887 from Repiteo/core/modernize-headers
Core: Modernize C headers with C++ equivalents
2 parents f45e6d7 + 01fc9ae commit 1cf573f

File tree

101 files changed

+126
-168
lines changed

Some content is hidden

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

101 files changed

+126
-168
lines changed

.clang-tidy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Checks:
22
- -*
33
- cppcoreguidelines-pro-type-member-init
4+
- modernize-deprecated-headers
45
- modernize-redundant-void-arg
56
- modernize-use-bool-literals
67
- modernize-use-default-member-init
@@ -14,6 +15,7 @@ FormatStyle: file
1415
CheckOptions:
1516
cppcoreguidelines-pro-type-member-init.IgnoreArrays: true
1617
cppcoreguidelines-pro-type-member-init.UseAssignment: true
18+
modernize-deprecated-headers.CheckHeaderFile: true
1719
modernize-use-bool-literals.IgnoreMacros: false
1820
modernize-use-default-member-init.IgnoreMacros: false
1921
modernize-use-default-member-init.UseAssignment: true

core/extension/gdextension_interface.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343
#include "core/variant/variant.h"
4444
#include "core/version.h"
4545

46-
#include <string.h>
47-
4846
class CallableCustomExtension : public CallableCustom {
4947
void *userdata;
5048
void *token;

core/extension/gdextension_interface.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,16 @@
3434
* Together with the JSON file, you should be able to generate any binder.
3535
*/
3636

37+
#ifndef __cplusplus
3738
#include <stddef.h>
3839
#include <stdint.h>
3940

40-
#ifndef __cplusplus
4141
typedef uint32_t char32_t;
4242
typedef uint16_t char16_t;
43-
#endif
43+
#else
44+
#include <cstddef>
45+
#include <cstdint>
4446

45-
#ifdef __cplusplus
4647
extern "C" {
4748
#endif
4849

core/io/ip_address.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ IPAddress::operator Variant() const {
3434
return operator String();
3535
}*/
3636

37-
#include <string.h>
38-
3937
IPAddress::operator String() const {
4038
if (wildcard) {
4139
return "*";

core/io/logger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "core/string/ustring.h"
3636
#include "core/templates/vector.h"
3737

38-
#include <stdarg.h>
38+
#include <cstdarg>
3939

4040
class RegEx;
4141

core/io/marshalls.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
#include "core/object/script_language.h"
3636
#include "core/variant/container_type_validate.h"
3737

38-
#include <limits.h>
39-
#include <stdio.h>
38+
#include <climits>
39+
#include <cstdio>
4040

4141
void EncodedObjectAsID::_bind_methods() {
4242
ClassDB::bind_method(D_METHOD("set_object_id", "id"), &EncodedObjectAsID::set_object_id);

core/math/bvh_tree.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
#include "core/math/vector3.h"
4444
#include "core/templates/local_vector.h"
4545
#include "core/templates/pooled_list.h"
46-
#include <limits.h>
46+
47+
#include <climits>
4748

4849
#define BVHABB_CLASS BVH_ABB<BOUNDS, POINT>
4950

core/math/convex_hull.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ subject to the following restrictions:
8888
#endif
8989

9090
#if defined(DEBUG_CONVEX_HULL) || defined(SHOW_ITERATIONS)
91-
#include <stdio.h>
91+
#include <cstdio>
9292
#endif
9393

9494
// Convex hull implementation based on Preparata and Hong

core/object/message_queue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "core/object/class_db.h"
3535
#include "core/object/script_language.h"
3636

37-
#include <stdio.h>
37+
#include <cstdio>
3838

3939
#ifdef DEV_ENABLED
4040
// Includes safety checks to ensure that a queue set as a thread singleton override

core/os/memory.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232

3333
#include "core/templates/safe_refcount.h"
3434

35-
#include <stdlib.h>
36-
#include <string.h>
35+
#include <cstdlib>
3736

3837
void *operator new(size_t p_size, const char *p_description) {
3938
return Memory::alloc_static(p_size, false);

0 commit comments

Comments
 (0)