Open snej opened 6 years ago
A while back, NYOCI_EMBEDDED
was used to enable the singleton behavior, and I had it tested in Travis and my own build-in-docker script. However, I've since separated the behavior of NYOCI_EMBEDDED
and NYOCI_SINGLETON
and forgot to add it to the test suite. So I expect that there might be some code rot.
However, testing after adding --enable-singleton
to my etc/build_in_docker.sh
script, it seems to be working OK.
Given the way that NYOCI_SINGLETON
works, the warning on line 122 of libnyoci/nyoci-transaction.c
is somewhat unavoidable. I really wish there was a way to collapse that warning for specific expressions, but I could easily change that code to not trigger that warning.
The error on line 198 is because I'm not currently testing NYOCI_SINGLETON
without also using NYOCI_EMBEDDED
: If you uncomment NYOCI_SINGLETON_SELF_HOOK
and move it within the #if NYOCI_TRANSACTIONS_USE_BTREE
block then it should work fine. There may be other errors though.
The trick that NYOCI_SINGLETON
uses to remove the first arguments of both the prototypes and calls only works if the ()
no-argument syntax is acceptable for a prototype. I don't think there is really a good way around it other than to not use NYOCI_SINGLETON
or to turn off that warning.
OK! I'll probably just not use singleton mode, then; I'm not targeting devices where squeezing four bytes out of a stack frame is important. (My ESP32 dev board has ~400KB of RAM.)
That sounds entirely reasonable. The mode was largely for devices like the CC2530 with a very limited stack size (less than 256 bytes!).
That being said, on the drive in to work today I think I may have figured out a way to make it work without disabling those warnings. I'll give that some more thought.
In any case, I'll use this issue to track fixing the error you pointed out.
NYOCI_SINGLETON
doesn't seem to be working; if I define it I get a compile error. There are also a large number (about 50?) of warnings, which harsh my mellow because I'm a zealot about-Werror
.In GCC when building for ESP32 I get one error and a warning:
In Clang (Xcode) building for macOS, I get the above, and also many warnings of the form:
and a lesser number of corresponding no-prototype warnings like this:
The source of the problem is that a C prototype of a zero-arg function has to have
(void)
, not just()
. Silencing or ignoring these warnings would be dangerous because without prototypes there will be no parameter checking of calls to the affected functions!