Compiling with IAR now produces lots of warnings (pointing to one file)

607 views
Skip to first unread message

M.Stamer

unread,
Oct 2, 2017, 11:39:56 AM10/2/17
to openthread-users
Hello All,

With the latest (as of 9/29/2017) code base, when I build using IAR compiler, I now get the following warning (over 50 times). 

Warning[Pa084]: pointless integer comparison, the result is always true \src\core\thread\thread_tlvs.hpp 487
child_supervision.cpp 

Warning points to :
bool IsValid(void) const { return GetLength() <= sizeof(*this) - sizeof(ThreadTlv); }

Would any think this is a concern? Or maybe I am missing some compiler switch that the linux/gcc tools have enabled?


Thanks a bunch,

-mike

Jonathan Hui

unread,
Oct 2, 2017, 11:54:41 AM10/2/17
to M.Stamer, openthread-users
That's a valid warning.  GetLength() returns a uint8_t type and the right side evaluates to 255, so it always returns true.

Interesting that neither gcc nor clang flag this as a warning.

PR with a fix coming soon.

--
Jonathan Hui

--
You received this message because you are subscribed to the Google Groups "openthread-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openthread-users+unsubscribe@googlegroups.com.
To post to this group, send email to openthread-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openthread-users/50561510-25bf-4c92-a26e-0d60146066fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jonathan Hui

unread,
Oct 4, 2017, 11:45:19 AM10/4/17
to M.Stamer, openthread-users
FYI - this issue should be fixed by https://github.com/openthread/openthread/commit/6dba173

--
Jonathan Hui
Reply all
Reply to author
Forward
0 new messages