Hi, On Wed, Feb 13 2019, Martin Jambor wrote: > Hi Gerald and Martin, > > On Mon, Jan 28 2019, Gerald Pfeifer wrote: >> Hi Martin, >> >> On Sat, 26 Jan 2019, Martin Jambor wrote: >>>> What is a "wrong absolute value function"? That might be good to >>>> show by means of an example? (Also in invoke.texi, which I checked >>>> before writing this.) >>> I'm not sure how to change the wording, perhaps "...when a used absolute >>> value function seems wrong for the type of its argument" ...? >> >> yes, that definitely would have helped me as a user. (I guessed >> it might be that, but seeing it in writing helps.) >> >> On Mon, 28 Jan 2019, Martin Sebor wrote: >>> -Wabsolute-value warns for calls to standard functions that compute >>> the absolute value of an argument when a more appropriate standard >>> function is available. For example, calling abs(3.14) triggers >>> the warning because the appropriate function to call to compute >>> the absolute value of a double argument is fabs. The option also >>> triggers warnings when the argument in a call to such a function >>> has an unsigned type. >> >> Lovely. >> >> (I'd say "This option...", but that's probably a matter of taste.) >> >> Are you going to enhance both invoke.texi and apply a patch to the >> release notes (changes.html)? That would be ideal. >> > > I have incorporated Martin's extended description to both invoke.texi > and changes.html, the result is in the two patches below. OK to commit > to trunk and to wwwdocs CVS repo respectively?
Since it is documentation only and because the change was basically pre-approved by Gerald, I plan to commit both later today (unless someone stops me). I hope I'm not stretching the rules too much. Martin > > > diff -u -r1.38 changes.html > --- htdocs/gcc-9/changes.html 7 Feb 2019 11:49:26 -0000 1.38 > +++ htdocs/gcc-9/changes.html 13 Feb 2019 17:38:57 -0000 > @@ -89,6 +89,23 @@ > </ul></li> > </ul> > > +<h3 id="c">C</h3> > +<ul> > + <li>New warnings: > + <ul> > + <li><code>-Wabsolute-value</code> warns for calls to standard > + functions that compute the absolute value of an argument when a > + more appropriate standard function is available. For example, > + calling <code>abs(3.14)</code> triggers the warning because the > + appropriate function to call to compute the absolute value of a > + double argument is <code>fabs</code>. The option also triggers > + warnings when the argument in a call to such a function has an > + unsigned type. This warning can be suppressed with an explicit > + type cast and it is also enabled by <code>-Wextra</code>. > + </li> > + </ul></li> > +</ul> > + > <h3 id="cxx">C++</h3> > <ul> > <li>New warnings: > > > > 2019-02-13 Martin Jambor <mjam...@suse.cz> > Martin Sebor <mse...@redhat.com> > > * doc/invoke.texi (Warning Options): Reword description of > -Wno-absolute-value. > --- > gcc/doc/invoke.texi | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi > index c625350d04d..a8bafbebce8 100644 > --- a/gcc/doc/invoke.texi > +++ b/gcc/doc/invoke.texi > @@ -6633,9 +6633,13 @@ example, warn if an unsigned variable is compared > against zero with > @item -Wabsolute-value @r{(C and Objective-C only)} > @opindex Wabsolute-value > @opindex Wno-absolute-value > -Warn when a wrong absolute value function seems to be used or when it > -does not have any effect because its argument is an unsigned type. > -This warning be suppressed with an explicit type cast and it is also > +Warn for calls to standard functions that compute the absolute value > +of an argument when a more appropriate standard function is available. > +For example, calling @code{abs(3.14)} triggers the warning because the > +appropriate function to call to compute the absolute value of a double > +argument is @code{fabs}. The option also triggers warnings when the > +argument in a call to such a function has an unsigned type. This > +warning can be suppressed with an explicit type cast and it is also > enabled by @option{-Wextra}. > > @include cppwarnopts.texi > -- > 2.20.1