From b8a8e18f0321d004aa6cb65027db60138d513499 Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Sat, 17 Apr 2021 13:06:40 -0700 Subject: [PATCH] build cleanup and compiler warning fixes --- .efrocachemap | 72 +++++++++++------------ ballisticacore-cmake/CMakeLists.txt | 6 ++ docs/ba_module.md | 2 +- src/ballistica/ballistica.cc | 2 +- src/ballistica/config/config_common.h | 7 +++ src/ballistica/python/python_ref.cc | 4 +- src/ballistica/python/python_ref.h | 4 +- src/ballistica/scene/node/globals_node.cc | 7 +++ src/ballistica/scene/node/image_node.cc | 7 +++ src/ballistica/scene/node/locator_node.cc | 7 +++ src/ballistica/scene/node/math_node.cc | 7 +++ src/ballistica/scene/node/text_node.cc | 30 +++++++++- 12 files changed, 112 insertions(+), 43 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 232f7f0a..55c63405 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -3932,40 +3932,40 @@ "assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450", "assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e", "assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f", - "build/prefab/full/linux_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/62/31/a37cdb8b09708e1b7baa2bc850d0", - "build/prefab/full/linux_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/9c/ef/53f1a4f8cd022a45d1dd6b78877c", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/cc/25/89793f1dffed5399670a7be984e9", - "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ad/ec/5248cc95f3d571134baf49326bc8", - "build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/56/e9/c64efa4b33da651307fdde82d92d", - "build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/2e/07/10fd15da19ff193fe9cfadbb9728", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/19/4c/532f72262b96bc430b13a08c4487", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/0e/7c/f5d943f2f9bf880c43344e3fd8b9", - "build/prefab/full/mac_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/7b/96/74495cc24209c4748ec7fbe8dbe7", - "build/prefab/full/mac_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/87/74/050531b74ee6cf022997f10777a4", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/dd/6d/16ac603bcbef622fe29a308aa3e1", - "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4a/8a/0783912a78d4a00ab23797939930", - "build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/12/33/82ab3f324fbbf93f15a98656332d", - "build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/f2/23/240f6d1622a05aa5d7ac9688e5e5", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/cb/92/26c57679642264307bf67b01dfd3", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/46/9e/d7bdd9e3064b2026ca56119a216f", - "build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/37/72/63da6ec9d6cc51fdb34afb784c7a", - "build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/91/77/970ecaf47ab3ab030389303cc702", - "build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/6c/31/af0f0b90cd7daf4caecae038d9ce", - "build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/3b/68/9335089fe131604cc17316394c8a", - "build/prefab/lib/linux_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f9/5e/0b3d4382868febea6e0c06bd6970", - "build/prefab/lib/linux_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/30/93/b590bbc5789ad59b2e2f989d031b", - "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/5c/14/ce7e7f3c36fcf354b1f42ee898d8", - "build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2b/d4/401fab96a7facb8c829bd9af519f", - "build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e1/bf/68b302f2a2a2edd8a99b8d8059fa", - "build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/79/9d/72486e5b1362bfef604df6039e5e", - "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/06/6c/d1160c00a5784a597e01020f756d", - "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9a/1b/25820981463dce651050d65a31ec", - "build/prefab/lib/mac_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7c/ca/1fe0a7498b30f5cba5cc5d7a929d", - "build/prefab/lib/mac_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f9/a0/440b08a7b714d07e478e9d87562c", - "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/40/88/0da1a96b27ec85d69df7543826a2", - "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/6f/9e/afe9bf9e21afa3e88f325a49ae55", - "build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/29/6a/980bdc6eda01178b1fa8b6cc1a96", - "build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7c/9a/2acbbf0f331aeb842cfaa9eb18b4", - "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/78/7a/a4c857aab1579c0a16ac8fd1d28e", - "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/95/1e/062f738754933f84fe66a69a2a5e" + "build/prefab/full/linux_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/1b/bd/ca5aac2df8e9fc06eb21febc85e5", + "build/prefab/full/linux_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/49/23/8330aa9093b7028e2b9f66efe6ed", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/9e/f0/7dc1dfcd4a1e0089372fd8f0b38d", + "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/07/57/9a27c31da13fd10c6a258cf96042", + "build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/e6/fc/58397d506755a96691d78552301d", + "build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/91/58/a5e6fe96641fbb37a13b7717da80", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d1/67/7069fb57377ded8444df4951e125", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/34/42/2515c5660c442f82266f313d7883", + "build/prefab/full/mac_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/4a/bf/d7726f987839d286a1c0f35f34e2", + "build/prefab/full/mac_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/14/da/634d6181b405f8f064e9ca139c5a", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/81/71/8d524fa69b6a1f9db9ae0d31c729", + "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/19/aa/89ee3de03653d800e6b536182c90", + "build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/b5/a4/19f10a233009f698a3baa7345f37", + "build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/8a/d6/da87df6432e8e491aa83d39044ac", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/6b/75/227b9ea6b0ce0a8aeeb97fd0e6e1", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/07/4d/d766bfc836a7091408c008c02c26", + "build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/2e/a9/f1c9909d5dee1d6ea721f824d34b", + "build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/2c/d8/0d22397844653557810ee01258cb", + "build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/b4/e3/068a4e4885b07c662aed557f02d1", + "build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/d4/16/545c3b55ae305b1a35bebec1af48", + "build/prefab/lib/linux_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b7/6e/9e62c5daa7ebd640f73aa4105dc9", + "build/prefab/lib/linux_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/5e/0f/c157ced802e04c0d74ce8cf4ce84", + "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/23/27/1610c8533aed71a835e2a95b64c7", + "build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/83/94/bda40769e333dbe9b0bcb08061ff", + "build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/3f/e5/ac0ca3e1e34130b54afafdbf4f9a", + "build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/0f/f7/f7ff933c91852602aadc4af02f5b", + "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/78/5b/de61880a1c37d77fef5ea71c4f18", + "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/71/18/348b78b44229e2245eb5cf18a9ab", + "build/prefab/lib/mac_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/59/cf/18ec30179cfffd6a46fe21830bdb", + "build/prefab/lib/mac_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/12/e2/c8e875584cba55144c9749158d32", + "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/38/57/2bb2231f21c1f27a9967fa7e926f", + "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ca/14/36dfdbc635e01ca8d29b2a0ee5b0", + "build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1e/cd/fd09fbc2118ebf07301549937e3f", + "build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/27/74/12ca6720a2d3dfadb9da317ad3cc", + "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f6/9d/4f2e7ebd06f1e3092a02af6c62af", + "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f9/f1/6a0cb794c1810327b256a77cbc51" } \ No newline at end of file diff --git a/ballisticacore-cmake/CMakeLists.txt b/ballisticacore-cmake/CMakeLists.txt index ac2c32d5..a2e95531 100644 --- a/ballisticacore-cmake/CMakeLists.txt +++ b/ballisticacore-cmake/CMakeLists.txt @@ -87,6 +87,12 @@ add_compile_options(-include ballistica/config/config_cmake.h) if (CMAKE_BUILD_TYPE MATCHES Debug) add_definitions(-DBA_DEBUG_BUILD=1) +else () + # It seems that cmake can choose -O2 sometimes and -O3 sometimes + # for release builds (depending on Release vs RelWithDebInfo, etc). + # Let's keep all our non-debug builds consistent at -O3 for now; can + # revisit if it causes problems. + add_definitions(-O3) endif () set(ODE_SRC_ROOT ${BA_SRC_ROOT}/external/open_dynamics_engine-ef) diff --git a/docs/ba_module.md b/docs/ba_module.md index 51583232..bbac691e 100644 --- a/docs/ba_module.md +++ b/docs/ba_module.md @@ -1,5 +1,5 @@ -

