Example 59 Signed bit field of length 1
Cadvise warns cases where signed bit field of length 1 is being used and then assigned with a value, which is excessive of its size.
For example, see the tags in the following code:
$ cat bitfield.c
struct { int bit:1; } s; void test()
{
s.bit = 1;
}
In such cases, cadvise generates the following warnings:
"bitfield.c", line 1: warning
^
"bitfield.c", line 5: warning
s.bit = 1;
^
8.3 Detecting 32-bit to 64-bit migraton issues
The +w64bit option enables warnings that help detection of potential problems in converting
•
•Pointer to a
Example 60 Detecting 32–bit to 64–bit migraton issues
$ cat convert.c
int *int_to_ptr (int i)
{
return (int *)i;
}
In such cases, cadvise generates the following warning:
"convert.c", line 3: warning
(from "int" to "int *" ) return (int *)i;
^
8.4 Detecting endianness migration issues
The +wendian option helps you to detect code fragments which are endian dependent. The following example shows the detection of endian dependent code fragments.
8.3 Detecting