diff options
author | Sarper Akdemir <q.sarperakdemir@gmail.com> | 2020-06-16 09:33:14 +0300 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2020-06-20 01:41:37 +0200 |
commit | a46ab778d93d535d5866c7d0cc4a609bcf38182e (patch) | |
tree | 60384d26f055cc1632480690c6a4e2a76a4455be /external | |
parent | 81c0b6410ae7a604a97994c7f31113f24665167f (diff) |
box2d: fix strict aliasing error and ignore -Wshadow
Adding two patches to static external library box2d
getting rid of strict aliasing error and ignoring
-Wshadow in b2Draw.h to get rid of errors while building.
Change-Id: I5752eb484d6aafe057c9102b1ed87aaf31d6555c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96559
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'external')
-rw-r--r-- | external/box2d/UnpackedTarball_box2d.mk | 7 | ||||
-rw-r--r-- | external/box2d/disable-shadow-warning-for-drawh.patch | 18 | ||||
-rw-r--r-- | external/box2d/fix-strict-aliasing-error.patch | 13 |
3 files changed, 38 insertions, 0 deletions
diff --git a/external/box2d/UnpackedTarball_box2d.mk b/external/box2d/UnpackedTarball_box2d.mk index 340a17511711..4dd03e69f2d0 100644 --- a/external/box2d/UnpackedTarball_box2d.mk +++ b/external/box2d/UnpackedTarball_box2d.mk @@ -11,4 +11,11 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,box2d)) $(eval $(call gb_UnpackedTarball_set_tarball,box2d,$(BOX2D_TARBALL))) +$(eval $(call gb_UnpackedTarball_set_patchlevel,box2d,1)) + +$(eval $(call gb_UnpackedTarball_add_patches,box2d, \ + external/box2d/fix-strict-aliasing-error.patch \ + external/box2d/disable-shadow-warning-for-drawh.patch \ +)) + # vim: set noet sw=4 ts=4: diff --git a/external/box2d/disable-shadow-warning-for-drawh.patch b/external/box2d/disable-shadow-warning-for-drawh.patch new file mode 100644 index 000000000000..316a6ff9e284 --- /dev/null +++ b/external/box2d/disable-shadow-warning-for-drawh.patch @@ -0,0 +1,18 @@ +diff -ur box2d/Box2D/Box2D/Box2D.h box2d_patched/Box2D/Box2D/Box2D.h +--- box2d/Box2D/Box2D/Box2D.h 2014-04-06 03:43:12.000000000 +0300 ++++ box2d_patched/Box2D/Box2D/Box2D.h 2020-06-17 18:44:25.920658966 +0300 +@@ -32,7 +32,14 @@ + // These include files constitute the main Box2D API
+
+ #include <Box2D/Common/b2Settings.h>
++#if defined __GNUC__
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wshadow"
++#endif
+ #include <Box2D/Common/b2Draw.h>
++#if defined __GNUC__
++#pragma GCC diagnostic pop
++#endif
+ #include <Box2D/Common/b2Timer.h>
+
+ #include <Box2D/Collision/Shapes/b2CircleShape.h>
diff --git a/external/box2d/fix-strict-aliasing-error.patch b/external/box2d/fix-strict-aliasing-error.patch new file mode 100644 index 000000000000..20b5e49eb936 --- /dev/null +++ b/external/box2d/fix-strict-aliasing-error.patch @@ -0,0 +1,13 @@ +diff -ru box2d/Box2D/Box2D/Common/b2Math.h box2d_patched/Box2D/Box2D/Common/b2Math.h +--- box2d/Box2D/Box2D/Common/b2Math.h 2014-04-06 03:43:12.000000000 +0300 ++++ box2d_patched/Box2D/Box2D/Common/b2Math.h 2020-06-16 07:37:31.713248714 +0300 +@@ -25,8 +25,7 @@ + /// This function is used to ensure that a floating point number is not a NaN or infinity.
+ inline bool b2IsValid(float32 x)
+ {
+- int32 ix = *reinterpret_cast<int32*>(&x);
+- return (ix & 0x7f800000) != 0x7f800000;
++ return isfinite(x);
+ }
+
+ /// This is a approximate yet fast inverse square-root.
|