Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 May 2013 15:13:03 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Benjamin Kaduk <bjkfbsd@gmail.com>
Cc:        Ed Schouten <ed@80386.nl>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, Stefan Farfeleder <stefanf@freebsd.org>, Bruce Evans <brde@optusnet.com.au>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r250806 - head/sys/sys
Message-ID:  <20130521133211.K1076@besplex.bde.org>
In-Reply-To: <CAJ5_RoDOqKP4QLNPT4oa0p%2BMxYoGh-1AdSywGBFC5f03no1EkQ@mail.gmail.com>
References:  <201305190744.r4J7i2FD055067@svn.freebsd.org> <20130519094813.GA1465@mole.fafoe.narf.at> <CAJOYFBC3Ww-jdy2cm7QNEbVzrZJHaeo3y797BVYp53pKJ5e-Nw@mail.gmail.com> <20130520140304.GA1429@mole.fafoe.narf.at> <20130521004803.K8511@besplex.bde.org> <20130520155053.GC1429@mole.fafoe.narf.at> <CAJ5_RoDOqKP4QLNPT4oa0p%2BMxYoGh-1AdSywGBFC5f03no1EkQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 20 May 2013, Benjamin Kaduk wrote:

> On Mon, May 20, 2013 at 11:50 AM, Stefan Farfeleder <stefanf@freebsd.org>wrote:
>
>> Since nobody wants to update lint to recent C standards, maybe it's time to
>> remove it?

I'm not going to defend it.  At first I thought it was useful for checking
for old sources, but with system headers using new features it works poorly
even for that.

> It does seem like compilers can do a better job of finding lint-like things
> than lint itself, these days (especially clang).

I checked what lint and compilers do on dusty decks (Kahan paranoia.c
from ~1987 and SGI ttcp.c from ~1991).  lint was worst since it is
broken.  clang was next worst because its output format is bad (even
without colorization):

lint -cghapbxu:

I used the default LINTFLAGS from sys.mk.  Obviously no one uses lint,
since using these flags exposes even more bitrot in the tool chain and/or
system headers:

@l paranoia.c:
@l warning: unknown warning option '-Wtraditional' [-Wunknown-warning-option]
@l 1 warning generated.

This is added (to CFLAGS) when -p is in the lint flags.  The addition
is undocumented.  This used to work, but now it doesn't due to bitrot
in the tool chain -- apparently lint uses part of clang (the
preprocessor), and clang's support for -Wtraditional is broken
(missing).

@l paranoia.c(332): warning: argument has incompatible pointer type, arg #2 [153]
@l paranoia.c(366): warning: argument has incompatible pointer type, arg #2 [153]
@l paranoia.c(1847): warning: automatic hides external declaration: ch [86]
@l paranoia.c(1886): warning: automatic hides external declaration: X [86]
@l paranoia.c(1886): warning: automatic hides external declaration: Y [86]

Last 5 lines useful.

@l _types.h(62): warning: struct __timer never defined [233]
@l _types.h(63): warning: struct __mq never defined [233]
@l stdio.h(142): warning: struct pthread_mutex never defined [233]
@l stdio.h(143): warning: struct pthread never defined [233]
@l signal.h(90): warning: struct timespec never defined [233]
@l signal.h(117): warning: struct __ucontext never defined [233]

Lint doesn't understand C90 yet, so it emits many spurious warnings about
forward declarations of structs.  -p also causes -Wno-system-headers to
be added to CFLAGS.  This breaks detection by the compiler of some (non-)
errors in system headers.  However, lint itself doesn't understand
-Wno-system-headers, so it it still warns about these non-errors in
system headers.

That's all for paranoia.c.  Not too bad.

@l ttcp.c:
@l warning: unknown warning option '-Wtraditional' [-Wunknown-warning-option]
@l ttcp.c:205:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
@l #endif cray
@l        ^
@l        //
@l ttcp.c:251:7: warning: extra tokens at end of #else directive [-Wextra-tokens]
@l #else BSD43
@l       ^
@l       //
@l ttcp.c:275:7: warning: extra tokens at end of #else directive [-Wextra-tokens]
@l #else BSD43
@l       ^
@l       //
@l ttcp.c:441:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
@l #endif SYSV
@l        ^
@l        //
@l ttcp.c:590:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
@l #endif !SYSV
@l        ^
@l        //
@l 6 warnings generated.

I forget if these extra tokens are syntax errors.  The warnings for them
are apparently printed in a different format by clang's cpp.  The
misprinting makes the output ungreppable.

@l _ctype.h(52): syntax error [249]
@l _ctype.h(105): runes undefined [99]
@l _ctype.h(105): left operand of '=' must be lvalue [114]

ctype support for C11 (?) added mounds of style bugs and perhaps a few
bugs.  It is at least incompatible with lint, as shown by the above.

There is a more fundamental error with the reporting of the header name.
One of the largest style bugs in the new ctype code is its convoluted
include nested include structure.  _ctype.h isn't /usr/include/_ctype.h,
but /usr/include/xlocale/_ctype.h.  There are many obvious style bugs in
lines 52 and 105 of the latter, but no obvious bugs.  The syntax errors
here seem to be due to convoluted ifdefs which result in some types not
being declared when this is compiled by lint (or just cpp?).  In fact,
the convoluted ifdefs not even in new ctype code break the toolchain
for not even lint:
   1. cpp -P        ttcp.c >z.c; lint -c...       z.c   # horribly broken
   2. cpp -P -Dlint ttcp.c >z.c; lint -c...       z.c   # not quite so broken
   3. cpp -P        ttcp.c >z.c; gcc  -c          z.c   # broken
   4. cpp -P        ttcp.c >z.c;  cc  -c          z.c   # works
   5. cpp -P        ttcp.c >z.c; gcc  -c -std=c99 z.c   # works

(3) is broken mainly because -std=c99 is now the default for cpp but it
is not the default for gcc, so the 'restrict' keyword is not anulled.
(5) fixes this by supporting the 'restrict' keyword for gcc.  (1) is
also broken main by -std=c99 in cpp exposing the 'restrict' keyword to
lint.  (2) fixes this by killing the 'restrict' keyword at the cpp level.

