Attribute 'packed' is ignored in typedef

The CWARN.PACKED.TYPEDEF checker finds instances in which the gcc 'packed' attribute is applied to a typedef declaration. The 'packed' attribute is allowed when a typedef includes a struct definition.

Vulnerable code example

1  typedef struct test{
2    int a;
3    char b;
4    int c;
5  } __attribute__((__packed__)) testing;
6   /* ... */ 
7  typedef struct s __attribute__((packed)) s_packed;   

8   /* ... */ 

Klocwork flags line 7, in which the 'packed' attribute is used with a typedef declaration. The 'packed' attribute in line 5 isn't flagged, since it's part of the struct definition.