Here are the rules as of writing(quick writeup): The return value/error handling in OpenOCD is very loosely modeled on exceptions in C++/Java/etc. Jim Tcl has exceptions too and the model below fits that reasonably well.
- unless a fn *explicitly* documents it's return values, then the calling code should treat the return value as a boolean success/failure. - the primary return value is *only* used in cases where the calling code may need to take alternate action based on precisely what failed. - the primary return value should be propagated unmodified to the caller. This is *not* done robustly today so anyone relying on checking the return value should not rely on numerous levels of API's to propagate the return value unmodified. - if there are multiple errors, then the *first* error is returned (this applies to queues commands in the JTAG API). - user legible error messages are reported at the site of failure by LOG_ERROR(). These rules should be documented in the developer manual, but this thread will be useful to collect anything I've missed. Patch to fix syntax error handling to follow shortly. -- Øyvind Harboe Embedded software and hardware consulting services http://www.zylin.com _______________________________________________ Openocd-development mailing list [email protected] https://lists.berlios.de/mailman/listinfo/openocd-development
