Make explicit check for "interesting" types before changing
->ident, otherwise we can write to int_ctype, for example.

Signed-off-by: Oleg Nesterov <[EMAIL PROTECTED]>

--- git-snapshot-20050816/parse.c~1_tdef_fix    2005-08-15 21:43:30.000000000 
+0400
+++ git-snapshot-20050816/parse.c       2005-08-16 21:54:39.000000000 +0400
@@ -1698,10 +1698,17 @@ struct token *external_declaration(struc
 
        base_type = decl->ctype.base_type;
 
-       if (is_typedef) {
-               if (base_type && !base_type->ident)
-                       base_type->ident = ident;
-       } else if (base_type && base_type->type == SYM_FN) {
+       if (!base_type) {
+               /* nothing to do */;
+       } else if (is_typedef) {
+               if (!base_type->ident) {
+                       if (base_type->type == SYM_STRUCT ||
+                           base_type->type == SYM_UNION ||
+                           base_type->type == SYM_ENUM)
+                               /* Used in error messages only */
+                               base_type->ident = ident;
+               }
+       } else if (base_type->type == SYM_FN) {
                /* K&R argument declaration? */
                if (lookup_type(token))
                        return parse_k_r_arguments(token, decl, list);
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to