invalid use of Trice0 will misbehave trice insert
Trice0( variable ); // invalid use Trice0( "text %u", variable ); // invalid use
Will cause that the next Trices will be ignored or not updated. (also if Trice0 are // commented)
See also: https://github.com/rokath/trice/issues/464
Am I understand you right, that the first line causes the trice tool not to insert further IDs in that file? That's indeed an issue. Unfortunately I am not a parser expert and the trice tool is somehow limited.
There is probably no quick fix right now. See also comment in https://github.com/rokath/trice/blob/master/internal/id/insertIDs.go near line 280.
also, it happens with clean too. If there is an invalid use of Trice0, trice clean will not be able to clean next ids on the file
Yes, it is the same parser. I am going to add a chapter about that to https://github.com/rokath/trice/blob/master/docs/TriceUserGuide.md#9-additional-hints.
It is added now into https://github.com/rokath/trice/blob/master/docs/TriceUserGuide.md#922-limited-trice-parser-capabilities.
The following sequence inside trice/examples/OpenCM3_STM32F411_Nucleo/main.c
// Depending on mode, either print this string to
// UART (mode 0), or the Trice write buffer (mode 200).
TRICE( Id( 4030),"Hello, TRICE, %d\n", 42);
// TRICE() with a string parameter only is problematic.
// See discussion on https://github.com/rokath/trice/issues/279
// TRICE0() works in either case
#ifdef __STRICT_ANSI__
// if compiled with e.g. --std=c99
TRICE0( Id( 4683),"Hello, TRICE\n");
#else
TRICE( Id( 2926),"Hello, TRICE\n");
TRICE0( Id( 7263),"Hello, TRICE0()\n");
#endif
gets changed into
// Depending on mode, either print this string to
// UART (mode 0), or the Trice write buffer (mode 200).
TRICE(Id(0), "Hello, TRICE, %d\n", 42);
// TRICE(Id(0), "Hello, TRICE\n");
#else
TRICE(Id(0), "Hello, TRICE\n");
TRICE0(Id(0), "Hello, TRICE0()\n");
#endif
so these lines are disappearing:
// TRICE() with a string parameter only is problematic.
// See discussion on https://github.com/rokath/trice/issues/279
// TRICE0() works in either case
#ifdef __STRICT_ANSI__
// if compiled with e.g. --std=c99
when running renewIDs_in_examples_and_test_folder.sh in branch devel. This needs a special test first.
I propose to close this issue for less issue noise. Normal usage is trice(... and all these cases are evaluated for matching value counts. If a user writes TRICE0(... or TRICE_3(... incorrectly, at least the compiler will complain. Also this limitation is documented now.
Will be opened on demand again.