<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 8, 2021 at 11:59 AM Joel Sherrill <<a href="mailto:joel@rtems.org">joel@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"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 8, 2021 at 12:39 PM Gedare Bloom <<a href="mailto:gedare@rtems.org" target="_blank">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"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 8, 2021 at 11:24 AM Joel Sherrill <<a href="mailto:joel@rtems.org" target="_blank">joel@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"><div dir="ltr">Hi<div><br></div><div>There are more than a couple of these. in our set of CIDs. I am wondering if these can be addressed with a macro like this:</div><div><br></div><div>#define _IGNORED_RETURN_STATUS(_status, _ok) \</div><div>  do { \</div><div>    _Assert((_status) == (_ok)); \</div></div></blockquote><div><br></div><div>Can you also pass the comparison? I guess it would usually be ==, but it could be != sometimes? I think that is the main challenge here.</div></div></div></blockquote><div><br></div><div>How about 2 macro names? One for positive and one for negative</div><div><br></div><div>_IGNORE_RETURN_STATUS_EQ</div><div>_IGNORE_RETURN_STATUS_NEQ</div><div><br></div><div>Or even _Assert_Return_status_eq and _neq. I'd like these to be candidates for our internal assert.h</div></div></div></blockquote><div><br></div><div>I prefer to use the assert part. The wording is a little awkward. I guess it doesn't hurt to put the (void) (_status); and still use the status later? so we don't have to specifically indicate ignored/unused in the macro name?</div><div><br></div><div>Then:</div><div>_Assert_Return_value_equals(_return_value, _expected_value)</div><div>_Assert_Return_not_equals(_return_value, _not_expected_value)</div><div></div><div><br></div><div>or so would be my preference.</div><div><br></div><div>We should also have</div><div>

RTEMS_IGNORE_RETURN_VALUE(_return_value)

 </div><div>maybe.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><br></div><div>It will end up being three arguments otherwise. It would be nice to keep it reliably to one line.</div></div></div></blockquote><div>Embedding the condition in the name will be easier to spot check anyway. (Like catch == vs = problem)</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"><div dir="ltr"><div class="gmail_quote"><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>   (void) (_status);</div><div>  } while (0);</div><div><br></div><div>Or _Assert_Ignored_return?</div><div><br></div><div>The ones I have looked at, the return value should always be successful but there isn't any reason we can't be defensive about them.</div><div><br></div><div>Thoughts.</div><div><br></div><div>--joel</div></div>
_______________________________________________<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></blockquote></div></div>
</blockquote></div></div>
</blockquote></div></div>