[splint-discuss] Problem in using WIFSIGNALED(status)

Vishal Bayskar vishal.bayskar at nechclst.in
Thu Mar 27 20:34:46 PST 2008


Dear All,

 

 

            There is a problem when I use WIFSIGNALED(status) 

 

I have used the following code 

 

int ret = system (cmd)

 

if (WIFSIGNALED (ret) && (WTERMSIG (ret) == SIGINT || WTERMSIG (ret) ==
SIGQUIT)) {

 

Here cmd is some shell command string

 

            And the following warnings are being shown by splint 

 

bt_agent.c:1877:11: Left operand of >> may be negative (char):

                                   (char)((((*(int *)&(ret))) & 0x7f) +
1) >> 1

  The left operand to a shift operator may be negative (behavior is

  implementation-defined). (Use -shiftimplementation to inhibit warning)

lbt_agent.c:1877:10: Operands of > have incompatible types (char, int):

                                   ((char)((((*(int *)&(ret))) & 0x7f) +
1) >> 1) > 0

  Types are incompatible. (Use -type to inhibit warning)

 

 

The definition of macro WIFSIGNALED is given in the
/usr/include/sys/wait.h

As 

# define WIFSIGNALED(status)    __WIFSIGNALED(__WAIT_INT(status))

 

 

And the definition of macro  __WIFSIGNALED is given in
/usr/include/bits/waitstatus.h

            As

                        #define __WIFSIGNALED(status) \

  (((signed char) (((status) & 0x7f) + 1) >> 1) > 0)

 

 

I think this is a problem with the standard __WIFSIGNALED macro

 

Is this a bug of defining __WIFSIGNALED?

 

 

Please help me in resolving the problem, how could I overcome of this
warning, without using -type flag with splint command 

 

 

 

Thanks in Advance

 

 

Regards

 

Vishal Bayskar

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20080328/29d144aa/attachment-0001.html 


More information about the splint-discuss mailing list