Skip to content

Commit 1b688b3

Browse files
committed
Merge pull request #24 from Spartan322/4.3-merge/dcd0842
[4.3] Merge commit godotengine/godot-cpp@dcd0842
2 parents d43bbf1 + 5f5371e commit 1b688b3

20 files changed

+26
-23
lines changed

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
@@ -76,10 +76,6 @@ namespace godot {
7676
#endif
7777
#endif
7878

79-
#ifndef _NO_DISCARD_
80-
#define _NO_DISCARD_ [[nodiscard]]
81-
#endif
82-
8379
// Windows badly defines a lot of stuff we'll never use. Undefine it.
8480
#ifdef _WIN32
8581
#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
@@ -45,7 +45,7 @@ namespace godot {
4545

4646
class Variant;
4747

48-
struct _NO_DISCARD_ AABB {
48+
struct [[nodiscard]] AABB {
4949
Vector3 position;
5050
Vector3 size;
5151

include/godot_cpp/variant/basis.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_ Basis {
42+
struct [[nodiscard]] Basis {
4343
Vector3 rows[3] = {
4444
Vector3(1, 0, 0),
4545
Vector3(0, 1, 0),

include/godot_cpp/variant/color.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_ Color {
42+
struct [[nodiscard]] Color {
4343
union {
4444
struct {
4545
float r;

include/godot_cpp/variant/plane.hpp

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

4141
class Variant;
4242

43-
struct _NO_DISCARD_ Plane {
43+
struct [[nodiscard]] Plane {
4444
Vector3 normal;
4545
real_t d = 0;
4646

include/godot_cpp/variant/projection.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct Rect2;
4646
struct Transform3D;
4747
struct Vector2;
4848

49-
struct _NO_DISCARD_ Projection {
49+
struct [[nodiscard]] Projection {
5050
enum Planes {
5151
PLANE_NEAR,
5252
PLANE_FAR,

include/godot_cpp/variant/quaternion.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_ Quaternion {
42+
struct [[nodiscard]] Quaternion {
4343
union {
4444
struct {
4545
real_t x;

include/godot_cpp/variant/rect2.hpp

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

45-
struct _NO_DISCARD_ Rect2 {
45+
struct [[nodiscard]] Rect2 {
4646
Point2 position;
4747
Size2 size;
4848

include/godot_cpp/variant/rect2i.hpp

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

44-
struct _NO_DISCARD_ Rect2i {
44+
struct [[nodiscard]] Rect2i {
4545
Point2i position;
4646
Size2i size;
4747

0 commit comments

Comments
 (0)