gettimeofday() and splint
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > gettimeofday() and splint




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    gettimeofday() and splint  
Roman Mashak


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-16-06 06:43 PM

Hello,

%cat foo.c

#include <stdio.h>
#include <sys/time.h>

int main(void)
{
struct timeval tval;

if (gettimeofday(&tval, NULL) == -1) {
/* error handling */
}

return 0;
}

for this simple code 'splint foo.c' reports:

Splint 3.0.1.7 --- 24 Jan 2003

foo.c: (in function main)
foo.c:8:6: Unrecognized identifier: gettimeofday
Identifier used in code has not been declared. (Use -unrecog to inhibit
warning)

Finished checking --- 1 code warning

Isn't it enought to include header declaring function?

With best regards, Roman Mashak.  E-mail: mrv@tusur.ru







[ Post a follow-up to this message ]



    Re: gettimeofday() and splint  
Robert Gamble


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-16-06 06:43 PM

Roman Mashak wrote:
> Hello,
>
> %cat foo.c
>
> #include <stdio.h>
> #include <sys/time.h>
>
> int main(void)
> {
>     struct timeval tval;
>
>     if (gettimeofday(&tval, NULL) == -1) {
>         /* error handling */
>     }
>
>     return 0;
> }
>
> for this simple code 'splint foo.c' reports:
>
> Splint 3.0.1.7 --- 24 Jan 2003
>
> foo.c: (in function main)
> foo.c:8:6: Unrecognized identifier: gettimeofday
>     Identifier used in code has not been declared. (Use -unrecog to inhibi
t
> warning)
>
> Finished checking --- 1 code warning
>
> Isn't it enought to include header declaring function?

Splint doesn't actually process standard header files introduced with
the #include directive by default.  There are several reasons for this,
not the least of which is that many implementations use compiler
specific functionality in the header files that would cause splint to
choke.  You can see this for yourself by using the -skip-iso-headers
command-line option on such a machine which will cause splint to try to
process the header files.

So how does splint know the prototypes of the standard functions?
Splint comes with several libraries that provide these prototypes (and
additional information) and uses them to check usage of standard
functions.  By default splint loads only the prototypes for the C99
functions, gettimeofday is not a C99 function.  The +unixlib
command-line option will tell splint to load the prototypes of the
functions defined by SUSv2, including gettimeofday.

Robert Gamble






[ Post a follow-up to this message ]



    Re: gettimeofday() and splint  
Roman Mashak


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-16-06 06:43 PM

Hello, Robert!
You wrote  on 14 Sep 2006 21:33:08 -0700:

[skip]
RG> specific functionality in the header files that would cause splint to
RG> choke.  You can see this for yourself by using the -skip-iso-headers
RG> command-line option on such a machine which will cause splint to try to
RG> process the header files.
My splint (version 3.0.1.6) doesn't know this option. Perhaps it's too old.

RG> So how does splint know the prototypes of the standard functions?
RG> Splint comes with several libraries that provide these prototypes (and
RG> additional information) and uses them to check usage of standard
RG> functions.  By default splint loads only the prototypes for the C99
RG> functions, gettimeofday is not a C99 function.  The +unixlib
RG> command-line option will tell splint to load the prototypes of the
RG> functions defined by SUSv2, including gettimeofday.
Thank you for thorough explanation.

With best regards, Roman Mashak.  E-mail: mrv@tusur.ru







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 04:52 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register