Open nicklasb opened 1 week ago
round has been originally declared by using define. Now if it is proper function, test #if !defined(round) does not help and it will be redeclared.
If I understand you correctly; Yes, that is the original problem. And I see that there already are in #if !defined(round) in the code, so basically, this shouldn't happen.
The thing I am thinking that might be happening is that in some cases, the NMEA2000 library is loaded before the extensa-esp-elf implementation. I am thinking that the "first defined here" doesn't perhaps reflect the order in which the libraries were loaded. I haven't had the issue for a day now, I will se if I will encounter it again and try to recreate it then.
Some Chatgpt-solutions included namespaces (nah), and basing it on __cplusplus (in C++) or _ISOC99_SOURCE (in C), but I am not sure how precise that is.
if it has been defined
test works. But if they have changed it as double round(double v) {... Test does not see it existing and declares it again.
Aha, I understand. I will try with different variants if and when I run into it again. Closing this for now.
Ok, so now for some reason it is suddently persistent, so now I have to fix it in some way. Wouldn't something like this cover the situation?
If it non-defined-defined && it is not having the ISO99 feature set, then declare the function. Who would declare the function and not set _ISOC99_SOURCE?
Obviously I do not have as many cases to test with as you do.
Maybe better solution would be to change it to N2kRound and if compiler >=99 inline it to round.
I am having a weird issue in that i occationally get this old ESP-IDF-related problem again:
Anyone else seeing this? As it is intermittent I am thinking that it might have something with build scripts running in parallell or something or some build thingy trying to be intelligent and thus ending up non-deterministic.