NLnetLabs / ldns

LDNS is a DNS library that facilitates DNS tool programming
https://nlnetlabs.nl/ldns
BSD 3-Clause "New" or "Revised" License
301 stars 99 forks source link

Splint and Parse Error: New function scope inside function. #94

Closed noloader closed 2 years ago

noloader commented 4 years ago

Hi Everyone, @wcawijngaards, @wtoorop,

I'm working on FreeBSD 12.1. make test has a small issue:

PASSED: 15 (94 %)   FAILED: 1 (6 %) unknown: 0 (0 %)

--------------- Start Output: 02-lint ------------------
!! FAILED !!     !! FAILED !!
DateRunEnd: 1583966993
BaseName: 02-lint
Description: Do a make lint on libdns
DateRunStart: 1583966993 
--------------- Test Output ------------------
gmake[1]: Entering directory '/usr/home/jwalton/ldns'
for i in ./*.c; do \
splint +quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -D
u_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list  "-DBN_ULONG=
unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -
DRC4_INT=unsigned -fixedformalarray -D"ENGINE=unsigned" -D"RSA=unsigned" -D"DSA=
unsigned" -D"EVP_PKEY=unsigned" -D"EVP_MD=unsigned" -D"SSL=unsigned" -D"SSL_CTX=
unsigned" -D"X509=unsigned" -D"RC4_KEY=unsigned" -D"EVP_MD_CTX=unsigned" -D"EC_K
EY=unsigned" -D"EC_POINT=unsigned" -D"EC_GROUP=unsigned" -D"EVP_PKEY_ASN1_METHOD
=struct evp_pkey_asn1_method_st" -D"EVP_PKEY_CTX=struct evp_pkey_ctx_st" "-Dsigs
et_t=long" "-D__uint16_t=uint16_t" -D"__pure2=" -D"__wchar_t=wchar_t" -D"__packe
d=" -D"__aligned(x)=" -D"__BEGIN_DECLS=" -D"__ssize_t=ssize_t" -D"__intptr_t=int
ptr_t" -D"__nonnull(x)=" -D"__THROW=" -D"__wur=" -D"__off_t=unsigned" -D"__off64
_t=unsigned" -D"__useconds_t=unsigned" -D"__uid_t=unsigned" -D"__gid_t=unsigned"
 -D"__attribute_deprecated__=" -D"__pid_t=unsigned" -D"__restrict=" -D"__END_DEC
LS=" -D"__BEGIN_NAMESPACE_STD=" -D"__END_NAMESPACE_STD=" -D"__BEGIN_NAMESPACE_C9
9=" -D"__END_NAMESPACE_C99="  -D"__socklen_t=unsigned" -D"sa_family_t=unsigned "
 -D"__mode_t=unsigned" -D"u_int16_t=uint16_t" -D"u_int32_t=uint32_t" -D"u_int8_t
=uint8_t" -D"u_short=unsigned short" -D"__u16=uint16_t" -D"__u32=uint32_t" -D"__
u64=uint64_t" -D"_RuneLocale=int" -I. -I. ./$i ; \
if test $? -ne 0 ; then exit 1 ; fi ; \
done
/usr/include/pthread.h:208:27: Parse Error:
               New function scope inside function. (For help on parse errors,
               see splint -help parseerrors.)
*** Cannot continue.
gmake[1]: *** [Makefile:483: lint-lib] Error 1
gmake[1]: Leaving directory '/usr/home/jwalton/ldns'
exit code: 2
--------------- End Output: 02-lint ------------------

And:

$ cat -n /usr/include/pthread.h
     1  /*-
     2   * SPDX-License-Identifier: BSD-4-Clause
   ...
   204  int     pthread_cond_signal(pthread_cond_t *);
   205  int     pthread_cond_timedwait(pthread_cond_t *,
   206              pthread_mutex_t * __mutex,
   207              const struct timespec *)
   208              __requires_exclusive(*__mutex);
   209  int     pthread_cond_wait(pthread_cond_t * __restrict,
   210              pthread_mutex_t * __restrict __mutex)
   211              __requires_exclusive(*__mutex);
   ...

I don't have experience with splint so it would probably be a good idea if someone else looked at the issue.


Related, I'd be interested in learning how well Splint performs nowadays. According to its manual, Splint is from 2010. Does Splint find things that modern GCC, Clang or Coverity does not? Is it worth the maintenance costs?

wtoorop commented 4 years ago

@noloader Actually I think it is not worth it. Like you say, we have much better analysis tools now. I vote to get rid of it. @wcawijngaards WDYT?

wcawijngaards commented 4 years ago

Yes that sounds okay. This is also what happened for Unbound, moved to use clang analyzer and gcc warning output. Also for NSD.

wtoorop commented 2 years ago

Removed with commit a1fe1ece