Menu

#37 Doesn't detect redefinition of tags

open
nobody
None
5
2007-05-27
2007-05-27
Anonymous
No

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

Discussion


Log in to post a comment.

MongoDB Logo MongoDB