diff --git a/doc/APIreference/functions.rst b/doc/APIreference/functions.rst index 7a409cc2..10dd03da 100644 --- a/doc/APIreference/functions.rst +++ b/doc/APIreference/functions.rst @@ -1980,24 +1980,6 @@ Error and memory Main error function; does not return to caller. -.. _mju_error_i: - -`mju_error_i <#mju_error_i>`__ -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. mujoco-include:: mju_error_i - -Deprecated: use mju_error. - -.. _mju_error_s: - -`mju_error_s <#mju_error_s>`__ -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. mujoco-include:: mju_error_s - -Deprecated: use mju_error. - .. _mju_warning: `mju_warning <#mju_warning>`__ @@ -2007,24 +1989,6 @@ Deprecated: use mju_error. Main warning function; returns to caller. -.. _mju_warning_i: - -`mju_warning_i <#mju_warning_i>`__ -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. mujoco-include:: mju_warning_i - -Deprecated: use mju_warning. - -.. _mju_warning_s: - -`mju_warning_s <#mju_warning_s>`__ -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. mujoco-include:: mju_warning_s - -Deprecated: use mju_warning. - .. _mju_clearHandlers: `mju_clearHandlers <#mju_clearHandlers>`__ diff --git a/doc/changelog.rst b/doc/changelog.rst index 2eaddeb0..4ef058ea 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -21,16 +21,14 @@ General :class: attention - The header file ``mjthread.h`` was removed along with the old engine threading API. - - **Migration:** Use :ref:`mju_threadpool` to set number of worker threads for the engine. - + |br| **Migration:** Use :ref:`mju_threadpool` to set number of worker threads for the engine. - Moved island sparse matrix construction from :ref:`mj_island` (single threaded) into :ref:`mj_fwdConstraint` (multi-threaded). The island-specific matrices ``iM, iLD, iefc_J`` were removed from the arena and are now allocated on the stack. - - Following the introduction of the :ref:`diagexact` flag, the ``mjData`` field ``efc_diagApprox`` was renamed to ``efc_diagA``, as it can now be either the exact or approximate diagonal of the :math:`A` ("Delassus") matrix. + - The deprecated functions ``mju_{error,warning}_{i,s}`` have been removed. Bug fixes ^^^^^^^^^ @@ -2145,7 +2143,7 @@ General `__ model, which previously required ~500,000 ``mjtNum``'s, now only requires ~6000. Very large models can now load and run with the CG solver. #. Modified :ref:`mju_error` and :ref:`mju_warning` to be variadic functions (support for printf-like arguments). The - functions :ref:`mju_error_i`, :ref:`mju_error_s`, :ref:`mju_warning_i`, and :ref:`mju_warning_s` are now deprecated. + functions ``mju_error_i``, ``mju_error_s``, ``mju_warning_i``, and ``mju_warning_s`` are now deprecated. #. Implemented a performant ``mju_sqrMatTDSparse`` function that doesn't require dense memory allocation. #. Added ``mj_stackAllocInt`` to get correct size for allocating ints on mjData stack. Reducing stack memory usage by 10% - 15%. diff --git a/doc/includes/references.h b/doc/includes/references.h index 32828541..520785a7 100644 --- a/doc/includes/references.h +++ b/doc/includes/references.h @@ -3457,11 +3457,7 @@ void mjui_update(int section, int item, const mjUI* ui, mjuiItem* mjui_event(mjUI* ui, mjuiState* state, const mjrContext* con); void mjui_render(mjUI* ui, const mjuiState* state, const mjrContext* con); void mju_error(const char* msg, ...) mjPRINTFLIKE(1, 2); -void mju_error_i(const char* msg, int i); -void mju_error_s(const char* msg, const char* text); void mju_warning(const char* msg, ...) mjPRINTFLIKE(1, 2); -void mju_warning_i(const char* msg, int i); -void mju_warning_s(const char* msg, const char* text); void mju_clearHandlers(void); void* mju_malloc(size_t size); void mju_free(void* ptr); diff --git a/include/mujoco/mujoco.h b/include/mujoco/mujoco.h index 1af40764..10c0a6e6 100644 --- a/include/mujoco/mujoco.h +++ b/include/mujoco/mujoco.h @@ -972,21 +972,9 @@ MJAPI void mjui_render(mjUI* ui, const mjuiState* state, const mjrContext* con); // Main error function; does not return to caller. MJAPI void mju_error(const char* msg, ...) mjPRINTFLIKE(1, 2); -// Deprecated: use mju_error. -MJAPI void mju_error_i(const char* msg, int i); - -// Deprecated: use mju_error. -MJAPI void mju_error_s(const char* msg, const char* text); - // Main warning function; returns to caller. MJAPI void mju_warning(const char* msg, ...) mjPRINTFLIKE(1, 2); -// Deprecated: use mju_warning. -MJAPI void mju_warning_i(const char* msg, int i); - -// Deprecated: use mju_warning. -MJAPI void mju_warning_s(const char* msg, const char* text); - // Clear user error and memory handlers. MJAPI void mju_clearHandlers(void); diff --git a/python/mujoco/introspect/functions.py b/python/mujoco/introspect/functions.py index 5deefe3c..5fc5cf92 100644 --- a/python/mujoco/introspect/functions.py +++ b/python/mujoco/introspect/functions.py @@ -6288,44 +6288,6 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([ ), doc='Main error function; does not return to caller.', )), - ('mju_error_i', - FunctionDecl( - name='mju_error_i', - return_type=ValueType(name='void'), - parameters=( - FunctionParameterDecl( - name='msg', - type=PointerType( - inner_type=ValueType(name='char', is_const=True), - ), - ), - FunctionParameterDecl( - name='i', - type=ValueType(name='int'), - ), - ), - doc='Deprecated: use mju_error.', - )), - ('mju_error_s', - FunctionDecl( - name='mju_error_s', - return_type=ValueType(name='void'), - parameters=( - FunctionParameterDecl( - name='msg', - type=PointerType( - inner_type=ValueType(name='char', is_const=True), - ), - ), - FunctionParameterDecl( - name='text', - type=PointerType( - inner_type=ValueType(name='char', is_const=True), - ), - ), - ), - doc='Deprecated: use mju_error.', - )), ('mju_warning', FunctionDecl( name='mju_warning', @@ -6340,44 +6302,6 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([ ), doc='Main warning function; returns to caller.', )), - ('mju_warning_i', - FunctionDecl( - name='mju_warning_i', - return_type=ValueType(name='void'), - parameters=( - FunctionParameterDecl( - name='msg', - type=PointerType( - inner_type=ValueType(name='char', is_const=True), - ), - ), - FunctionParameterDecl( - name='i', - type=ValueType(name='int'), - ), - ), - doc='Deprecated: use mju_warning.', - )), - ('mju_warning_s', - FunctionDecl( - name='mju_warning_s', - return_type=ValueType(name='void'), - parameters=( - FunctionParameterDecl( - name='msg', - type=PointerType( - inner_type=ValueType(name='char', is_const=True), - ), - ), - FunctionParameterDecl( - name='text', - type=PointerType( - inner_type=ValueType(name='char', is_const=True), - ), - ), - ), - doc='Deprecated: use mju_warning.', - )), ('mju_clearHandlers', FunctionDecl( name='mju_clearHandlers', diff --git a/src/engine/engine_util_errmem.c b/src/engine/engine_util_errmem.c index f44e2a24..07a6aed0 100644 --- a/src/engine/engine_util_errmem.c +++ b/src/engine/engine_util_errmem.c @@ -169,30 +169,6 @@ void mju_warning(const char* msg, ...) { } -// error with int argument -void mju_error_i(const char* msg, int i) { - mju_error(msg, i); -} - - -// warning with int argument -void mju_warning_i(const char* msg, int i) { - mju_warning(msg, i); -} - - -// error string argument -void mju_error_s(const char* msg, const char* text) { - mju_error(msg, text); -} - - -// warning string argument -void mju_warning_s(const char* msg, const char* text) { - mju_warning(msg, text); -} - - //------------------------------ malloc and free --------------------------------------------------- // allocate memory; byte-align on 64; pad size to multiple of 64 diff --git a/src/engine/engine_util_errmem.h b/src/engine/engine_util_errmem.h index 10623c93..a1b791d2 100644 --- a/src/engine/engine_util_errmem.h +++ b/src/engine/engine_util_errmem.h @@ -58,13 +58,9 @@ MJAPI void _mjPRIVATE__set_tls_warning_fn(void (*h)(const char*)); MJAPI void mju_error_raw(const char* msg); MJAPI void mju_error(const char* msg, ...) mjPRINTFLIKE(1, 2); MJAPI void mju_error_v(const char* msg, va_list args); -MJAPI void mju_error_i(const char* msg, int i); -MJAPI void mju_error_s(const char* msg, const char* text); // warnings MJAPI void mju_warning(const char* msg, ...) mjPRINTFLIKE(1, 2); -MJAPI void mju_warning_i(const char* msg, int i); -MJAPI void mju_warning_s(const char* msg, const char* text); // write [datetime, type: message] to MUJOCO_LOG.TXT MJAPI void mju_writeLog(const char* type, const char* msg); diff --git a/test/engine/engine_util_errmem_test.cc b/test/engine/engine_util_errmem_test.cc index 1b398f5d..41754952 100644 --- a/test/engine/engine_util_errmem_test.cc +++ b/test/engine/engine_util_errmem_test.cc @@ -68,70 +68,6 @@ class MujocoErrorAndWarningTest : public ::testing::Test { } }; -TEST_F(MujocoErrorAndWarningTest, MjuErrorI) { - std::string format_string = "%010d"; - while (format_string.length() < 2 * kBufferSize) { - format_string += 'x'; - } - - std::string expected_message = "0123456789"; - while (expected_message.length() < kBufferSize - 1) { - expected_message += 'x'; - } - - ClearErrorMessage(); - mju_error_i(format_string.c_str(), 123456789); - EXPECT_EQ(std::string(ErrorMessageBuffer()), expected_message); -} - -TEST_F(MujocoErrorAndWarningTest, MjuWarningI) { - std::string format_string = "%010d"; - while (format_string.length() < 2 * kBufferSize) { - format_string += 'x'; - } - - std::string expected_message = "0123456789"; - while (expected_message.length() < kBufferSize - 1) { - expected_message += 'x'; - } - - ClearWarningMessage(); - mju_warning_i(format_string.c_str(), 123456789); - EXPECT_EQ(std::string(WarningMessageBuffer()), expected_message); -} - -TEST_F(MujocoErrorAndWarningTest, MjuErrorS) { - std::string format_string = "% 9s"; - while (format_string.length() < 2 * kBufferSize) { - format_string += 'z'; - } - - std::string expected_message = " foobar"; - while (expected_message.length() < kBufferSize - 1) { - expected_message += 'z'; - } - - ClearErrorMessage(); - mju_error_s(format_string.c_str(), "foobar"); - EXPECT_EQ(std::string(ErrorMessageBuffer()), expected_message); -} - -TEST_F(MujocoErrorAndWarningTest, MjuWarningS) { - std::string format_string = "% 9s"; - while (format_string.length() < 2 * kBufferSize) { - format_string += 'z'; - } - - std::string expected_message = " foobar"; - while (expected_message.length() < kBufferSize - 1) { - expected_message += 'z'; - } - - ClearWarningMessage(); - mju_warning_s(format_string.c_str(), "foobar"); - EXPECT_EQ(std::string(WarningMessageBuffer()), expected_message); -} - TEST_F(MujocoErrorAndWarningTest, MjuErrorInternal) { ClearErrorMessage(); mjERROR("foobar %d", 123); diff --git a/unity/Runtime/Bindings/MjBindings.cs b/unity/Runtime/Bindings/MjBindings.cs index 69877044..49b99f3c 100644 --- a/unity/Runtime/Bindings/MjBindings.cs +++ b/unity/Runtime/Bindings/MjBindings.cs @@ -7224,21 +7224,9 @@ public static unsafe extern void mjui_render(mjUI_* ui, mjuiState_* state, mjrCo [DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)] public static unsafe extern void mju_error([MarshalAs(UnmanagedType.LPStr)]string msg); -[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)] -public static unsafe extern void mju_error_i([MarshalAs(UnmanagedType.LPStr)]string msg, int i); - -[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)] -public static unsafe extern void mju_error_s([MarshalAs(UnmanagedType.LPStr)]string msg, [MarshalAs(UnmanagedType.LPStr)]string text); - [DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)] public static unsafe extern void mju_warning([MarshalAs(UnmanagedType.LPStr)]string msg); -[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)] -public static unsafe extern void mju_warning_i([MarshalAs(UnmanagedType.LPStr)]string msg, int i); - -[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)] -public static unsafe extern void mju_warning_s([MarshalAs(UnmanagedType.LPStr)]string msg, [MarshalAs(UnmanagedType.LPStr)]string text); - [DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)] public static unsafe extern void mju_clearHandlers(); diff --git a/wasm/codegen/generators/constants.py b/wasm/codegen/generators/constants.py index 9a20444d..7a826e09 100644 --- a/wasm/codegen/generators/constants.py +++ b/wasm/codegen/generators/constants.py @@ -147,14 +147,10 @@ _SKIPPED_MEMORY_FUNCTIONS: tuple[str, ...] = ( "mju_boxQPmalloc", "mju_clearHandlers", "mju_error", - "mju_error_i", - "mju_error_s", "mju_free", "mju_malloc", "mju_strncpy", "mju_warning", - "mju_warning_i", - "mju_warning_s", # go/keep-sorted end )