Hi Nate, thanks for checking with clang.
Am Tue, 6 Nov 2018 04:38:29 -0600 schrieb Nate Bargmann <n...@n0nb.us>: > I occasionally go through the projects and test with clang as it will > often catch things GCC is silent on. I've been doing so with clang6 > and Hamlib and did the same with Tlf. I can report that clang6 only > generated warnings on one file (good job, all!) and that is bandmap.c. > Actually it is the same warning that occurs three places in the file: > > bandmap.c:322:6: warning: taking the absolute value of unsigned type > 'unsigned int' has no effect [-Wabsolute-value] if (abs(((spot > *)found->data)->freq - freq) > TOLERANCE) { ^ > bandmap.c:322:6: note: remove the call to 'abs' since unsigned values > cannot be negative if (abs(((spot *)found->data)->freq - freq) > > TOLERANCE) { ^~~ > > The suggested fix appears easy enough, but I don't use the bandmap, so > my testing would likely be incomplete. I would like to hear from > anyone who uses the bandmap to remove the call to abs and do some > testing. I fear just removing the abs would silence the compiler warning but will violate the idea behind the expression. Frequencies are unsigned by nature. But the difference between frequencies may be signed. And to get a 'distance' we need the absolute value of it. After reading about integer promotion in expressions the real reason behind seems to be that a difference between an signed and an unsigned integer is counted for unsigned. So I understand why the compiler produce the warning. Now to find a way to explain to him what we have in mind.... 73, de Tom DL1JBE > > For reference, in addition to line 322 above, the same warning is > generated for lines 381 and 390. > > 73, Nate > -- "Do what is needful!" Ursula LeGuin: Earthsea --
pgpi_VnwDoqMs.pgp
Description: Digitale Signatur von OpenPGP
_______________________________________________ Tlf-devel mailing list Tlf-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tlf-devel