Remove deprecated mju_{error,warning}_{i,s} functions.
PiperOrigin-RevId: 925204136 Change-Id: Ia877d08a135092db8037d04e6a237e81325a1d7c
This commit is contained in:
committed by
Copybara-Service
parent
ad23db5942
commit
062b0f1ea6
@@ -1980,24 +1980,6 @@ Error and memory
|
|||||||
|
|
||||||
Main error function; does not return to caller.
|
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 <#mju_warning>`__
|
`mju_warning <#mju_warning>`__
|
||||||
@@ -2007,24 +1989,6 @@ Deprecated: use mju_error.
|
|||||||
|
|
||||||
Main warning function; returns to caller.
|
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 <#mju_clearHandlers>`__
|
`mju_clearHandlers <#mju_clearHandlers>`__
|
||||||
|
|||||||
+3
-5
@@ -21,16 +21,14 @@ General
|
|||||||
:class: attention
|
:class: attention
|
||||||
|
|
||||||
- The header file ``mjthread.h`` was removed along with the old engine threading API.
|
- The header file ``mjthread.h`` was removed along with the old engine threading API.
|
||||||
|
|br| **Migration:** Use :ref:`mju_threadpool` to set number of worker threads for the engine.
|
||||||
**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`
|
- 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
|
(multi-threaded). The island-specific matrices ``iM, iLD, iefc_J`` were removed from the arena and are now
|
||||||
allocated on the stack.
|
allocated on the stack.
|
||||||
|
|
||||||
- Following the introduction of the :ref:`diagexact<option-flag-diagexact>` flag, the ``mjData`` field
|
- Following the introduction of the :ref:`diagexact<option-flag-diagexact>` flag, the ``mjData`` field
|
||||||
``efc_diagApprox`` was renamed to ``efc_diagA``, as it can now be either the exact or approximate diagonal of
|
``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 :math:`A` ("Delassus") matrix.
|
||||||
|
- The deprecated functions ``mju_{error,warning}_{i,s}`` have been removed.
|
||||||
|
|
||||||
Bug fixes
|
Bug fixes
|
||||||
^^^^^^^^^
|
^^^^^^^^^
|
||||||
@@ -2145,7 +2143,7 @@ General
|
|||||||
<https://github.com/google-deepmind/mujoco/blob/main/model/humanoid/humanoid100.xml>`__ model, which previously
|
<https://github.com/google-deepmind/mujoco/blob/main/model/humanoid/humanoid100.xml>`__ model, which previously
|
||||||
required ~500,000 ``mjtNum``'s, now only requires ~6000. Very large models can now load and run with the CG solver.
|
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
|
#. 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.
|
#. 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
|
#. Added ``mj_stackAllocInt`` to get correct size for allocating ints on mjData stack. Reducing stack memory usage
|
||||||
by 10% - 15%.
|
by 10% - 15%.
|
||||||
|
|||||||
@@ -3457,11 +3457,7 @@ void mjui_update(int section, int item, const mjUI* ui,
|
|||||||
mjuiItem* mjui_event(mjUI* ui, mjuiState* state, const mjrContext* con);
|
mjuiItem* mjui_event(mjUI* ui, mjuiState* state, const mjrContext* con);
|
||||||
void mjui_render(mjUI* ui, const 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(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(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_clearHandlers(void);
|
||||||
void* mju_malloc(size_t size);
|
void* mju_malloc(size_t size);
|
||||||
void mju_free(void* ptr);
|
void mju_free(void* ptr);
|
||||||
|
|||||||
@@ -972,21 +972,9 @@ MJAPI void mjui_render(mjUI* ui, const mjuiState* state, const mjrContext* con);
|
|||||||
// Main error function; does not return to caller.
|
// Main error function; does not return to caller.
|
||||||
MJAPI void mju_error(const char* msg, ...) mjPRINTFLIKE(1, 2);
|
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.
|
// Main warning function; returns to caller.
|
||||||
MJAPI void mju_warning(const char* msg, ...) mjPRINTFLIKE(1, 2);
|
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.
|
// Clear user error and memory handlers.
|
||||||
MJAPI void mju_clearHandlers(void);
|
MJAPI void mju_clearHandlers(void);
|
||||||
|
|
||||||
|
|||||||
@@ -6288,44 +6288,6 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
|
|||||||
),
|
),
|
||||||
doc='Main error function; does not return to caller.',
|
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',
|
('mju_warning',
|
||||||
FunctionDecl(
|
FunctionDecl(
|
||||||
name='mju_warning',
|
name='mju_warning',
|
||||||
@@ -6340,44 +6302,6 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
|
|||||||
),
|
),
|
||||||
doc='Main warning function; returns to caller.',
|
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',
|
('mju_clearHandlers',
|
||||||
FunctionDecl(
|
FunctionDecl(
|
||||||
name='mju_clearHandlers',
|
name='mju_clearHandlers',
|
||||||
|
|||||||
@@ -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 ---------------------------------------------------
|
//------------------------------ malloc and free ---------------------------------------------------
|
||||||
|
|
||||||
// allocate memory; byte-align on 64; pad size to multiple of 64
|
// allocate memory; byte-align on 64; pad size to multiple of 64
|
||||||
|
|||||||
@@ -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_raw(const char* msg);
|
||||||
MJAPI void mju_error(const char* msg, ...) mjPRINTFLIKE(1, 2);
|
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_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
|
// warnings
|
||||||
MJAPI void mju_warning(const char* msg, ...) mjPRINTFLIKE(1, 2);
|
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
|
// write [datetime, type: message] to MUJOCO_LOG.TXT
|
||||||
MJAPI void mju_writeLog(const char* type, const char* msg);
|
MJAPI void mju_writeLog(const char* type, const char* msg);
|
||||||
|
|||||||
@@ -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) {
|
TEST_F(MujocoErrorAndWarningTest, MjuErrorInternal) {
|
||||||
ClearErrorMessage();
|
ClearErrorMessage();
|
||||||
mjERROR("foobar %d", 123);
|
mjERROR("foobar %d", 123);
|
||||||
|
|||||||
@@ -7224,21 +7224,9 @@ public static unsafe extern void mjui_render(mjUI_* ui, mjuiState_* state, mjrCo
|
|||||||
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static unsafe extern void mju_error([MarshalAs(UnmanagedType.LPStr)]string msg);
|
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)]
|
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static unsafe extern void mju_warning([MarshalAs(UnmanagedType.LPStr)]string msg);
|
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)]
|
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static unsafe extern void mju_clearHandlers();
|
public static unsafe extern void mju_clearHandlers();
|
||||||
|
|
||||||
|
|||||||
@@ -147,14 +147,10 @@ _SKIPPED_MEMORY_FUNCTIONS: tuple[str, ...] = (
|
|||||||
"mju_boxQPmalloc",
|
"mju_boxQPmalloc",
|
||||||
"mju_clearHandlers",
|
"mju_clearHandlers",
|
||||||
"mju_error",
|
"mju_error",
|
||||||
"mju_error_i",
|
|
||||||
"mju_error_s",
|
|
||||||
"mju_free",
|
"mju_free",
|
||||||
"mju_malloc",
|
"mju_malloc",
|
||||||
"mju_strncpy",
|
"mju_strncpy",
|
||||||
"mju_warning",
|
"mju_warning",
|
||||||
"mju_warning_i",
|
|
||||||
"mju_warning_s",
|
|
||||||
# go/keep-sorted end
|
# go/keep-sorted end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user