@l _ctype.h(107): undefined struct/union member: __runetype [101]
@l _ctype.h(107): warning: function __sbmaskrune_l expects to return value [214]
@l _ctype.h(102): warning: argument __c unused in function __sbmaskrune_l [231]
@l _ctype.h(102): warning: argument __f unused in function __sbmaskrune_l [231]
@l _ctype.h(102): warning: argument __loc unused in function __sbmaskrune_l [231]
@l _ctype.h(185): warning: conversion to 'unsigned long' due to prototype, arg #2 [259]
@l _ctype.h(190): __runes undefined [99]
@l _ctype.h(190): left operand of '=' must be lvalue [114]
@l _ctype.h(192): undefined struct/union member: __maplower [101]
@l _ctype.h(192): warning: function tolower_l expects to return value [214]
@l _ctype.h(187): warning: argument __c unused in function tolower_l [231]
@l _ctype.h(187): warning: argument __l unused in function tolower_l [231]
@l _ctype.h(197): __runes undefined [99]
@l _ctype.h(197): left operand of '=' must be lvalue [114]
@l _ctype.h(199): undefined struct/union member: __mapupper [101]
@l _ctype.h(199): warning: function toupper_l expects to return value [214]
@l _ctype.h(194): warning: argument __c unused in function toupper_l [231]
@l _ctype.h(194): warning: argument __l unused in function toupper_l [231]

Cascade of errors in ctype.

@l endian.h(95): warning: bitwise operation on signed value possibly nonportable [117]

Again it won't tell us where the header is, and the system headers are
excessively convoluted, with several named endian.h.

This seems to be in <x86/endian.h>.  The warning is a bug in lint.  Lint
doesn't understand C90's broken value-preserving extension rules.  Here
we start with an unsigned 16-bit value, but the broken extension rules
convert it to a signed 32-bit value when it is used in expressions.
Only the lower 24 bits are used in the expression in this case, so there
is no portability problem.  Compilers and lints must understand the
details of this to avoid emitting lots of spurious warnings, but lint
doesn't.

@l endian.h(122): warning: extra bits set to 0 in conversion of 'unsigned int' to 'unsigned long long', op & [309]

Bogus warning.

@l endian.h(122): warning: conversion to 'unsigned int' due to prototype, arg #1 [259]
@l endian.h(122): warning: conversion from 'unsigned long long' may lose accuracy, arg #1 [298]
@l endian.h(122): warning: conversion to 'unsigned int' due to prototype, arg #1 [259]
@l endian.h(122): warning: conversion from 'unsigned long long' may lose accuracy, arg #1 [298]

The code is intentionally using the prototype to do the conversion.  This
is convenient, but perhaps we should use a cast to make the conversion
explicit, or better tell lint to not warn about such "missing" casts
ever in system headers and optionally in applications.

@l tcp.h(56): warning: nonportable bit-field type [34]
@l tcp.h(57): warning: nonportable bit-field type [34]
@l tcp.h(199): warning: nonportable bit-field type [34]
@l tcp.h(200): warning: nonportable bit-field type [34]

