How can I make gcc (6.3) to warn for all explicit 64bit to 32bit conversions done by casting (C code)?
- Explicit conversions are ignored by -Wconversion flag.
- I'm about to compile a very big and old project to 64bit and I know that there are many programmers misuses of casting and it is impossible to find all of them manually.
- Parsing the code is not enough due to many custom definitions and structs which holds the parameters, it has to be at the compilation stage.
e.g. How can i find this type of issues automatically?
typedef long long my_type;
int foo()
{
my_type f;
...
return (int)f;
}
struct stat {
ino_t st_ino; /* 64bit Inode number */
... };
int foo2(){
stat s;
...
return (int)s.st_ino;
{