Opened 10 years ago
Closed 8 years ago
#12448 closed Patch - Bug Fix (Fixed)
(Proposed) Patch for clang detected warning in tentacle3d.c
Reported by: | 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)
Change History (4)
Changed 10 years ago by
Attachment: | tentacle3d.c.patch added |
---|
comment:1 Changed 8 years ago by
comment:2 Changed 8 years ago by
Owner: | changed from JYA to David Hampton |
---|---|
Status: | new → assigned |
comment:3 Changed 8 years ago by
Resolution: | → Fixed |
---|---|
Status: | assigned → closed |
Fixed independently in above mentioned commit.
Note: See
TracTickets for help on using
tickets.
It appears that this ticket was not useful, as the warning was independently addressed without reference later in commit 5fb4874924743552ec7b60379524b5810021ed02
Please close (abandoned?)