make parser more robust against invalid declarations
authorMatthias Braun <matze@braunis.de>
Fri, 30 May 2008 08:57:39 +0000 (08:57 +0000)
committerMatthias Braun <matze@braunis.de>
Fri, 30 May 2008 08:57:39 +0000 (08:57 +0000)
[r19829]

parser.c

index 28b6d2c..cb06856 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -3692,6 +3692,7 @@ static declaration_t *parse_declarator(
 
        if(construct_type != NULL) {
                obstack_free(&temp_obst, construct_type);
+               declaration->valid = true;
        }
 
        return declaration;
@@ -3788,6 +3789,9 @@ static declaration_t *internal_record_declaration(
        const symbol_t *const symbol  = declaration->symbol;
        const namespace_t     namespc = (namespace_t)declaration->namespc;
 
+       if (!declaration->valid)
+               return declaration;
+
        type_t *const orig_type = declaration->type;
        type_t *const type      = skip_typeref(orig_type);
        if (is_type_function(type) &&