Hi,Bodo and Ludolf
Thanks for your response,
I think your answer are helpful to me.

I modified the code to the following,and splint didn't report parser error.

{
        Ktime_t time;
        time.tv.sec = secs;
     time.tv.nsec = nsecs;
     Return time;
}

But in my code,there are lots of such use,so I cann't modify every such code.

Can you give me the suggestion on how to eliminate this error.

Thanks& best regards!

liping


-----邮件原件-----
发件人: splint-discuss-boun...@cs.virginia.edu 
[mailto:splint-discuss-boun...@cs.virginia.edu] 代表 Ludolf Holzheid
发送时间: 2009年8月19日 15:54
收件人: splint-discuss@mail.cs.virginia.edu
主题: Re: [splint-discuss] parser error on ktime_t using splint on

On Wed, 2009-08-19 09:22:07 +0200, Wenzel, Bodo wrote:
> > return (ktime_t) { .tv = { .sec = secs, .nsec = nsecs } };
> 
> I see two issues here:
> 
> 1) The initialisation of struct elements via their names is a GCC
> extension to C. I don't think that Splint knows this extension.

The code snippet looks like valid C99 to me.

However, splint is able to check ANSI-C89/ISO-C90 only, so this
doesn't help Liping.

> 2) I'm not sure that in ISO-C an initializer can be used as a 'normal'
> expression, in this case for the return statement. This is probably also
> a GCC extension unknown to Splint.

Yes it can. What you call 'initializer' may also be called 'constant'.
And of course, constants may be used as expression.

Ludolf

-- 

---------------------------------------------------------------
Ludolf Holzheid             Tel:    +49 621 339960
Bihl+Wiedemann GmbH         Fax:    +49 621 3392239
Floßwörthstraße 41          e-mail: lholzh...@bihl-wiedemann.de
D-68199 Mannheim, Germany
---------------------------------------------------------------

_______________________________________________
splint-discuss mailing list
splint-discuss@mail.cs.virginia.edu
http://www.cs.virginia.edu/mailman/listinfo/splint-discuss


_______________________________________________
splint-discuss mailing list
splint-discuss@mail.cs.virginia.edu
http://www.cs.virginia.edu/mailman/listinfo/splint-discuss

Reply via email to