[mythtv-commits] Ticket #12448: (Proposed) Patch for clang detected warning in tentacle3d.c

MythTV noreply at mythtv.org
Tue May 5 15:28:03 UTC 2015


#12448: (Proposed) Patch for clang detected warning in tentacle3d.c
-------------------------------------------------+-------------------------
     Reporter:  Gary Buhrmaster                  |      Owner:  jyavenard
  <gary.buhrmaster@…>                            |
         Type:  Patch - Bug Fix                  |     Status:  new
     Priority:  minor                            |  Milestone:  unknown
    Component:  MythTV - Video Library           |    Version:  Master Head
     Severity:  medium                           |   Keywords:
Ticket locked:  0                                |
-------------------------------------------------+-------------------------
 Clang 3.5 reported the following warning:

 {{{
 visualisations/goom/tentacle3d.c:138:6: warning: using integer absolute
 value function 'abs' when argument is of floating point type [-Wabsolute-
 value]
  if (abs(tmp-rot) > abs(tmp-(rot+2.0*3.14159265358979323846))) {
      ^
 visualisations/goom/tentacle3d.c:138:6: note: use function 'fabsf' instead
  if (abs(tmp-rot) > abs(tmp-(rot+2.0*3.14159265358979323846))) {
      ^~~
      fabsf
 visualisations/goom/tentacle3d.c:138:21: warning: using integer absolute
 value function 'abs' when argument is of floating point type [-Wabsolute-
 value]
  if (abs(tmp-rot) > abs(tmp-(rot+2.0*3.14159265358979323846))) {
                     ^
 visualisations/goom/tentacle3d.c:138:21: note: use function 'fabs' instead
  if (abs(tmp-rot) > abs(tmp-(rot+2.0*3.14159265358979323846))) {
                     ^~~
                     fabs
 visualisations/goom/tentacle3d.c:144:11: warning: using integer absolute
 value function 'abs' when argument is of floating point type [-Wabsolute-
 value]
  else if (abs(tmp-rot) > abs(tmp-(rot-2.0*3.14159265358979323846))) {
           ^
 visualisations/goom/tentacle3d.c:144:11: note: use function 'fabsf'
 instead
  else if (abs(tmp-rot) > abs(tmp-(rot-2.0*3.14159265358979323846))) {
           ^~~
           fabsf
 visualisations/goom/tentacle3d.c:144:26: warning: using integer absolute
 value function 'abs' when argument is of floating point type [-Wabsolute-
 value]
  else if (abs(tmp-rot) > abs(tmp-(rot-2.0*3.14159265358979323846))) {
                          ^
 visualisations/goom/tentacle3d.c:144:26: note: use function 'fabs' instead
  else if (abs(tmp-rot) > abs(tmp-(rot-2.0*3.14159265358979323846))) {
                          ^~~
                          fabs

 }}}


 Possibly the use of abs rather than the floating point equivalent was due
 c++ operator overloading experience.

 Proposed (and untested except for compilation) patch will be attached to
 change the abs to fabsf, with a cast (because M_PI (Pi) is double).  If
 the actual intent was an integer abs, then the code should cast to an int.

--
Ticket URL: <https://code.mythtv.org/trac/ticket/12448>
MythTV <http://www.mythtv.org>
MythTV Media Center


More information about the mythtv-commits mailing list