last updated on 2021-04-15 for Ballistica version 1.6.0 build 20339

+

last updated on 2021-04-17 for Ballistica version 1.6.0 build 20342

This page documents the Python classes and functions in the 'ba' module, which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please let me know. Happy modding!


diff --git a/src/ballistica/ballistica.cc b/src/ballistica/ballistica.cc index be822958..44bd8cfa 100644 --- a/src/ballistica/ballistica.cc +++ b/src/ballistica/ballistica.cc @@ -21,7 +21,7 @@ namespace ballistica { // These are set automatically via script; don't change here. -const int kAppBuildNumber = 20342; +const int kAppBuildNumber = 20343; const char* kAppVersion = "1.6.0"; // Our standalone globals. diff --git a/src/ballistica/config/config_common.h b/src/ballistica/config/config_common.h index ef5197f7..664b7cb2 100644 --- a/src/ballistica/config/config_common.h +++ b/src/ballistica/config/config_common.h @@ -8,6 +8,13 @@ #include #include +// Universal sanity checks. +#if !BA_DEBUG_BUILD +#if !NDEBUG +#error NDEBUG should be defined for all non-debug builds. +#endif // !NDEBUG +#endif // !BA_DEBUG_BUILD + // This header should be included at the very END of each platform config // header that will be directly used by a build. namespace ballistica { diff --git a/src/ballistica/python/python_ref.cc b/src/ballistica/python/python_ref.cc index 329fbfe3..e5be1ae5 100644 --- a/src/ballistica/python/python_ref.cc +++ b/src/ballistica/python/python_ref.cc @@ -19,7 +19,7 @@ PythonRef::PythonRef(PyObject* obj_in, ReferenceBehavior b) { case kSteal: Steal(obj_in); break; - case kStealWeak: + case kStealSoft: if (obj_in) { Steal(obj_in); } @@ -27,7 +27,7 @@ PythonRef::PythonRef(PyObject* obj_in, ReferenceBehavior b) { case kAcquire: Acquire(obj_in); break; - case kAcquireWeak: + case kAcquireSoft: if (obj_in) { Acquire(obj_in); break; diff --git a/src/ballistica/python/python_ref.h b/src/ballistica/python/python_ref.h index 5f26d38c..6eecd5b2 100644 --- a/src/ballistica/python/python_ref.h +++ b/src/ballistica/python/python_ref.h @@ -19,13 +19,13 @@ class PythonRef { kSteal, /// Steal the provided object reference or set as unreferenced if it is /// nullptr. - kStealWeak, + kStealSoft, /// Acquire a new reference to the provided object (and throw an Exception /// if it is nullptr). kAcquire, /// Acquire a new reference to the provided object or set as unreferenced if /// it is nullptr. - kAcquireWeak + kAcquireSoft }; /// Creates in an unreferenced state. diff --git a/src/ballistica/scene/node/globals_node.cc b/src/ballistica/scene/node/globals_node.cc index 28b1f215..9cc39704 100644 --- a/src/ballistica/scene/node/globals_node.cc +++ b/src/ballistica/scene/node/globals_node.cc @@ -352,6 +352,13 @@ auto GlobalsNode::GetCameraMode() const -> std::string { case CameraMode::kFollow: return "follow"; } + + // This should be unreachable, but most compilers complain about + // control reaching the end of non-void function without it. +#pragma clang diagnostic push +#pragma ide diagnostic ignored "UnreachableCode" + throw Exception(); +#pragma clang diagnostic pop } void GlobalsNode::SetCameraMode(const std::string& val) { diff --git a/src/ballistica/scene/node/image_node.cc b/src/ballistica/scene/node/image_node.cc index 309d3be1..c9e1d723 100644 --- a/src/ballistica/scene/node/image_node.cc +++ b/src/ballistica/scene/node/image_node.cc @@ -94,6 +94,13 @@ auto ImageNode::GetAttach() const -> std::string { case Attach::CENTER_LEFT: return "centerLeft"; } + + // This should be unreachable, but most compilers complain about + // control reaching the end of non-void function without it. +#pragma clang diagnostic push +#pragma ide diagnostic ignored "UnreachableCode" + throw Exception(); +#pragma clang diagnostic pop } void ImageNode::SetAttach(const std::string& val) { diff --git a/src/ballistica/scene/node/locator_node.cc b/src/ballistica/scene/node/locator_node.cc index 48c4a04f..319ed2b3 100644 --- a/src/ballistica/scene/node/locator_node.cc +++ b/src/ballistica/scene/node/locator_node.cc @@ -54,6 +54,13 @@ auto LocatorNode::getShape() const -> std::string { case Shape::kLocator: return "locator"; } + + // This should be unreachable, but most compilers complain about + // control reaching the end of non-void function without it. +#pragma clang diagnostic push +#pragma ide diagnostic ignored "UnreachableCode" + throw Exception(); +#pragma clang diagnostic pop } void LocatorNode::SetShape(const std::string& val) { diff --git a/src/ballistica/scene/node/math_node.cc b/src/ballistica/scene/node/math_node.cc index 1054bfca..3fa0662f 100644 --- a/src/ballistica/scene/node/math_node.cc +++ b/src/ballistica/scene/node/math_node.cc @@ -47,6 +47,13 @@ auto MathNode::GetOperation() const -> std::string { case Operation::kSin: return "sin"; } + + // This should be unreachable, but most compilers complain about + // control reaching the end of non-void function without it. +#pragma clang diagnostic push +#pragma ide diagnostic ignored "UnreachableCode" + throw Exception(); +#pragma clang diagnostic pop } void MathNode::SetOperation(const std::string& val) { diff --git a/src/ballistica/scene/node/text_node.cc b/src/ballistica/scene/node/text_node.cc index 8a73f839..10a0c0f8 100644 --- a/src/ballistica/scene/node/text_node.cc +++ b/src/ballistica/scene/node/text_node.cc @@ -143,6 +143,13 @@ auto TextNode::GetHAlign() const -> std::string { case HAlign::kCenter: return "center"; } + + // This should be unreachable, but most compilers complain about + // control reaching the end of non-void function without it. +#pragma clang diagnostic push +#pragma ide diagnostic ignored "UnreachableCode" + throw Exception(); +#pragma clang diagnostic pop } void TextNode::SetHAlign(const std::string& val) { @@ -169,6 +176,13 @@ auto TextNode::GetVAlign() const -> std::string { case VAlign::kNone: return "none"; } + + // This should be unreachable, but most compilers complain about + // control reaching the end of non-void function without it. +#pragma clang diagnostic push +#pragma ide diagnostic ignored "UnreachableCode" + throw Exception(); +#pragma clang diagnostic pop } void TextNode::SetVAlign(const std::string& val) { @@ -195,6 +209,13 @@ auto TextNode::GetHAttach() const -> std::string { case HAttach::kCenter: return "center"; } + + // This should be unreachable, but most compilers complain about + // control reaching the end of non-void function without it. +#pragma clang diagnostic push +#pragma ide diagnostic ignored "UnreachableCode" + throw Exception(); +#pragma clang diagnostic pop } void TextNode::SetHAttach(const std::string& val) { @@ -219,6 +240,13 @@ auto TextNode::GetVAttach() const -> std::string { case VAttach::kCenter: return "center"; } + + // This should be unreachable, but most compilers complain about + // control reaching the end of non-void function without it. +#pragma clang diagnostic push +#pragma ide diagnostic ignored "UnreachableCode" + throw Exception(); +#pragma clang diagnostic pop } void TextNode::SetVAttach(const std::string& val) { @@ -326,7 +354,7 @@ void TextNode::Draw(FrameDef* frame_def) { text_width_dirty_ = true; } - if (text_translated_.size() <= 0.0f) { + if (text_translated_.empty()) { return; }