Skip to content

Commit dcd0842

Browse files
authored
Merge pull request #1744 from dsnopek/4.3-cherrypicks-4
Cherry-picks for the godot-cpp 4.3 branch - 4th batch
2 parents f3a1a2f + dacaa81 commit dcd0842

21 files changed

+27
-24
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ jobs:
175175
./run-tests.sh
176176
177177
- name: Upload artifact
178-
uses: actions/upload-artifact@v3
178+
uses: actions/upload-artifact@v4
179179
with:
180180
name: ${{ matrix.artifact-name }}
181181
path: ${{ matrix.artifact-path }}

binding_generator.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,19 @@ def generate_bindings(api_filepath, use_template_get_node, bits="64", precision=
278278
api = {}
279279
with open(api_filepath, encoding="utf-8") as api_file:
280280
api = json.load(api_file)
281-
_generate_bindings(api, use_template_get_node, bits, precision, output_dir)
281+
_generate_bindings(api, api_filepath, use_template_get_node, bits, precision, output_dir)
282282

283283

284-
def _generate_bindings(api, use_template_get_node, bits="64", precision="single", output_dir="."):
284+
def _generate_bindings(api, api_filepath, use_template_get_node, bits="64", precision="single", output_dir="."):
285+
if "precision" in api["header"] and precision != api["header"]["precision"]:
286+
raise Exception(
287+
f"Cannot do a precision={precision} build using '{api_filepath}' which was generated by Godot built with precision={api['header']['precision']}"
288+
)
289+
285290
target_dir = Path(output_dir) / "gen"
286291

287292
shutil.rmtree(target_dir, ignore_errors=True)
288-
target_dir.mkdir(parents=True)
293+
target_dir.mkdir(parents=True, exist_ok=True)
289294

290295
real_t = "double" if precision == "double" else "float"
291296
print("Built-in type config: " + real_t + "_" + bits)

include/godot_cpp/core/defs.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ namespace godot {
7474
#endif
7575
#endif
7676

77-
#ifndef _NO_DISCARD_
78-
#define _NO_DISCARD_ [[nodiscard]]
79-
#endif
80-
8177
// Windows badly defines a lot of stuff we'll never use. Undefine it.
8278
#ifdef _WIN32
8379
#undef min // override standard definition

include/godot_cpp/variant/aabb.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace godot {
4343

4444
class Variant;
4545

46-
struct _NO_DISCARD_ AABB {
46+
struct [[nodiscard]] AABB {
4747
Vector3 position;
4848
Vector3 size;
4949

include/godot_cpp/variant/basis.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
namespace godot {
3939

40-
struct _NO_DISCARD_ Basis {
40+
struct [[nodiscard]] Basis {
4141
Vector3 rows[3] = {
4242
Vector3(1, 0, 0),
4343
Vector3(0, 1, 0),

include/godot_cpp/variant/color.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace godot {
3737

3838
class String;
3939

40-
struct _NO_DISCARD_ Color {
40+
struct [[nodiscard]] Color {
4141
union {
4242
struct {
4343
float r;

include/godot_cpp/variant/plane.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace godot {
3838

3939
class Variant;
4040

41-
struct _NO_DISCARD_ Plane {
41+
struct [[nodiscard]] Plane {
4242
Vector3 normal;
4343
real_t d = 0;
4444

include/godot_cpp/variant/projection.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct Rect2;
4444
struct Transform3D;
4545
struct Vector2;
4646

47-
struct _NO_DISCARD_ Projection {
47+
struct [[nodiscard]] Projection {
4848
enum Planes {
4949
PLANE_NEAR,
5050
PLANE_FAR,

include/godot_cpp/variant/quaternion.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
namespace godot {
3939

40-
struct _NO_DISCARD_ Quaternion {
40+
struct [[nodiscard]] Quaternion {
4141
union {
4242
struct {
4343
real_t x;

include/godot_cpp/variant/rect2.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class String;
4040
struct Rect2i;
4141
struct Transform2D;
4242

43-
struct _NO_DISCARD_ Rect2 {
43+
struct [[nodiscard]] Rect2 {
4444
Point2 position;
4545
Size2 size;
4646

include/godot_cpp/variant/rect2i.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace godot {
3939
class String;
4040
struct Rect2;
4141

42-
struct _NO_DISCARD_ Rect2i {
42+
struct [[nodiscard]] Rect2i {
4343
Point2i position;
4444
Size2i size;
4545

include/godot_cpp/variant/transform2d.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace godot {
3939

4040
class String;
4141

42-
struct _NO_DISCARD_ Transform2D {
42+
struct [[nodiscard]] Transform2D {
4343
// Warning #1: basis of Transform2D is stored differently from Basis. In terms of columns array, the basis matrix looks like "on paper":
4444
// M = (columns[0][0] columns[1][0])
4545
// (columns[0][1] columns[1][1])

include/godot_cpp/variant/transform3d.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
namespace godot {
4141

42-
struct _NO_DISCARD_ Transform3D {
42+
struct [[nodiscard]] Transform3D {
4343
Basis basis;
4444
Vector3 origin;
4545

include/godot_cpp/variant/vector2.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace godot {
3939
class String;
4040
struct Vector2i;
4141

42-
struct _NO_DISCARD_ Vector2 {
42+
struct [[nodiscard]] Vector2 {
4343
static const int AXIS_COUNT = 2;
4444

4545
enum Axis {

include/godot_cpp/variant/vector2i.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace godot {
3939
class String;
4040
struct Vector2;
4141

42-
struct _NO_DISCARD_ Vector2i {
42+
struct [[nodiscard]] Vector2i {
4343
static const int AXIS_COUNT = 2;
4444

4545
enum Axis {

include/godot_cpp/variant/vector3.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct Basis;
4141
struct Vector2;
4242
struct Vector3i;
4343

44-
struct _NO_DISCARD_ Vector3 {
44+
struct [[nodiscard]] Vector3 {
4545
static const int AXIS_COUNT = 3;
4646

4747
enum Axis {

include/godot_cpp/variant/vector3i.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace godot {
3939
class String;
4040
struct Vector3;
4141

42-
struct _NO_DISCARD_ Vector3i {
42+
struct [[nodiscard]] Vector3i {
4343
static const int AXIS_COUNT = 3;
4444

4545
enum Axis {

include/godot_cpp/variant/vector4.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace godot {
3838

3939
class String;
4040

41-
struct _NO_DISCARD_ Vector4 {
41+
struct [[nodiscard]] Vector4 {
4242
static const int AXIS_COUNT = 4;
4343

4444
enum Axis {

include/godot_cpp/variant/vector4i.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace godot {
3939
class String;
4040
struct Vector4;
4141

42-
struct _NO_DISCARD_ Vector4i {
42+
struct [[nodiscard]] Vector4i {
4343
static const int AXIS_COUNT = 4;
4444

4545
enum Axis {

misc/scripts/check_get_file_list.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def test(profile_filepath=""):
1919
api = generate_trimmed_api(api_filepath, profile_filepath)
2020
_generate_bindings(
2121
api,
22+
api_filepath,
2223
use_template_get_node=False,
2324
bits=bits,
2425
precision=precision,

tools/godotcpp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ def scons_generate_bindings(target, source, env):
153153

154154
_generate_bindings(
155155
api,
156+
str(source[0]),
156157
env["generate_template_get_node"],
157158
"32" if "32" in env["arch"] else "64",
158159
env["precision"],

0 commit comments

Comments
 (0)