[splint-discuss] Unrecognized macros like "timerisset" "timercmp"
raymond
raymond-xu at 126.com
Sun Aug 20 22:13:24 EDT 2006
On Fri, 2006-08-18 at 13:28 +0200, Tommy Pettersson wrote:
> On Fri, Aug 18, 2006 at 05:32:04PM +0800, raymond wrote:
> > splint +posixlib -skip-posix-headers test2.c
> [...]
> > test2.c:13:6: Unrecognized identifier: timerisset
> [...]
> > It seems splint can not recognize the macro in <sys/time.h> like
> > "timerisset" & "timercmp"
>
> Splint does not use sys/time.h. It uses internal libraries
> guaranteed to be compliant with the standard checked for.
> timerisset and timercmp are BSD extensions, not posix or ansi,
> so splint does right in not recognizing them in posix mode.
>
> There's a unixlib in splint, but it does not declare timerisset
> or timercmp. I don't know if it should. A portable solution
> would do something like checking if these macros are defined or
> else define them. Then your code really will compile in a posix
> environment. If you only want to make splint happy for the time
> being, you can define the macros just for splint within #ifdef
> S_SPLINT_S / #endif.
>
>
Thanks a lot, but I have another question
when I declare a function in a header("timer.h") file like this:
#include <sys/time.h>
typedef struct timeval obj_timer;
typedef obj_timer *p_timer;
extern void _timer_set(p_timer tp, time_t sec, suseconds_t usec);
then implement function like below(in "timer.c" file):
#include "timer.h"
obj_timer now;
void
_timer_set(p_timer tp, time_t sec, suseconds_t usec)
{
obj_timer incr;
incr.tv_sec = sec;
incr.tv_usec = usec;
timeradd(&now, &incr, tp);
}
Checking the code("timer.c") with splint, it output :
Splint 3.1.1 --- 06 Jan 2006
timer.h:20:59: Parse Error: Inconsistent function parameter
syntax:
suseconds_t : <any>. (For help on parse errors, see splint
-help
parseerrors.)
*** Cannot continue.
Thanks a lot.
More information about the splint-discuss
mailing list