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

File tree

21 files changed

+27
-24
lines changed

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

0 commit comments

Comments
 (0)