tlf-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tlf-devel] Quelling a warning from clang6


From: Thomas Beierlein
Subject: Re: [Tlf-devel] Quelling a warning from clang6
Date: Sat, 10 Nov 2018 16:41:46 +0100

Hi Nate,

I just pushed a cleanup to the code in the morning which made the 
abs functionality explicit. Please see the code at github for reference.

Working with different compiler switches looks not so good from my
point of view. Better do a clean (and maybe a little bit dumb) coding
instead. If the compiler will not get me right, maybe the next one
changing the code will me wrong also.

Anyway thanks and keep reporting the check results here.

73, de Tom DL1JBE


Am
Thu, 8 Nov 2018 06:44:59 -0600 schrieb Nate Bargmann <address@hidden>:

> * On 2018 08 Nov 00:56 -0600, Thomas Beierlein wrote:
> > Hi Nate,
> > 
> > thanks for checking with clang.  
> 
> It's just one of the janitorial things I do on occasion.  ;-)
> 
> > 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....  
> 
> This page would have a solution for just that section of code:
> 
>      
> https://embeddedartistry.com/blog/2016/9/26/manually-disable-expected-warnings
> 
> in our case the ignored string should just consist of
> "-Wabsolute-value".
> 
> I've tried this in a branch and it quells the warning for clang which
> now compiles quietly.  Now GCC complains about an unknown pragma.
> Rolls eyes.
> 
> Then there is this post that implicitly tells me this #pragma stuff
> is a deep rabbit hole:
> 
>        https://stackoverflow.com/a/49834787
> 
> IMO, if the code is deemed satisfactory, then I'd prefer to simply
> allow the warning to remain for clang rather than cluttering up the
> source file and possibly the build system with a lot of cruft to
> quell a harmless warning.
> 
> 73, Nate
> 



-- 
"Do what is needful!"
Ursula LeGuin: Earthsea
--

Attachment: pgpkYG_R1m1rP.pgp
Description: Digitale Signatur von OpenPGP


reply via email to

[Prev in Thread] Current Thread [Next in Thread]