Menu

#270 SDCCicode.c emits many warnings on some compilers

None
closed-out-of-date
nobody
None
5
2020-09-16
2016-02-22
No

Hello SDCC team,

This patch fixes up allot of warnings in SDCCicode.c caused by bad/missing casts.

All the warnings are valid, and caused by bad implicit casts.

Thanks,

/pedro

1 Attachments

Discussion

  • Peter Dons Tychsen

    The warnings can at least be seen on msvcxx.

     

    Last edit: Peter Dons Tychsen 2016-02-22
  • Maarten Brock

    Maarten Brock - 2016-02-23

    Can you please attach a log of the warnings you see.

     
  • Peter Dons Tychsen

    2>c:\svnhome\sdcc\sdcc-code-msvc\sdcc-code\sdcc\src\sdccicode.c(1196): warning C4244: 'function' : conversion from 'double' to 'unsigned int64', possible loss of data
    2>c:\svnhome\sdcc\sdcc-code-msvc\sdcc-code\sdcc\src\sdccicode.c(1199): warning C4244: 'function' : conversion from 'double' to 'unsigned
    int64', possible loss of data
    2>c:\svnhome\sdcc\sdcc-code-msvc\sdcc-code\sdcc\src\sdccicode.c(1225): warning C4244: 'function' : conversion from 'unsigned int64' to 'double', possible loss of data
    2>c:\svnhome\sdcc\sdcc-code-msvc\sdcc-code\sdcc\src\sdccicode.c(1259): warning C4244: 'function' : conversion from 'double' to 'unsigned
    int64', possible loss of data
    2>c:\svnhome\sdcc\sdcc-code-msvc\sdcc-code\sdcc\src\sdccicode.c(1284): warning C4244: 'function' : conversion from 'double' to 'unsigned int64', possible loss of data
    2>c:\svnhome\sdcc\sdcc-code-msvc\sdcc-code\sdcc\src\sdccicode.c(1423): warning C4244: 'function' : conversion from 'double' to 'unsigned
    int64', possible loss of data
    2>c:\svnhome\sdcc\sdcc-code-msvc\sdcc-code\sdcc\src\sdccicode.c(1435): warning C4244: 'function' : conversion from 'double' to 'unsigned int64', possible loss of data
    2>c:\svnhome\sdcc\sdcc-code-msvc\sdcc-code\sdcc\src\sdccicode.c(2012): warning C4244: 'function' : conversion from 'double' to 'unsigned
    int64', possible loss of data
    2>c:\svnhome\sdcc\sdcc-code-msvc\sdcc-code\sdcc\src\sdccicode.c(2956): warning C4244: 'function' : conversion from 'double' to 'unsigned int64', possible loss of data
    2>c:\svnhome\sdcc\sdcc-code-msvc\sdcc-code\sdcc\src\sdccicode.c(2958): warning C4244: 'function' : conversion from 'double' to 'unsigned
    int64', possible loss of data
    2>c:\svnhome\sdcc\sdcc-code-msvc\sdcc-code\sdcc\src\sdccicode.c(2976): warning C4244: 'function' : conversion from 'double' to 'unsigned int64', possible loss of data
    2>c:\svnhome\sdcc\sdcc-code-msvc\sdcc-code\sdcc\src\sdccicode.c(2994): warning C4244: 'function' : conversion from 'double' to 'unsigned
    int64', possible loss of data

     
  • Peter Dons Tychsen

    I think the warnings are ok. You should not downgrade types without explicitly casting them, so you can see in the code what is going on. It simply makes the code more readable. Suppressing the warning using options is in IMHO a bit nasty.

     

    Last edit: Peter Dons Tychsen 2016-02-23
  • Sergey Belyashov

    • status: open --> closed-out-of-date
    • Group: -->
     

Log in to post a comment.