Refactor compiler warning handling.
Compiler warnings are now accumulated in a vector of strings within the mjSpec object. New API functions `mjs_numWarnings` and `mjs_getWarning` are added to access these warnings. The compiler's log handler now chains warnings to the global log handler, ensuring they are still displayed immediately. Call sites in `mj_loadXML`, `mj_compile`, and the Python and WASM bindings have been updated to use the new warning API. PiperOrigin-RevId: 933361650 Change-Id: I47cab98a460c57b0898c0a1a43fce2a5b9648eb1
This commit is contained in:
committed by
Copybara-Service
parent
55c6332f20
commit
6f8bb5ef55
@@ -1015,9 +1015,14 @@ MJAPI const char* mjs_getError(mjSpec* s);
|
||||
// Get compiler timing diagnostics from spec, returns pointer to array of size mjNCTIMER.
|
||||
MJAPI const double* mjs_getTimer(mjSpec* s);
|
||||
|
||||
// Return 1 if compiler error is a warning.
|
||||
// Return 1 if compiler error is a warning. Deprecated: use mjs_numWarnings(s) > 0.
|
||||
MJAPI int mjs_isWarning(mjSpec* s);
|
||||
|
||||
// Get number of warnings accumulated in the spec.
|
||||
MJAPI int mjs_numWarnings(const mjSpec* spec);
|
||||
|
||||
// Get the i-th warning message (returns nullptr if index out of bounds).
|
||||
MJAPI const char* mjs_getWarning(const mjSpec* spec, int index);
|
||||
|
||||
//---------------------------------- Standard math -------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user