Re: [PATCH 0/4] fix make sparse warning
flat view
From: Ramsay Jones <hidden>
Date: 2020-04-24 16:46:07
On 24/04/2020 00:58, Danh Doan wrote:
On 2020-04-24 00:10:25+0100, Ramsay Jones [off-list ref] wrote:quoted
On 23/04/2020 14:47, Đoàn Trần Công Danh wrote:quoted
It's happened that I tried to run make check on project that support autoconf.I try to ignore autoconf as much as possible, so I don't know why peopleFor some reason, people refer to autotools as autohellquoted
who use it regularly seem to expect a 'make check' target (is that anything to do with ./config.status --recheck?).Because it's autotools's recommendation. https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Basic-Installation.html#Basic-Installation https://www.gnu.org/software/automake/manual/automake.html#Standard-Targets
Ah, OK, that explains alot! :D I have never seen that documented before, so thanks for the reference. Having said that, most all 'autotools' projects I have seen have had an 'make test' target and _not_ 'make check'! (Well, thinking about it, none of those were actual GNU projects - maybe that's the difference). [snip]
quoted
For those interested, the 'too much warnings' on the 'pu' branch looks like (for pu@faf094bf11): $ make sparse >psp-out 2>&1 $ diff nsp-out psp-out 154a155 > SP refs/reftable-backend.c 406a408 > SP t/helper/test-proc-receive.c 447a450,511 > SP reftable/basics.c > reftable/basics.c:157:6: warning: symbol 'reftable_malloc_ptr' was not declared. Should it be static? > reftable/basics.c:158:6: warning: symbol 'reftable_realloc_ptr' was not declared. Should it be static? > reftable/basics.c:159:6: warning: symbol 'reftable_free_ptr' was not declared. Should it be static?
[snip]
quoted
> SP reftable/writer.c > reftable/writer.c:231:31: warning: Using plain integer as NULL pointer > reftable/writer.c:299:39: warning: Using plain integer as NULL pointer > reftable/writer.c:347:47: warning: Using plain integer as NULL pointer > reftable/writer.c:426:31: warning: Using plain integer as NULL pointer > reftable/writer.c:468:45: warning: Using plain integer as NULL pointer > reftable/writer.c:584:11: warning: symbol 'debug' was not declared. Should it be static? > SP reftable/zlib-compat.c Also, my static-check perl script says the following symbols are not used outside the file which defines them (so they could be marked static):All of them are in reftable, and they're catched by `make sparse`, too.
Yeah, I didn't even look at the output. ;-) However, the output from static-check.pl is usually a super-set of the those from sparse - because sparse is really only looking at the declarations (or lack thereof) in one compilation unit. In contrast, static-check.pl looks at all object files to tie up definitions with use (so across compilation units). (which is also why you have to be careful not to leave stale '*.o' files laying around when switching branches). ATB, Ramsay Jones