godot/thirdparty/clipper2/patches/clipper2-exceptions.patch
2024-11-26 17:23:06 +01:00

39 lines
1.3 KiB
Diff

diff --git a/thirdparty/clipper2/include/clipper2/clipper.core.h b/thirdparty/clipper2/include/clipper2/clipper.core.h
index 925c04685e..d0d159b949 100644
--- a/thirdparty/clipper2/include/clipper2/clipper.core.h
+++ b/thirdparty/clipper2/include/clipper2/clipper.core.h
@@ -22,6 +22,8 @@
#include <optional>
#include "clipper2/clipper.version.h"
+#define CLIPPER2_THROW(exception) std::abort()
+
namespace Clipper2Lib
{
@@ -79,18 +81,18 @@ namespace Clipper2Lib
switch (error_code)
{
case precision_error_i:
- throw Clipper2Exception(precision_error);
+ CLIPPER2_THROW(Clipper2Exception(precision_error));
case scale_error_i:
- throw Clipper2Exception(scale_error);
+ CLIPPER2_THROW(Clipper2Exception(scale_error));
case non_pair_error_i:
- throw Clipper2Exception(non_pair_error);
+ CLIPPER2_THROW(Clipper2Exception(non_pair_error));
case undefined_error_i:
- throw Clipper2Exception(undefined_error);
+ CLIPPER2_THROW(Clipper2Exception(undefined_error));
case range_error_i:
- throw Clipper2Exception(range_error);
+ CLIPPER2_THROW(Clipper2Exception(range_error));
}
#else
- ++error_code; // only to stop compiler warning
+ if(error_code) {}; // only to stop compiler 'parameter not used' warning
#endif
}