Re: [RFC][PATCH 00/10] Sparse: Git's "make check" target

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Josh Triplett
Date: Saturday, June 9, 2007 - 12:08 am

Ramsay Jones wrote:
 to


Glad to hear it!

e to

ted
mmit
s 106

One note about using Sparse with Git: you almost certainly don't want to =
pass
-Wall to sparse, and current Git passes CFLAGS to Sparse which will do ex=
actly
that.  -Wall turns on all possible Sparse warnings, including nitpicky
warnings and warnings with a high false positive rate.  You should start =
from
the default set of Sparse warnings, and add additional warnings as desire=
d, or
turn off those you absolutely can't live with.  Current Sparse from Git (=
post
0.3, after commit e18c1014449adf42520daa9d3e53f78a3d98da34) has a change =
to
cgcc to filter out -Wall, so you can pass -Wall to GCC but not Sparse.  S=
ee
below for other reasons why you should use cgcc.

That said, this suggests that perhaps Sparse should treat -Wall different=
ly
for compatibility with GCC; specifically, perhaps Sparse should just igno=
re
-Wall, as its meaning with GCC (enable a reasonable default set of warnin=
gs)
already occurs by default in Sparse.  The current -Wall could become some=
thing
like -Weverything.  This would make Sparse somewhat less intuitive, but
somewhat more GCC compatible.

sulted

ings
" warning

Awesome.  I'll take a look at that patch series.

 output
nter
idn't
vidual

You can easily fix that problem if you use cgcc as CC.

bly should
orm
Z_NULL
his is
cribe
[...]
care either
hat, I
 to
er.]

And at one point prototypes didn't exist either. :)

Other valid null pointers exist, such as (void *)0.  You could also use (=
char
*)0 in this particular case.  Sparse complains because you just use the
integer 0.  I suggest just using NULL.

If you want to keep using Z_NULL rather than NULL, you could always undef=
 it
and define it as NULL after including the zlib header files.

If you really want to turn that particular Sparse warning off, you can us=
e
-Wno-non-pointer-null.  However, I don't think you should do that.

=2E3

=2Esh)
lags=20

Note that you could do that much more simply by using:
gcc -E -dM -x c /dev/null | sed ...

However, see below about using cgcc instead.

hought

Sparse has defined __STDC__ since 2003, well before even version 0.1.

ck" target

Please go with that option.  In addition to providing an easy way to use
sparse and GCC together (make CC=3Dcgcc), cgcc defines arch-specific flag=
s that
sparse currently does not.  Ideally sparse should define these flags, but=
 that
would add some architecture-specific logic to sparse, which would then re=
quire
sparse to know the desired machine target.  That may need to happen in th=
e
future, but I don't have a good plan for how to do it yet.  In the meanti=
me,
please run sparse through cgcc.

Also, you might consider just using cgcc to run both GCC and Sparse.  Tha=
t
would handle the issue of target-specific CFLAGS, by ensuring that Sparse=
 and
GCC always see the same CFLAGS.

- Josh Triplett
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [RFC][PATCH 00/10] Sparse: Git's "make check" target, Josh Triplett, (Sat Jun 9, 12:08 am)