Opened 9 years ago

Closed 7 years ago

#12448 closed Patch - Bug Fix (Fixed)

(Proposed) Patch for clang detected warning in tentacle3d.c

Reported by: Gary Buhrmaster <gary.buhrmaster@…> Owned by: David Hampton
Priority: minor Milestone: unknown
Component: MythTV - Video Library Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

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.

Attachments (1)

tentacle3d.c.patch (866 bytes) - added by Gary Buhrmaster <gary.buhrmaster@…> 9 years ago.

Download all attachments as: .zip

Change History (4)

Changed 9 years ago by Gary Buhrmaster <gary.buhrmaster@…>

Attachment: tentacle3d.c.patch added

comment:1 Changed 7 years ago by Gary Buhrmaster <gary.buhrmaster@…>

It appears that this ticket was not useful, as the warning was independently addressed without reference later in commit 5fb4874924743552ec7b60379524b5810021ed02

Please close (abandoned?)

comment:2 Changed 7 years ago by Peter Bennett

Owner: changed from JYA to David Hampton
Status: newassigned

comment:3 Changed 7 years ago by Peter Bennett

Resolution: Fixed
Status: assignedclosed

Fixed independently in above mentioned commit.

Note: See TracTickets for help on using tickets.