Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#196 Getting rid of warnings in Ops build

closed-fixed
nobody
core (120)
5
2008-06-27
2008-06-19
Judd Taylor
No

Isn't it time we got rid of these warnings on the build of ops.pd? The warnings are:

Ops.xs: In function `pdl_modulo_readdata':
Ops.xs:13204: warning: comparison is always true due to limited range of data type
Ops.xs:13204: warning: comparison is always true due to limited range of data type
Ops.xs:13204: warning: comparison is always false due to limited range of data type
Ops.xs:13204: warning: comparison is always false due to limited range of data type
Ops.xs:13247: warning: comparison is always true due to limited range of data type
Ops.xs:13247: warning: comparison is always true due to limited range of data type
Ops.xs:13247: warning: comparison is always false due to limited range of data type
Ops.xs:13247: warning: comparison is always false due to limited range of data type
Ops.xs:13408: warning: comparison is always true due to limited range of data type
Ops.xs:13408: warning: comparison is always true due to limited range of data type
Ops.xs:13408: warning: comparison is always false due to limited range of data type
Ops.xs:13408: warning: comparison is always false due to limited range of data type
Ops.xs:13451: warning: comparison is always true due to limited range of data type
Ops.xs:13451: warning: comparison is always true due to limited range of data type
Ops.xs:13451: warning: comparison is always false due to limited range of data type
Ops.xs:13451: warning: comparison is always false due to limited range of data type

After some initial checking, the warnings are produced when the code is using the MOD() macro for PDL_Byte and PDL_Ushort types.

A simple fix would be to define an unsigned and signed version of the macro, and then use the PDL::PP types features to ensure the correct one is called. like:

pp_def(...,
Code => <<'ENDCODE');
types(BU) %{
/* Do unsigned MOD macro */
%}
types(SLFD) %{
/* Do signed MOD macro */
%}
ENDCODE

I know GCC will just optimize away the problem, but it looks bad when someone is building PDL. It gives the impression that PDL is a hack, which is bad.

Discussion

  • Derek Lamb
    Derek Lamb
    2008-06-27

    Logged In: YES
    user_id=1357170
    Originator: NO

    Bug fixed in CVS.
    Thanks for reporting the problem!

     
  • Derek Lamb
    Derek Lamb
    2008-06-27

    • status: open --> closed-fixed