fix: Adapt to rapidyaml 0.11’s callback changes#1313
fix: Adapt to rapidyaml 0.11’s callback changes#1313musicinmybrain wants to merge 2 commits intogoogle:masterfrom
Conversation
|
Testing this downstream in Fedora, combined with @jcpunk’s other recent updates and with a proposed rapidyaml 0.11.1 update, it does compile but I do still see one test failure: I don’t really know what to make of that output. |
|
I believe the newer rapidyaml doesn't output detailed pointers to the failure where 0.10.0 did. With In jsonnet b3f1e52 might be related |
|
I’ve pushed a follow-up commit to upgrade the vendored We could deal with the change in error output described in #1313 (comment) like this: diff --git a/test_suite/error.std_parseYaml1.jsonnet.golden b/test_suite/error.std_parseYaml1.jsonnet.golden
index 6d8b54b..460f2b5 100644
--- a/test_suite/error.std_parseYaml1.jsonnet.golden
+++ b/test_suite/error.std_parseYaml1.jsonnet.golden
@@ -1,5 +1,3 @@
RUNTIME ERROR: YAML error: 1:6: ERROR: two colons on same line
-1:6: a: b: (size=5)
- ^ (cols 6-6)
error.std_parseYaml1.jsonnet:1:1-23 However, we still have this to contend with: The expectation that failures will exit with code jsonnet/test_suite/run_tests.sh Lines 37 to 40 in 5aec27e Following the |
|
Ok, I did manage to reproduce this in a git checkout and capture a backtrace: Now, this results in the Excerpting the most relevant stack frames: So this is coming from the explicit [[noreturn]] C4_NO_INLINE void error_parse_impl(csubstr msg, ErrorDataParse const& errdata, void * /*user_data*/)
{
err_parse_format(dump2stderr, msg, errdata);
endmsg();
#ifdef _RYML_WITH_EXCEPTIONS
throw ExceptionParse(msg, errdata);
#else
abort(); // LCOV_EXCL_LINE
#endif
}… and looking at the definitions of the callbacks, /** the type of the function used to report basic errors.
*
* @warning Must not return. When implemented by the user, this
* function MUST interrupt execution (and ideally be marked with
* `[[noreturn]]`). If the function returned, the caller could enter
* into an infinite loop, or the program may crash. It is up to the
* user to choose the interruption mechanism; typically by either
* throwing an exception, or using `std::longjmp()` ([see
* documentation](https://en.cppreference.com/w/cpp/utility/program/setjmp))
* or ultimately by calling `std::abort()`. */
using pfn_error_basic = void (*) (csubstr msg, ErrorDataBasic const& errdata, void *user_data);
/** the type of the function used to report parse errors.
*
* @warning Must not return. When implemented by the user, this
* function MUST interrupt execution (and ideally be marked with
* `[[noreturn]]`). If the function returned, the caller could enter
* into an infinite loop, or the program may crash. It is up to the
* user to choose the interruption mechanism; typically by either
* throwing an exception, or using `std::longjmp()` ([see
* documentation](https://en.cppreference.com/w/cpp/utility/program/setjmp))
* or ultimately by calling `std::abort()`. */
using pfn_error_parse = void (*) (csubstr msg, ErrorDataParse const& errdata, void *user_data);
/** the type of the function used to report visit errors.
*
* @warning Must not return. When implemented by the user, this
* function MUST interrupt execution (and ideally be marked with
* `[[noreturn]]`). If the function returned, the caller could enter
* into an infinite loop, or the program may crash. It is up to the
* user to choose the interruption mechanism; typically by either
* throwing an exception, or using `std::longjmp()` ([see
* documentation](https://en.cppreference.com/w/cpp/utility/program/setjmp))
* or ultimately by calling `std::abort()`. */
using pfn_error_visit = void (*) (csubstr msg, ErrorDataVisit const& errdata, void *user_data);I see that they are required to either abort or raise an exception. I conclude that this PR should just be treated as a starting point, and further design work by someone actively involved in jsonnet development is going to be required to decide what should really happen here. |
Fixes #1312.
FYI, @jcpunk.