summaryrefslogtreecommitdiff
path: root/bits.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-03-30 17:10:53 -0400
committerEric S. Raymond <esr@thyrsus.com>2015-03-30 17:10:53 -0400
commit28bf37132d86cc59320e21d843960d086cef664c (patch)
treebf085b5f89f1d1061b6a88ecc66c50721b13d86c /bits.c
parentecb7e1ff3ec73000918c56861c55258c2d4deada (diff)
downloadgpsd-28bf37132d86cc59320e21d843960d086cef664c.tar.gz
Retire splint from our set of static analyzers.
The proximate cause was that we've been seing emission of error messages that were randomly and disturbingly variable across different environments - notably Raspbian and Gentoo splint gave nontrivially different results than Ubuntu 14.10 splint. And this was *not* due to Ubuntu patches! A pristine splint built from the 3.1.2 tarball on Ubuntu didn't match the Raspbian and Gentoo results either. But this has been coming for a while. Easy access to more modern static analyzers such as coverity, scan-build and cppcheck has been decreasing the utility of splint, which is unmaintained and somewhat buggy and not easy to use. Only file not cleaned is ppsthread.c, because Gary has been working on it during this cleanup. All regression tests pass. PPS observed live on GR601-W.
Diffstat (limited to 'bits.c')
-rw-r--r--bits.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/bits.c b/bits.c
index cae3db17..ed6744c0 100644
--- a/bits.c
+++ b/bits.c
@@ -25,21 +25,19 @@ uint64_t ubits(unsigned char buf[], unsigned int start, unsigned int width, bool
unsigned int i;
unsigned end;
- /*@i1@*/ assert(width <= sizeof(uint64_t) * CHAR_BIT);
+ assert(width <= sizeof(uint64_t) * CHAR_BIT);
for (i = start / CHAR_BIT;
i < (start + width + CHAR_BIT - 1) / CHAR_BIT; i++) {
- /*@i1@*/ fld <<= CHAR_BIT;
+ fld <<= CHAR_BIT;
fld |= (unsigned char)buf[i];
}
end = (start + width) % CHAR_BIT;
if (end != 0) {
- /*@i1@*/ fld >>= (CHAR_BIT - end);
+ fld >>= (CHAR_BIT - end);
}
- /*@ -shiftimplementation @*/
fld &= ~(-1LL << width);
- /*@ +shiftimplementation @*/
/* was extraction as a little-endian requested? */
if (le)
@@ -69,14 +67,10 @@ int64_t sbits(signed char buf[], unsigned int start, unsigned int width, bool le
is undefined for width <= 0 */
assert(width > 0);
- /*@ +relaxtypes */
if (fld & (1LL << (width - 1))) {
- /*@ -shiftimplementation @*/
fld |= (-1LL << (width - 1));
- /*@ +shiftimplementation @*/
}
return (int64_t)fld;
- /*@ -relaxtypes */
}
union int_float {
@@ -126,15 +120,12 @@ void putbef32(char *buf, int off, float val)
union int_float i_f;
i_f.f = val;
- /*@-shiftimplementation +ignoresigns@*/
putbe32(buf, off, i_f.i);
- /*@+shiftimplementation -ignoresigns@*/
}
void shiftleft(unsigned char *data, int size, unsigned short left)
{
- /*@+matchanyintegral +ignoresigns -type -shiftnegative@*/
unsigned char *byte;
if (left >= CHAR_BIT) {
@@ -153,7 +144,6 @@ void shiftleft(unsigned char *data, int size, unsigned short left)
*byte <<= left;
*byte |= bits;
}
- /*@-matchanyintegral -ignoresigns +type +shiftnegative@*/
}
#ifdef __UNUSED__
@@ -162,10 +152,8 @@ void putbed64(char *buf, int off, double val)
union long_double l_d;
l_d.d = val;
- /*@-shiftimplementation +ignoresigns@*/
putbe32(buf, (off), (l_d.l) >> 32);
putbe32(buf, (off)+4, (l_d.l));
- /*@+shiftimplementation -ignoresigns@*/
}
u_int16_t swap_u16(u_int16_t i)