On Wed, 2016-07-20 18:26:04 +0000, Suresh Babu Perini Balaji wrote:
> Hi,
> 
> Following is the small snippet of code.
>                   status = sem_timedwait(&eflag->pending_list->sem, &ts);
>                   if(status != 0 && errno == ETIMEDOUT)
>                   {
>                     // walk through the list and cancel this request.
>                     pthread_mutex_lock(&eflag->mutex);
>                                 ef_node_t *cur_node, *prev_node;   
> //--------------------------------------------(splint showing parse error)
>                                 cur_node = eflag->pending_list;
>                                 for(cur_node = eflag->pending_list; cur_node; 
> prev_node = cur_node, cur_node = cur_node->next)
>                                   if(cur_node == node)
>                                                 break;
>                                 if(prev_node && cur_node)
>                                   prev_node->next = cur_node->next;
>                                 sem_destroy(&node->sem);
>                                 free(node);
>                                 pthread_mutex_unlock(&eflag->mutex);
>                   }
> 
> Splint gives the following error. I have make the error line bold.
> rtos_eflag.c:175:12: Parse Error. (For help on parse errors, see splint -help
>                        parseerrors.)
> 
> Do you guys have any idea of why it is happening?

Suresh,

You are mixing variable declarations and statements.  This is not
valid in C89, which is the standard Splint checks against.

Either move the variable declarations to the top of the block, or put
all the lines between 'pthread_mutex_lock()' and 'sem_destroy()' in
its own block (i.e. enclose them with curly braces).

HTH,

Ludolf

-- 

Ludolf Holzheid
 
Bihl+Wiedemann GmbH
Floßwörthstraße 41
68199 Mannheim, Germany
 
Tel: +49 621 33996-0
Fax: +49 621 3392239
 
mailto:lholzh...@bihl-wiedemann.de
http://www.bihl-wiedemann.de
 
Sitz der Gesellschaft: Mannheim
Geschäftsführer: Jochen Bihl, Bernhard Wiedemann
Amtsgericht Mannheim, HRB 5796
_______________________________________________
splint-discuss mailing list
splint-discuss@mail.cs.virginia.edu
http://www.cs.virginia.edu/mailman/listinfo/splint-discuss

Reply via email to