<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 1:53 PM 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 2:18 PM 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"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 8, 2021 at 1:53 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:59 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"><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></div></blockquote><div><br></div><div>OK. </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>We should also have</div><div>
RTEMS_IGNORE_RETURN_VALUE(_return_value)
</div><div>maybe.</div></div></div></blockquote><div><br></div><div><br></div><div>Is this what you want?</div><div><br></div><div>
_Assert_Return_value_equals
(x, OK); </div><div>
RTEMS_IGNORE_RETURN_VALUE(x);</div></div></div></blockquote><div><br></div><div>Hmm... this had degenerated to the same as </div><div><br></div><div>_Assert( x == OK );</div><div>(void) x;</div><div><br></div><div>Unless these are in one macro, there isn't any much point in adding any more macros.</div><div> </div></div></div></blockquote><div><br></div><div>No. Maybe:</div><div>_Assert_Unused_return_value_equals()</div><div>_Assert_Unused_return_value_not_equals()<br></div><div><br></div><div>Unused or Ignored, I don't really care, but I think calling it unused is more clear.</div><div><br></div><div>My point about RTEMS_IGNORE_VARIABLE(x) is more about encoding this syntactic trick (void)(x); as something a little more obvious, although once you know what this (void) thing means, it is also obvious.</div><div><br></div><div>I keep changing my mind what to call things :)</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"><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>Add the _Assert_xxx to rtems/score/assert.h and RTEMS_IGNORE_xxx where?</div><div><br></div></div></div></blockquote></div></div></blockquote><div>basedefs</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"><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><div>Because the only time x is used is when assert is enabled. </div><div><br></div><div>But ignored parameter vs ignored return variable is not worth a macro IMO</div><div><br></div></div></div></blockquote></div></div></blockquote><div>yeah, call it RTEMS_IGNORE_VARIABLE(x) if we decide to add it. or maybe RTEMS_IGNORE_VALUE_OF(x)</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"><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><div>--joel</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><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>
</blockquote></div></div>
</blockquote></div></div>
</blockquote></div></div>