Do not truncate the existing attribute list if a __declspec has no arguments.
authorChristoph Mallon <christoph.mallon@gmx.de>
Thu, 26 Apr 2012 17:15:29 +0000 (19:15 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Thu, 26 Apr 2012 17:15:29 +0000 (19:15 +0200)
parser.c

index 601fa46..8d29162 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -2659,27 +2659,25 @@ static attribute_t *parse_microsoft_extended_decl_modifier(attribute_t *first)
        eat(T__declspec);
 
        expect('(', end_error);
+       if (token.kind != ')') {
+               add_anchor_token(')');
 
-       if (next_if(')'))
-               return NULL;
-
-       add_anchor_token(')');
-
-       attribute_t **anchor = &first;
-       do {
-               while (*anchor != NULL)
-                       anchor = &(*anchor)->next;
+               attribute_t **anchor = &first;
+               do {
+                       while (*anchor != NULL)
+                               anchor = &(*anchor)->next;
 
-               attribute_t *attribute
-                       = parse_microsoft_extended_decl_modifier_single();
-               if (attribute == NULL)
-                       break;
+                       attribute_t *attribute
+                               = parse_microsoft_extended_decl_modifier_single();
+                       if (attribute == NULL)
+                               break;
 
-               *anchor = attribute;
-               anchor  = &attribute->next;
-       } while (next_if(','));
+                       *anchor = attribute;
+                       anchor  = &attribute->next;
+               } while (next_if(','));
 
-       rem_anchor_token(')');
+               rem_anchor_token(')');
+       }
        expect(')', end_error);
 end_error:
        return first;