These are plain bugs.  I fixed them in tcp.h and many other places in
the kernel back in 1998 after finding such bugs by compiling with
various portability options but someone broke tcp.h, so it now uses
u_char for bit-fields there again :-(.  Bit-fields can only have type
bool, signed int and unsigned int in C99.  Bit-fields of type u_char
are a gcc extension.  They have arcane undocmented effects on the
packing and alignment of structs.  IIRC, for gcc using u_char instead
of u_int has no effect on the packing near the fields, but it prevents
the struct having to have the alignment of u_int or greater (just
because there is a bit-field of type u_int in it).  The bugs are in
struct tcphdr.  This struct has a u_int elsewhere in it, so using u_int
for the bit-field has no effect for gcc.  Perhaps the u_char is to
work around mis-packing by a broken compiler.  Packing and alignment
are delicate in struct tcphdr, and this is not "fixed" even more
unportably using __packed and __aligned(2) like it is done in too many
networking headers (mainly !ipv4 ones).

@l time.h(101): warning: conversion from 'unsigned long long' may lose accuracy [132]
@l time.h(111): warning: conversion from 'unsigned long long' may lose accuracy [132]
@l time.h(116): warning: bitwise operation on signed value possibly nonportable [117]
@l time.h(137): warning: bitwise operation on signed value possibly nonportable [117]
@l time.h(137): warning: conversion from 'long long' may lose accuracy [132]
@l time.h(152): warning: bitwise operation on signed value possibly nonportable [117]
@l time.h(152): warning: conversion from 'long long' may lose accuracy [132]
@l time.h(176): warning: conversion from 'unsigned long long' may lose accuracy [132]
@l time.h(193): warning: conversion from 'unsigned long long' may lose accuracy [132]
@l time.h(210): warning: bitwise operation on signed value possibly nonportable [117]
@l time.h(210): warning: conversion from 'long long' may lose accuracy [132]
@l time.h(211): warning: conversion from 'unsigned long long' may lose accuracy [132]
@l time.h(228): warning: bitwise operation on signed value possibly nonportable [117]
@l time.h(228): warning: conversion from 'long long' may lose accuracy [132]
@l time.h(229): warning: conversion from 'unsigned long long' may lose accuracy [132]

Mostly non-problems like the ones in endian.h, but casts to say that they
are non-problems are more needed now.  Oops, this isn't clear.  E.g., some
of the warnings are for conversions from bintimes with 64-bit integer
parts to sbintimes with 32-bit integer parts.  These depend on sbintimes
being relative or the date being before 2038, else blind overflow occurs.

@l ttcp.c(185): warning: pointer casts may be troublesome [247]
@l ttcp.c(200): warning: pointer casts may be troublesome [247]
@l ttcp.c(204): warning: conversion from 'unsigned long' may lose accuracy [132]
@l ttcp.c(222): warning: conversion of pointer to 'int' loses bits [133]
@l ttcp.c(241): warning: argument has incompatible pointer type, arg #2 [153]
@l ttcp.c(241): warning: conversion to 'unsigned int' due to prototype, arg #3 [259]
@l ttcp.c(252): warning: conversion to 'unsigned int' due to prototype, arg #5 [259]
@l ttcp.c(260): warning: conversion to 'unsigned int' due to prototype, arg #5 [259]
@l ttcp.c(264): warning: argument has incompatible pointer type, arg #2 [153]
@l ttcp.c(264): warning: conversion to 'unsigned int' due to prototype, arg #3 [259]
@l ttcp.c(276): warning: conversion to 'unsigned int' due to prototype, arg #5 [259]
@l ttcp.c(282): warning: argument has incompatible pointer type, arg #2 [153]
@l ttcp.c(282): warning: argument has incompatible pointer type, arg #3 [153]
@l ttcp.c(287): warning: argument has incompatible pointer type, arg #2 [153]
@l ttcp.c(287): warning: argument has incompatible pointer type, arg #3 [153]
@l ttcp.c(460): warning: argument type defaults to 'int': len [32]
@l ttcp.c(500): warning: conversion from 'long' may lose accuracy [132]
@l ttcp.c(501): warning: conversion from 'long' may lose accuracy [132]
@l ttcp.c(538): warning: conversion from 'long' may lose accuracy [132]
@l ttcp.c(625): warning: conversion from 'long' may lose accuracy [132]
@l ttcp.c(629): warning: conversion from 'long' may lose accuracy [132]
@l ttcp.c(633): warning: conversion from 'long' may lose accuracy [132]
@l ttcp.c(646): warning: argument type defaults to 'int': fd [32]
@l ttcp.c(646): warning: argument type defaults to 'int': buf [32]
@l ttcp.c(646): warning: argument type defaults to 'int': count [32]
@l ttcp.c(651): warning: illegal combination of pointer and integer, arg #2 [154]
@l ttcp.c(651): warning: conversion to 'unsigned int' due to prototype, arg #3 [259]
@l ttcp.c(651): warning: argument has incompatible pointer type, arg #5 [153]
@l ttcp.c(651): warning: argument has incompatible pointer type, arg #6 [153]
@l ttcp.c(668): warning: argument type defaults to 'int': fd [32]
@l ttcp.c(668): warning: argument type defaults to 'int': buf [32]
@l ttcp.c(668): warning: argument type defaults to 'int': count [32]
@l ttcp.c(672): warning: illegal combination of pointer and integer, arg #2 [154]
@l ttcp.c(672): warning: conversion to 'unsigned int' due to prototype, arg #3 [259]
@l ttcp.c(672): warning: argument has incompatible pointer type, arg #5 [153]
@l ttcp.c(672): warning: conversion to 'unsigned int' due to prototype, arg #6 [259]
@l ttcp.c(689): warning: argument type defaults to 'int': us [32]
@l ttcp.c(694): warning: argument has incompatible pointer type, arg #2 [153]
@l ttcp.c(694): warning: argument has incompatible pointer type, arg #3 [153]
@l ttcp.c(694): warning: argument has incompatible pointer type, arg #4 [153]

Mostly useful warnings for ttcp.c itself.

@l _types.h(62): warning: struct __timer never defined [233]
@l _types.h(63): warning: struct __mq never defined [233]
@l stdio.h(142): warning: struct pthread_mutex never defined [233]
@l stdio.h(143): warning: struct pthread never defined [233]
@l signal.h(117): warning: struct __ucontext never defined [233]
@l _ctype.h(44): warning: struct _xlocale never defined [233]
@l endian.h(111): warning: static function __bswap64_var unused [236]
@l _pthreadtypes.h(45): warning: struct pthread_attr never defined [233]
@l _pthreadtypes.h(46): warning: struct pthread_cond never defined [233]
@l _pthreadtypes.h(47): warning: struct pthread_cond_attr never defined [233]
@l _pthreadtypes.h(49): warning: struct pthread_mutex_attr never defined [233]
@l _pthreadtypes.h(51): warning: struct pthread_rwlock never defined [233]
@l _pthreadtypes.h(52): warning: struct pthread_rwlockattr never defined [233]
@l _pthreadtypes.h(53): warning: struct pthread_barrier never defined [233]
@l _pthreadtypes.h(54): warning: struct pthread_barrier_attr never defined [233]
@l _pthreadtypes.h(55): warning: struct pthread_spinlock never defined [233]
@l _pthreadtypes.h(78): warning: struct pthread_barrierattr never defined [233]
@l in6.h(377): warning: struct rtentry never defined [233]
@l in6.h(378): warning: struct llentry never defined [233]
@l time.h(59): warning: static function bintime_addx unused [236]
@l time.h(70): warning: static function bintime_add unused [236]
@l time.h(82): warning: static function bintime_sub unused [236]
@l time.h(94): warning: static function bintime_mul unused [236]
@l time.h(106): warning: static function bintime_shift unused [236]
@l time.h(134): warning: static function sbintime_getsec unused [236]
@l time.h(141): warning: static function bttosbt unused [236]
@l time.h(148): warning: static function sbttobt unused [236]
@l time.h(172): warning: static function bintime2timespec unused [236]
@l time.h(180): warning: static function timespec2bintime unused [236]
@l time.h(189): warning: static function bintime2timeval unused [236]
@l time.h(197): warning: static function timeval2bintime unused [236]
@l time.h(206): warning: static function sbttots unused [236]
@l time.h(216): warning: static function tstosbt unused [236]
@l time.h(224): warning: static function sbttotv unused [236]
@l time.h(234): warning: static function tvtosbt unused [236]

The usual lint bug for forward declarations of structs, except for 1
warning about a static inline function.  It's surprising that there
aren't mmore of the latter.

gcc: -Wall

@g paranoia.c:326: warning: return type defaults to 'int'
@g paranoia.c: In function 'sigfpe':
@g paranoia.c:332: warning: passing argument 2 of 'signal' from incompatible pointer type
@g paranoia.c:337: warning: implicit declaration of function 'abort'
@g paranoia.c:337: warning: incompatible implicit declaration of built-in function 'abort'
@g paranoia.c: At top level:
@g paranoia.c:341: warning: return type defaults to 'int'
@g paranoia.c: In function 'main':
@g paranoia.c:366: warning: passing argument 2 of 'signal' from incompatible pointer type
@g paranoia.c:368: warning: implicit declaration of function 'Instructions'
@g paranoia.c:369: warning: implicit declaration of function 'Pause'
@g paranoia.c:370: warning: implicit declaration of function 'Heading'
@g paranoia.c:372: warning: implicit declaration of function 'Characteristics'
@g paranoia.c:374: warning: implicit declaration of function 'History'
@g paranoia.c:381: warning: implicit declaration of function 'TstCond'
@g paranoia.c:390: warning: implicit declaration of function 'TstPtUf'
@g paranoia.c:579: warning: implicit declaration of function 'BadCond'
@g paranoia.c:583: warning: implicit declaration of function 'notify'
@g paranoia.c:984: warning: implicit declaration of function 'SqXMinX'
@g paranoia.c:1140: warning: implicit declaration of function 'NewD'
@g paranoia.c:1148: warning: implicit declaration of function 'SR3750'
@g paranoia.c:1209: warning: implicit declaration of function 'SR3980'
@g paranoia.c:1217: warning: implicit declaration of function 'PrintIfNPositive'
@g paranoia.c:1580: warning: implicit declaration of function 'IsYeqX'
@g paranoia.c:1741: warning: implicit declaration of function 'read'
@g paranoia.c:1831: warning: control reaches end of non-void function
@g paranoia.c: At top level:
@g paranoia.c:1846: warning: return type defaults to 'int'
@g paranoia.c: In function 'Pause':
@g paranoia.c:1858: warning: control reaches end of non-void function
@g paranoia.c: At top level:
@g paranoia.c:1863: warning: return type defaults to 'int'
@g paranoia.c: In function 'TstCond':
@g paranoia.c:1865: warning: control reaches end of non-void function
@g paranoia.c: At top level:
@g paranoia.c:1868: warning: return type defaults to 'int'
@g paranoia.c: In function 'BadCond':
@g paranoia.c:1875: warning: control reaches end of non-void function
@g paranoia.c: At top level:
@g paranoia.c:1900: warning: return type defaults to 'int'
@g paranoia.c: In function 'SqXMinX':
@g paranoia.c:1915: warning: control reaches end of non-void function
@g paranoia.c: At top level:
@g paranoia.c:1920: warning: return type defaults to 'int'
@g paranoia.c: In function 'NewD':
@g paranoia.c:1930: warning: control reaches end of non-void function
@g paranoia.c: At top level:
@g paranoia.c:1935: warning: return type defaults to 'int'
@g paranoia.c: In function 'SR3750':
@g paranoia.c:1947: warning: control reaches end of non-void function
@g paranoia.c: At top level:
@g paranoia.c:1952: warning: return type defaults to 'int'
@g paranoia.c: In function 'IsYeqX':
@g paranoia.c:1966: warning: control reaches end of non-void function
@g paranoia.c: At top level:
@g paranoia.c:1971: warning: return type defaults to 'int'
@g paranoia.c: In function 'SR3980':
@g paranoia.c:1979: warning: control reaches end of non-void function
@g paranoia.c: At top level:
@g paranoia.c:1984: warning: return type defaults to 'int'
@g paranoia.c: In function 'PrintIfNPositive':
@g paranoia.c:1986: warning: control reaches end of non-void function
@g paranoia.c: At top level:
@g paranoia.c:1991: warning: return type defaults to 'int'
@g paranoia.c: In function 'TstPtUf':
@g paranoia.c:2046: warning: control reaches end of non-void function
@g paranoia.c: At top level:
@g paranoia.c:2049: warning: return type defaults to 'int'
@g paranoia.c: In function 'notify':
@g paranoia.c:2053: warning: control reaches end of non-void function
@g paranoia.c: At top level:
@g paranoia.c:2060: warning: return type defaults to 'int'
@g paranoia.c: In function 'msglist':
@g paranoia.c:2061: warning: control reaches end of non-void function
@g paranoia.c: At top level:
@g paranoia.c:2064: warning: return type defaults to 'int'
@g paranoia.c: In function 'Instructions':
@g paranoia.c:2078: warning: control reaches end of non-void function
@g paranoia.c: At top level:
@g paranoia.c:2083: warning: return type defaults to 'int'
@g paranoia.c: In function 'Heading':
@g paranoia.c:2106: warning: control reaches end of non-void function
@g paranoia.c: At top level:
@g paranoia.c:2111: warning: return type defaults to 'int'
@g paranoia.c: In function 'Characteristics':
@g paranoia.c:2135: warning: control reaches end of non-void function
@g paranoia.c: At top level:
@g paranoia.c:2139: warning: return type defaults to 'int'
@g paranoia.c: In function 'History':
@g paranoia.c:2164: warning: control reaches end of non-void function
@g ttcp.c:127: warning: return type defaults to 'int'
@g ttcp.c: In function 'main':
@g ttcp.c:154: warning: implicit declaration of function 'atoi'
@g ttcp.c:185: warning: implicit declaration of function 'bzero'
@g ttcp.c:185: warning: incompatible implicit declaration of built-in function 'bzero'
@g ttcp.c:194: warning: implicit declaration of function 'inet_addr'
@g ttcp.c:198: warning: implicit declaration of function 'err'
@g ttcp.c:200: warning: implicit declaration of function 'bcopy'
@g ttcp.c:200: warning: incompatible implicit declaration of built-in function 'bcopy'
@g ttcp.c:205:8: warning: extra tokens at end of #endif directive
@g ttcp.c:219: warning: implicit declaration of function 'malloc'
@g ttcp.c:219: warning: incompatible implicit declaration of built-in function 'malloc'
@g ttcp.c:222: warning: cast from pointer to integer of different size
@g ttcp.c:239: warning: implicit declaration of function 'mes'
@g ttcp.c:241: warning: passing argument 2 of 'bind' from incompatible pointer type
@g ttcp.c:251:7: warning: extra tokens at end of #else directive
@g ttcp.c:264: warning: passing argument 2 of 'connect' from incompatible pointer type
@g ttcp.c:275:7: warning: extra tokens at end of #else directive
@g ttcp.c:282: warning: passing argument 2 of 'accept' from incompatible pointer type
@g ttcp.c:282: warning: pointer targets in passing argument 3 of 'accept' differ in signedness
@g ttcp.c:287: warning: passing argument 2 of 'getpeername' from incompatible pointer type
@g ttcp.c:287: warning: pointer targets in passing argument 3 of 'getpeername' differ in signedness
@g ttcp.c:291: warning: implicit declaration of function 'inet_ntoa'
@g ttcp.c:291: warning: format '%s' expects type 'char *', but argument 3 has type 'int'
@g ttcp.c:300: warning: implicit declaration of function 'pattern'
@g ttcp.c:301: warning: implicit declaration of function 'Nwrite'
@g ttcp.c:307: warning: implicit declaration of function 'Nread'
@g ttcp.c:327: warning: implicit declaration of function 'read'
@g ttcp.c:332: warning: implicit declaration of function 'write'
@g ttcp.c:361: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigned int'
@g ttcp.c:367: warning: format '%#x' expects type 'unsigned int', but argument 4 has type 'char *'
@g ttcp.c:369: warning: implicit declaration of function 'exit'
@g ttcp.c:369: warning: incompatible implicit declaration of built-in function 'exit'
@g ttcp.c: At top level:
@g ttcp.c:377: warning: return type defaults to 'int'
@g ttcp.c: In function 'err':
@g ttcp.c:382: warning: incompatible implicit declaration of built-in function 'exit'
@g ttcp.c: At top level:
@g ttcp.c:386: warning: return type defaults to 'int'
@g ttcp.c: In function 'mes':
@g ttcp.c:389: warning: control reaches end of non-void function
@g ttcp.c: At top level:
@g ttcp.c:392: warning: return type defaults to 'int'
@g ttcp.c: In function 'pattern':
@g ttcp.c:401: warning: control reaches end of non-void function
@g ttcp.c:441:8: warning: extra tokens at end of #endif directive
@g ttcp.c: In function 'read_timer':
@g ttcp.c:470: warning: implicit declaration of function 'strncpy'
@g ttcp.c:470: warning: incompatible implicit declaration of built-in function 'strncpy'
@g ttcp.c: In function 'prusage':
@g ttcp.c:516: warning: format '%d' expects type 'int', but argument 3 has type 'time_t'
@g ttcp.c:516: warning: format '%01d' expects type 'int', but argument 4 has type 'suseconds_t'
@g ttcp.c:522: warning: format '%d' expects type 'int', but argument 3 has type 'time_t'
@g ttcp.c:522: warning: format '%01d' expects type 'int', but argument 4 has type 'suseconds_t'
@g ttcp.c:544: warning: format '%d' expects type 'int', but argument 3 has type 'long int'
@g ttcp.c:550: warning: format '%d' expects type 'int', but argument 3 has type 'long int'
@g ttcp.c:557: warning: format '%d' expects type 'int', but argument 3 has type 'long int'
@g ttcp.c:562: warning: format '%d' expects type 'int', but argument 3 has type 'long int'
@g ttcp.c:567: warning: format '%d' expects type 'int', but argument 3 has type 'long int'
@g ttcp.c:572: warning: format '%d' expects type 'int', but argument 3 has type 'long int'
@g ttcp.c:577: warning: format '%d' expects type 'int', but argument 3 has type 'long int'
@g ttcp.c:582: warning: format '%d' expects type 'int', but argument 3 has type 'long int'
@g ttcp.c:587: warning: format '%d' expects type 'int', but argument 3 has type 'long int'
@g ttcp.c:587: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
@g ttcp.c:590:8: warning: extra tokens at end of #endif directive
@g ttcp.c: At top level:
@g ttcp.c:646: warning: return type defaults to 'int'
@g ttcp.c: In function 'Nread':
@g ttcp.c:651: warning: passing argument 2 of 'recvfrom' makes pointer from integer without a cast
@g ttcp.c:651: warning: passing argument 5 of 'recvfrom' from incompatible pointer type
@g ttcp.c:651: warning: pointer targets in passing argument 6 of 'recvfrom' differ in signedness
@g ttcp.c:655: warning: implicit declaration of function 'mread'
@g ttcp.c: At top level:
@g ttcp.c:668: warning: return type defaults to 'int'
@g ttcp.c: In function 'Nwrite':
@g ttcp.c:672: warning: passing argument 2 of 'sendto' makes pointer from integer without a cast
@g ttcp.c:672: warning: passing argument 5 of 'sendto' from incompatible pointer type
@g ttcp.c: At top level:
@g ttcp.c:689: warning: return type defaults to 'int'
@g ttcp.c: In function 'delay':
@g ttcp.c:694: warning: passing argument 2 of 'select' from incompatible pointer type
@g ttcp.c:694: warning: passing argument 3 of 'select' from incompatible pointer type
@g ttcp.c:694: warning: passing argument 4 of 'select' from incompatible pointer type
@g ttcp.c: At top level:
@g ttcp.c:32: warning: 'RCSid' defined but not used

Mostly useful.  gcc finds more problems than lint, but not all the ones
found by lint.  The output format is worse.

clang -Wall:

c@ paranoia.c:325:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ sigfpe()
c@ ^~~~~~
c@ paranoia.c:332:18: warning: incompatible pointer types passing 'Sig_type' (aka 'int (*)()') to parameter of type '__sighandler_t *' (aka 'void (*)(int)') [-Wincompatible-pointer-types]
c@                 signal(SIGFPE, sigsave);
c@                                ^~~~~~~
c@ /usr/include/sys/signal.h:441:45: note: passing argument to parameter here
c@ __sighandler_t *signal(int, __sighandler_t *);
c@                                             ^
c@ paranoia.c:337:2: warning: implicitly declaring library function 'abort' with type 'void (void) __attribute__((noreturn))'
c@         abort();
c@         ^
c@ paranoia.c:337:2: note: please include the header <stdlib.h> or explicitly provide a declaration for 'abort'
c@ paranoia.c:340:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ main()
c@ ^~~~
c@ paranoia.c:366:17: warning: incompatible pointer types passing 'int ()' to parameter of type '__sighandler_t *' (aka 'void (*)(int)') [-Wincompatible-pointer-types]
c@         signal(SIGFPE, sigfpe);
c@                        ^~~~~~
c@ /usr/include/sys/signal.h:441:45: note: passing argument to parameter here
c@ __sighandler_t *signal(int, __sighandler_t *);
c@                                             ^
c@ paranoia.c:368:2: warning: implicit declaration of function 'Instructions' is invalid in C99 [-Wimplicit-function-declaration]
c@         Instructions();
c@         ^
c@ paranoia.c:369:2: warning: implicit declaration of function 'Pause' is invalid in C99 [-Wimplicit-function-declaration]
c@         Pause();
c@         ^
c@ paranoia.c:370:2: warning: implicit declaration of function 'Heading' is invalid in C99 [-Wimplicit-function-declaration]
c@         Heading();
c@         ^
c@ paranoia.c:372:2: warning: implicit declaration of function 'Characteristics' is invalid in C99 [-Wimplicit-function-declaration]
c@         Characteristics();
c@         ^
c@ paranoia.c:374:2: warning: implicit declaration of function 'History' is invalid in C99 [-Wimplicit-function-declaration]
c@         History();
c@         ^
c@ paranoia.c:381:2: warning: implicit declaration of function 'TstCond' is invalid in C99 [-Wimplicit-function-declaration]
c@         TstCond (Failure, (Zero + Zero == Zero) && (One - One == Zero)
c@         ^
c@ paranoia.c:390:3: warning: implicit declaration of function 'TstPtUf' is invalid in C99 [-Wimplicit-function-declaration]
c@                 TstPtUf();
c@                 ^
c@ paranoia.c:579:3: warning: implicit declaration of function 'BadCond' is invalid in C99 [-Wimplicit-function-declaration]
c@                 BadCond(Serious, "Disagreements among the values X1, Y1, Z1,\n");
c@                 ^
c@ paranoia.c:583:3: warning: implicit declaration of function 'notify' is invalid in C99 [-Wimplicit-function-declaration]
c@                 notify("Possibly some part of this");
c@                 ^
c@ paranoia.c:984:2: warning: implicit declaration of function 'SqXMinX' is invalid in C99 [-Wimplicit-function-declaration]
c@         SqXMinX (Serious);
c@         ^
c@ paranoia.c:1140:7: warning: implicit declaration of function 'NewD' is invalid in C99 [-Wimplicit-function-declaration]
c@                                                 NewD();
c@                                                 ^
c@ paranoia.c:1148:7: warning: implicit declaration of function 'SR3750' is invalid in C99 [-Wimplicit-function-declaration]
c@                                                 SR3750();
c@                                                 ^
c@ paranoia.c:1209:3: warning: implicit declaration of function 'SR3980' is invalid in C99 [-Wimplicit-function-declaration]
c@                 SR3980();
c@                 ^
c@ paranoia.c:1217:4: warning: implicit declaration of function 'PrintIfNPositive' is invalid in C99 [-Wimplicit-function-declaration]
c@                         PrintIfNPositive();
c@                         ^
c@ paranoia.c:1415:5: warning: explicitly assigning a variable of type 'double' to itself [-Wself-assign]
c@                 X = X;
c@                 ~ ^ ~
c@ paranoia.c:1580:3: warning: implicit declaration of function 'IsYeqX' is invalid in C99 [-Wimplicit-function-declaration]
c@                 IsYeqX();
c@                 ^
c@ paranoia.c:1741:2: warning: implicit declaration of function 'read' is invalid in C99 [-Wimplicit-function-declaration]
c@         read (KEYBOARD, ch, 8);
c@         ^
c@ paranoia.c:1845:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ Pause()
c@ ^~~~~
c@ paranoia.c:1858:2: warning: control reaches end of non-void function [-Wreturn-type]
c@         }
c@         ^
c@ paranoia.c:1862:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ TstCond (K, Valid, T)
c@ ^~~~~~~
c@ paranoia.c:1865:49: warning: control reaches end of non-void function [-Wreturn-type]
c@ { if (! Valid) { BadCond(K,T); printf(".\n"); } }
c@                                                 ^
c@ paranoia.c:1867:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ BadCond(K, T)
c@ ^~~~~~~
c@ paranoia.c:1875:2: warning: control reaches end of non-void function [-Wreturn-type]
c@         }
c@         ^
c@ paranoia.c:1899:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ SqXMinX (ErrKind)
c@ ^~~~~~~
c@ paranoia.c:1915:2: warning: control reaches end of non-void function [-Wreturn-type]
c@         }
c@         ^
c@ paranoia.c:1919:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ NewD()
c@ ^~~~
c@ paranoia.c:1930:2: warning: control reaches end of non-void function [-Wreturn-type]
c@         }
c@         ^
c@ paranoia.c:1934:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ SR3750()
c@ ^~~~~~
c@ paranoia.c:1947:2: warning: control reaches end of non-void function [-Wreturn-type]
c@         }
c@         ^
c@ paranoia.c:1951:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ IsYeqX()
c@ ^~~~~~
c@ paranoia.c:1966:2: warning: control reaches end of non-void function [-Wreturn-type]
c@         }
c@         ^
c@ paranoia.c:1970:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ SR3980()
c@ ^~~~~~
c@ paranoia.c:1979:2: warning: control reaches end of non-void function [-Wreturn-type]
c@         }
c@         ^
c@ paranoia.c:1983:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ PrintIfNPositive()
c@ ^~~~~~~~~~~~~~~~
c@ paranoia.c:1986:2: warning: control reaches end of non-void function [-Wreturn-type]
c@         }
c@         ^
c@ paranoia.c:1990:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ TstPtUf()
c@ ^~~~~~~
c@ paranoia.c:2046:2: warning: control reaches end of non-void function [-Wreturn-type]
c@         }
c@         ^
c@ paranoia.c:2048:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ notify(s)
c@ ^~~~~~
c@ paranoia.c:2053:2: warning: control reaches end of non-void function [-Wreturn-type]
c@         }
c@         ^
c@ paranoia.c:2059:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ msglist(s)
c@ ^~~~~~~
c@ paranoia.c:2061:35: warning: control reaches end of non-void function [-Wreturn-type]
c@ { while(*s) printf("%s\n", *s++); }
c@                                   ^
c@ paranoia.c:2063:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ Instructions()
c@ ^~~~~~~~~~~~
c@ paranoia.c:2078:2: warning: control reaches end of non-void function [-Wreturn-type]
c@         }
c@         ^
c@ paranoia.c:2082:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ Heading()
c@ ^~~~~~~
c@ paranoia.c:2106:2: warning: control reaches end of non-void function [-Wreturn-type]
c@         }
c@         ^
c@ paranoia.c:2110:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ Characteristics()
c@ ^~~~~~~~~~~~~~~
c@ paranoia.c:2135:2: warning: control reaches end of non-void function [-Wreturn-type]
c@         }
c@         ^
c@ paranoia.c:2137:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ History()
c@ ^~~~~~~
c@ paranoia.c:2164:2: warning: control reaches end of non-void function [-Wreturn-type]
c@         }
c@         ^
c@ 54 warnings generated.
c@ ttcp.c:126:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ main(argc,argv)
c@ ^~~~
c@ ttcp.c:154:11: warning: implicit declaration of function 'atoi' is invalid in C99 [-Wimplicit-function-declaration]
c@                         nbuf = atoi(&argv[0][2]);
c@                                ^
c@ ttcp.c:185:3: warning: implicitly declaring library function 'bzero' with type 'void (void *, unsigned long)'
c@                 bzero((char *)&sinhim, sizeof(sinhim));
c@                 ^
c@ ttcp.c:185:3: note: please include the header <strings.h> or explicitly provide a declaration for 'bzero'
c@ ttcp.c:194:29: warning: implicit declaration of function 'inet_addr' is invalid in C99 [-Wimplicit-function-declaration]
c@                         sinhim.sin_addr.s_addr = inet_addr(host);
c@                                                  ^
c@ ttcp.c:198:5: warning: implicit declaration of function 'err' is invalid in C99 [-Wimplicit-function-declaration]
c@                                 err("bad hostname");
c@                                 ^
c@ ttcp.c:200:4: warning: implicit declaration of function 'bcopy' is invalid in C99 [-Wimplicit-function-declaration]
c@                         bcopy(addr->h_addr,(char*)&addr_tmp, addr->h_length);
c@                         ^
c@ ttcp.c:205:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
c@ #endif cray
c@        ^
c@        //
c@ ttcp.c:219:22: warning: implicitly declaring library function 'malloc' with type 'void *(unsigned long)'
c@         if ( (buf = (char *)malloc(buflen+bufalign)) == (char *)NULL)
c@                             ^
c@ ttcp.c:219:22: note: please include the header <stdlib.h> or explicitly provide a declaration for 'malloc'
c@ ttcp.c:239:2: warning: implicit declaration of function 'mes' is invalid in C99 [-Wimplicit-function-declaration]
c@         mes("socket");
c@         ^
c@ ttcp.c:241:15: warning: incompatible pointer types passing 'struct sockaddr_in *' to parameter of type 'const struct sockaddr *' [-Wincompatible-pointer-types]
c@         if (bind(fd, &sinme, sizeof(sinme)) < 0)
c@                      ^~~~~~
c@ /usr/include/sys/socket.h:634:38: note: passing argument to parameter here
c@ int     bind(int, const struct sockaddr *, socklen_t);
c@                                          ^
c@ ttcp.c:251:7: warning: extra tokens at end of #else directive [-Wextra-tokens]
c@ #else BSD43
c@       ^
c@       //
c@ ttcp.c:264:18: warning: incompatible pointer types passing 'struct sockaddr_in *' to parameter of type 'const struct sockaddr *' [-Wincompatible-pointer-types]
c@                 if(connect(fd, &sinhim, sizeof(sinhim) ) < 0)
c@                                ^~~~~~~
c@ /usr/include/sys/socket.h:635:41: note: passing argument to parameter here
c@ int     connect(int, const struct sockaddr *, socklen_t);
c@                                             ^
c@ ttcp.c:275:7: warning: extra tokens at end of #else directive [-Wextra-tokens]
c@ #else BSD43
c@       ^
c@       //
c@ ttcp.c:282:21: warning: incompatible pointer types passing 'struct sockaddr_in *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
c@                 if((fd=accept(fd, &frominet, &fromlen) ) < 0)
c@                                   ^~~~~~~~~
c@ /usr/include/sys/socket.h:633:45: note: passing argument to parameter here
c@ int     accept(int, struct sockaddr * __restrict, socklen_t * __restrict);
c@                                                 ^
c@ ttcp.c:282:32: warning: passing 'int *' to parameter of type 'socklen_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Wpointer-sign]
c@                 if((fd=accept(fd, &frominet, &fromlen) ) < 0)
c@                                              ^~~~~~~~
c@ /usr/include/sys/socket.h:633:69: note: passing argument to parameter here
c@ int     accept(int, struct sockaddr * __restrict, socklen_t * __restrict);
c@                                                                         ^
c@ ttcp.c:286:25: warning: incompatible pointer types passing 'struct sockaddr_in *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
c@                   if (getpeername(fd, (struct sockaddr_in *) &peer, 
c@                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
c@ /usr/include/sys/socket.h:641:50: note: passing argument to parameter here
c@ int     getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict);
c@                                                      ^
c@ ttcp.c:287:5: warning: passing 'int *' to parameter of type 'socklen_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Wpointer-sign]
c@                                 &peerlen) < 0) {
c@                                 ^~~~~~~~
c@ /usr/include/sys/socket.h:641:74: note: passing argument to parameter here
c@ int     getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict);
c@                                                                              ^
c@ ttcp.c:291:4: warning: implicit declaration of function 'inet_ntoa' is invalid in C99 [-Wimplicit-function-declaration]
c@                         inet_ntoa(peer.sin_addr));
c@                         ^
c@ ttcp.c:291:4: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat]
c@                         inet_ntoa(peer.sin_addr));
c@                         ^~~~~~~~~~~~~~~~~~~~~~~~
c@ ttcp.c:300:4: warning: implicit declaration of function 'pattern' is invalid in C99 [-Wimplicit-function-declaration]
c@                         pattern( buf, buflen );
c@                         ^
c@ ttcp.c:301:19: warning: implicit declaration of function 'Nwrite' is invalid in C99 [-Wimplicit-function-declaration]
c@                         if(udp)  (void)Nwrite( fd, buf, 4 ); /* rcvr start */
c@                                        ^
c@ ttcp.c:307:20: warning: implicit declaration of function 'Nread' is invalid in C99 [-Wimplicit-function-declaration]
c@                             while ((cnt=Nread(fd,buf,buflen)) > 0)  {
c@                                         ^
c@ ttcp.c:327:15: warning: implicit declaration of function 'read' is invalid in C99 [-Wimplicit-function-declaration]
c@                         while((cnt=read(0,buf,buflen)) > 0 &&
c@                                    ^
c@ ttcp.c:332:8: warning: implicit declaration of function 'write' is invalid in C99 [-Wimplicit-function-declaration]
c@                             write(1,buf,cnt) == cnt)
c@                             ^
c@ ttcp.c:359:3: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
c@                 numCalls,
c@                 ^~~~~~~~
c@ ttcp.c:367:3: warning: format specifies type 'unsigned int' but the argument has type 'char *' [-Wformat]
c@                 buf);
c@                 ^~~
c@ ttcp.c:369:2: warning: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))'
c@         exit(0);
c@         ^
c@ ttcp.c:369:2: note: please include the header <stdlib.h> or explicitly provide a declaration for 'exit'
c@ ttcp.c:372:17: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
c@         fprintf(stderr,Usage);
c@                        ^~~~~
c@ ttcp.c:376:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ err(s)
c@ ^~~
c@ ttcp.c:385:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ mes(s)
c@ ^~~
c@ ttcp.c:389:1: warning: control reaches end of non-void function [-Wreturn-type]
c@ }
c@ ^
c@ ttcp.c:391:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ pattern( cp, cnt )
c@ ^~~~~~~
c@ ttcp.c:401:1: warning: control reaches end of non-void function [-Wreturn-type]
c@ }
c@ ^
c@ ttcp.c:441:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
c@ #endif SYSV
c@        ^
c@        //
c@ ttcp.c:470:8: warning: implicitly declaring library function 'strncpy' with type 'char *(char *, const char *, unsigned long)'
c@         (void)strncpy( str, line, len );
c@               ^
c@ ttcp.c:470:8: note: please include the header <string.h> or explicitly provide a declaration for 'strncpy'
c@ ttcp.c:516:28: warning: format specifies type 'int' but the argument has type 'time_t' (aka 'long') [-Wformat]
c@                         sprintf(outp,"%d.%01d", tdiff.tv_sec, tdiff.tv_usec/100000);
c@                                       ~~        ^~~~~~~~~~~~
c@                                       %ld
c@ ttcp.c:516:42: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
c@                         sprintf(outp,"%d.%01d", tdiff.tv_sec, tdiff.tv_usec/100000);
c@                                          ~~~~                 ^~~~~~~~~~~~~~~~~~~~
c@                                          %01ld
c@ ttcp.c:522:28: warning: format specifies type 'int' but the argument has type 'time_t' (aka 'long') [-Wformat]
c@                         sprintf(outp,"%d.%01d", tdiff.tv_sec, tdiff.tv_usec/100000);
c@                                       ~~        ^~~~~~~~~~~~
c@                                       %ld
c@ ttcp.c:522:42: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
c@                         sprintf(outp,"%d.%01d", tdiff.tv_sec, tdiff.tv_usec/100000);
c@                                          ~~~~                 ^~~~~~~~~~~~~~~~~~~~
c@                                          %01ld
c@ ttcp.c:544:23: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
c@                         sprintf(outp,"%d", t == 0 ? 0 : (r1->ru_ixrss-r0->ru_ixrss)/t);
c@                                       ~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c@                                       %ld
c@ ttcp.c:549:23: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
c@                         sprintf(outp,"%d", t == 0 ? 0 :
c@                                       ~~   ^~~~~~~~~~~~
c@                                       %ld
c@ ttcp.c:555:23: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
c@                         sprintf(outp,"%d", t == 0 ? 0 :
c@                                       ~~   ^~~~~~~~~~~~
c@                                       %ld
c@ ttcp.c:562:23: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
c@                         sprintf(outp,"%d", r1->ru_maxrss/2);
c@                                       ~~   ^~~~~~~~~~~~~~~
c@                                       %ld
c@ ttcp.c:567:23: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
c@                         sprintf(outp,"%d", r1->ru_majflt-r0->ru_majflt);
c@                                       ~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
c@                                       %ld
c@ ttcp.c:572:23: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
c@                         sprintf(outp,"%d", r1->ru_minflt-r0->ru_minflt);
c@                                       ~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
c@                                       %ld
c@ ttcp.c:577:23: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
c@                         sprintf(outp,"%d", r1->ru_inblock-r0->ru_inblock);
c@                                       ~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c@                                       %ld
c@ ttcp.c:582:23: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
c@                         sprintf(outp,"%d", r1->ru_oublock-r0->ru_oublock);
c@                                       ~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c@                                       %ld
c@ ttcp.c:586:26: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
c@                         sprintf(outp,"%d+%d", r1->ru_nvcsw-r0->ru_nvcsw,
c@                                       ~~      ^~~~~~~~~~~~~~~~~~~~~~~~~
c@                                       %ld
c@ ttcp.c:587:5: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
c@                                 r1->ru_nivcsw-r0->ru_nivcsw );
c@                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
c@ ttcp.c:590:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
c@ #endif !SYSV
c@        ^
c@        //
c@ ttcp.c:645:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ Nread( fd, buf, count )
c@ ^~~~~
c@ ttcp.c:651:23: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'void *' [-Wint-conversion]
c@                 cnt = recvfrom( fd, buf, count, 0, &from, &len );
c@                                     ^~~
c@ /usr/include/sys/socket.h:646:29: note: passing argument to parameter here
c@ ssize_t recvfrom(int, void *, size_t, int, struct sockaddr * __restrict, socklen_t * __restrict);
c@                             ^
c@ ttcp.c:651:38: warning: incompatible pointer types passing 'struct sockaddr_in *' to parameter of type 'struct sockaddr *' [-Wincompatible-pointer-types]
c@                 cnt = recvfrom( fd, buf, count, 0, &from, &len );
c@                                                    ^~~~~
c@ /usr/include/sys/socket.h:646:72: note: passing argument to parameter here
c@ ssize_t recvfrom(int, void *, size_t, int, struct sockaddr * __restrict, socklen_t * __restrict);
c@                                                                        ^
c@ ttcp.c:651:45: warning: passing 'int *' to parameter of type 'socklen_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Wpointer-sign]
c@                 cnt = recvfrom( fd, buf, count, 0, &from, &len );
c@                                                           ^~~~
c@ /usr/include/sys/socket.h:646:96: note: passing argument to parameter here
c@ ssize_t recvfrom(int, void *, size_t, int, struct sockaddr * __restrict, socklen_t * __restrict);
c@                                                                                                ^
c@ ttcp.c:655:10: warning: implicit declaration of function 'mread' is invalid in C99 [-Wimplicit-function-declaration]
c@                         cnt = mread( fd, buf, count );  /* fill buf */
c@                               ^
c@ ttcp.c:667:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ Nwrite( fd, buf, count )
c@ ^~~~~~
c@ ttcp.c:672:21: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const void *' [-Wint-conversion]
c@                 cnt = sendto( fd, buf, count, 0, &sinhim, sizeof(sinhim) );
c@                                   ^~~
c@ /usr/include/sys/socket.h:649:33: note: passing argument to parameter here
c@ ssize_t sendto(int, const void *,
c@                                 ^
c@ ttcp.c:672:36: warning: incompatible pointer types passing 'struct sockaddr_in *' to parameter of type 'const struct sockaddr *' [-Wincompatible-pointer-types]
c@                 cnt = sendto( fd, buf, count, 0, &sinhim, sizeof(sinhim) );
c@                                                  ^~~~~~~
c@ /usr/include/sys/socket.h:650:42: note: passing argument to parameter here
c@             size_t, int, const struct sockaddr *, socklen_t);
c@                                                 ^
c@ ttcp.c:688:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
c@ delay(us)
c@ ^~~~~
c@ ttcp.c:694:19: warning: incompatible pointer types passing 'char *' to parameter of type 'fd_set *' (aka 'struct fd_set *') [-Wincompatible-pointer-types]
c@         (void)select( 1, (char *)0, (char *)0, (char *)0, &tv );
c@                          ^~~~~~~~~
c@ /usr/include/sys/select.h:103:25: note: passing argument to parameter here
c@ int     select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
c@                             ^
c@ ttcp.c:694:30: warning: incompatible pointer types passing 'char *' to parameter of type 'fd_set *' (aka 'struct fd_set *') [-Wincompatible-pointer-types]
c@         (void)select( 1, (char *)0, (char *)0, (char *)0, &tv );
c@                                     ^~~~~~~~~
c@ /usr/include/sys/select.h:103:35: note: passing argument to parameter here
c@ int     select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
c@                                       ^
c@ ttcp.c:694:41: warning: incompatible pointer types passing 'char *' to parameter of type 'fd_set *' (aka 'struct fd_set *') [-Wincompatible-pointer-types]
c@         (void)select( 1, (char *)0, (char *)0, (char *)0, &tv );
c@                                                ^~~~~~~~~
c@ /usr/include/sys/select.h:103:45: note: passing argument to parameter here
c@ int     select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
c@                                                 ^
c@ ttcp.c:32:13: warning: unused variable 'RCSid' [-Wunused-variable]
c@ static char RCSid[] = "ttcp.c $Revision: 1.4 $";
c@             ^
c@ 63 warnings generated.

Mostly useful.  clang finds more problems than lint, but not all the ones
found by lint.  The output format is much worse, except occasionally its
verboseness makes the problem obvious without you having to read the source
files.

Many more errors can be found using more compiler flags, but I think lint
can find a few more using different flags too -- at least all of the
undeclared functions, which should be fixed first.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130521133211.K1076>