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: Nate Bargmann
Subject: Re: [Tlf-devel] Quelling a warning from clang6
Date: Thu, 8 Nov 2018 06:44:59 -0600
User-agent: NeoMutt/20180716

* 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

-- 

"The optimist proclaims that we live in the best of all
possible worlds.  The pessimist fears this is true."

Web: http://www.n0nb.us  GPG key: D55A8819  GitHub: N0NB

Attachment: signature.asc
Description: PGP signature


reply via email to

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