struct, union and enum tags belonging to the same scope are in the same namespace. The following code violates standard C:
struct S_TAG1 { int i1; float f1; };
union U_TAG1 { unsigned u1; double d1; };
union S_TAG1 /* std C violation, splint misses this */
{
int abc; int cdf;
};
struct U_TAG1 /* std C violation, splint misses this */
{
int xx;
long int yy;
};
GCC reaction: cannot compile
$ gcc -c test/redef_su.c
test/redef_su.c:15: error: `S_TAG1' defined as wrong kind of tag
test/redef_su.c:21: error: `U_TAG1' defined as wrong kind of tag
SPLINT reaction: violation missed
$ bin/splint.exe test/redef_su.c
Splint 3.1.1.2 --- 27 May 2007
Finished checking --- no warnings
best regards
pkzc at freemail dot hu