<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 11, 2021 at 3:12 PM Gedare Bloom <<a href="mailto:gedare@rtems.org">gedare@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, Feb 11, 2021 at 1:28 PM Ryan Long <<a href="mailto:thisisryanlong@gmail.com" target="_blank">thisisryanlong@gmail.com</a>> wrote:<br>
><br>
> These macros are to be used to check the status from calls that are flagged by<br>
> Coverity as 'Unchecked return value'.<br>
> ---<br>
> cpukit/include/rtems/score/assert.h | 30 ++++++++++++++++++++++++++++++<br>
> 1 file changed, 30 insertions(+)<br>
><br>
> diff --git a/cpukit/include/rtems/score/assert.h b/cpukit/include/rtems/score/assert.h<br>
> index cc32448..7efaae4 100644<br>
> --- a/cpukit/include/rtems/score/assert.h<br>
> +++ b/cpukit/include/rtems/score/assert.h<br>
> @@ -99,6 +99,36 @@ extern "C" {<br>
> #endif<br>
><br>
> /**<br>
> + * @brief Assert if unused return value is equal.<br>
Improve this phrase: "is equal to an expected status." maybe<br>
<br>
> + *<br>
> + * Assert whether @a _status and @a _value are equal and ensure @a _status is<br>
s/whether/that<br>
<br>
> + * marked as used when not building for debug.<br>
> + *<br>
> + * @param _status The return value to be checked.<br>
> + * @param _value Indicates what @a _status is supposed to be.<br>
> + */<br>
> +#define _Assert_Unused_return_value_equal(_status,_value) \<br>
I think "value_is_equal" will be better.<br>
<br>
I think the name should be more clear that _status is a variable.<br>
Maybe, _status_variable<br></blockquote><div><br></div><div>When the name is long, it had a tendency to wrap. Got a shorter suggestion? </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Since a status can be a value. Or, call _status as _rv since it is<br>
explicitly a returned value. It need not be a "status" indicator.<br></blockquote><div><br></div><div>And you do. _rv is fine with me. Ryan and I struggled to shorten names from</div><div>our initial discussion.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Similarily, instead of _value maybe it is better to call it<br>
_check_value explicitly<br></blockquote><div><br></div><div>Ryan try the longest names first. If it is > 80, try _rv and _expected. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> + do { \<br>
> + _Assert((_status) == (_value)); \<br>
> + (void) (_status); \<br>
> + } while (0)<br>
> +<br>
> +/**<br>
> + * @brief Assert if unused return value is not equal.<br>
<br>
> + *<br>
> + * Assert whether @a _status and @a _value are not equal and ensure @a _status<br>
> + * is marked as used when not building for debug.<br>
> + *<br>
> + * @param _status The return value to be checked.<br>
> + * @param _value Indicates what @a _status is not supposed to be.<br>
> + */<br>
> +#define _Assert_Unused_return_value_not_equal(_status,_value) \<br>
Maybe value_is_not<br>
<br>
same as above, use _rv instead of _status<br>
<br>
> + do { \<br>
> + _Assert((_status) != (_value)); \<br>
> + (void) (_status); \<br>
> + } while (0)<br>
> +<br>
> +/**<br>
> * @brief Returns true if thread dispatching is allowed.<br>
> *<br>
> * Thread dispatching can be repressed via _Thread_Disable_dispatch() or<br>
> --<br>
> 1.8.3.1<br>
><br>
> _______________________________________________<br>
> devel mailing list<br>
> <a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div></div>