Our testing needs work...

Hal Murray hmurray at megapathdsl.net
Wed Dec 2 07:43:56 UTC 2015


Would it help to understand the code if we used something conspicuous to mark 
casts that are there only to suppress warnings?  Is there already a common 
way to do that?  I'm thinking of something like INT, UINT, LONG and ULONG.

----------

[Still some warnings...]

> I'd like to fix those. Can you send me a transcript?  I'm sure I could
> squash at least a few.

Thanks.  There aren't all that many.

There is one nasty case.  I sent a message about it a few days ago.

../ntpd/ntp_io.c:4629:7: warning: comparison between signed and unsigned 
integer expressions [-Wsign-compare]

The problem is a glitch/bug in a system macro: NLMSG_OK.  Older compilers 
complain.  I don't think we can fix it on our end.  Inside, there are 3 
tests.  If we fix one we break another.

We could clone the macro and fix our copy.  That turns into a maintainance 
hazard, but I don't think that macro is likely to change.

We could live with it: add a comment to the code and another wherever we 
claim (almost) no warnings left.


I think these are the others:

[135/217] Compiling ntpd/refclock_acts.c
../ntpd/refclock_acts.c: In function 'acts_message':
../ntpd/refclock_acts.c:384:6: warning: array subscript has type 'char' 
[-Wchar-subscripts]
      if (isspace(*cp))

[145/217] Compiling ntpd/refclock_jjy.c
../ntpd/refclock_jjy.c: In function 'jjy_receive':
../ntpd/refclock_jjy.c:664:5: warning: array subscript has type 'char' 
[-Wchar-subscripts]
     if ( ! iscntrl( up->sRawBuf[i] ) ) {
     ^
../ntpd/refclock_jjy.c: In function 'jjy_start_telephone':
../ntpd/refclock_jjy.c:2694:3: warning: array subscript has type 'char' 
[-Wchar-subscripts]
   if ( isdigit( *(sys_phone[0]+i) ) ) {

[167/217] Compiling ntpq/ntpq.c
../ntpq/ntpq.c: In function 'list_md_fn':
../ntpq/ntpq.c:3381:2: warning: array subscript has type 'char' 
[-Wchar-subscripts]
  if( islower(*cp) )

[ 66/223] Compiling libparse/gpstolfp.c
../libparse/gpstolfp.c: In function ‘gpstolfp’:
../libparse/gpstolfp.c:26:3: warning: this decimal constant is unsigned only 
in ISO C90 [enabled by default]

I think that's all my setup finds.  I may have missed one.  If so, it will 
stand out after those are squashed.


-- 
These are my opinions.  I hate spam.





More information about the devel mailing list