trice icon indicating copy to clipboard operation
trice copied to clipboard

Feature: Allow to detect other Assert functions

Open KammutierSpule opened this issue 3 weeks ago • 3 comments

trice/internal/id/helper.go:
99: 	baseTricePattern := `(?i)\bTRICE(?:0|_0|AssertTrue|AssertFalse|(?:8|16|32|64)*(?:_*[0-9SNBF]*)*)`

would you allow any type of Assert* so developers can customize its functions? (and still use Trice)

KammutierSpule avatar Dec 09 '25 18:12 KammutierSpule

I made a pull request, what do you think? I added some utility assert functions and it allow users to future extend to their own versions

KammutierSpule avatar Dec 09 '25 20:12 KammutierSpule

Please tell a bit about the use case you need. Best with examples.

rokath avatar Dec 09 '25 21:12 rokath

I implemented the other use cases I was looking to me on the PR: https://github.com/rokath/trice/pull/585/files

The tool will match matches all kind of triceAssert*

So I can have now : triceAssertFail (which is basically a report of a ID .. something like Trice0) and also:

#define triceAssertOrReturn(a, b, c) do {if (!(c)) {triceAssertFail(a); return;}} while(0)
#define triceAssertOrReturnValue(a, b, c, v) do {if (!(c)) {triceAssertFail(a); return (v);}} while(0)

KammutierSpule avatar Dec 10 '25 09:12 KammutierSpule

Please see my comment in the closed PR 585. Looking forward for an update.

rokath avatar Dec 11 '25 12:12 rokath

Thanks, this looks good! 👍 You (probaly) forgot to remove #define triceAssertFail(...) ... in triceOff.h I will fix that.

rokath avatar Dec 14 '25 16:12 rokath