mbox series

[0/4] fix make sparse warning

Message ID cover.1587648870.git.congdanhqx@gmail.com (mailing list archive)
Headers show
Series fix make sparse warning | expand

Message

Đoàn Trần Công Danh April 23, 2020, 1:47 p.m. UTC
It's happened that I tried to run make check on project that support autoconf.
Git's Makefile told me to run `make sparse` instead.

I /think/ if we have a rule in Makefile, we should adhere to it.
I also fix another change in ds/blame-on-bloom, which I think it's worth to
fix, see: <20200423133937.GA1984@danh.dev>

This series is developed from latest master.

It's conflicted when merge down next and pu.

For next, please ignore the conflict with fmt-merge-msg.c and
apply [5/4] instead.

For pu, reftable.c has too much warnings, I'm too lazy to look into it.

Đoàn Trần Công Danh (4):
  C: s/0/NULL/ for pointer type
  compat/regex: silence `make sparse` warning
  graph.c: limit linkage of internal variable
  progress.c: silence cgcc suggestion about internal linkage

 add-interactive.c                   | 2 +-
 builtin/fmt-merge-msg.c             | 2 +-
 compat/regex/regex.c                | 1 +
 compat/regex/regex_internal.c       | 2 +-
 compat/regex/regex_internal.h       | 5 ++---
 graph.c                             | 2 +-
 log-tree.c                          | 4 ++--
 progress.c                          | 2 ++
 range-diff.c                        | 2 +-
 t/helper/test-parse-pathspec-file.c | 6 +++---
 10 files changed, 15 insertions(+), 13 deletions(-)

Comments

Ramsay Jones April 23, 2020, 11:10 p.m. UTC | #1
On 23/04/2020 14:47, Đoàn Trần Công Danh wrote:
> 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 people
who use it regularly seem to expect a 'make check' target (is that anything
to do with ./config.status --recheck?).

> Git's Makefile told me to run `make sparse` instead.

In which case, you must have had sparse installed, otherwise you would
have been directed to 'make test'. [See commit 912f9980d2 ("Makefile: help
people who run 'make check' by mistake", 2008-11-11)]

The 'check' target was introduced in commit 44c9e8594e ("Fix up header file
dependencies and add sparse checking rules", 2005-07-03). As you can see,
that target has nothing to do with autoconf/configure.

Exactly a year later, support for autoconf tools was added in commit
556677144b ("autoconf: Use autoconf to write installation directories to config.mak.autogen", 2006-07-03). This provides an 'alternative' to just
using the Makefile (which is the _primary_ method used to build git).

I suspect that the majority of git developers don't use the autoconf
tools (I have no numbers, just gut feeling).

I added the 'sparse' target in commit 0bcd9ae85d ("sparse: Fix errors due to missing target-specific variables", 2011-04-21). After nine years, we could
perhaps just drop the 'check' target altogether? dunno.

> I /think/ if we have a rule in Makefile, we should adhere to it.

Hmm, do you mean that 'make check' should be _reserved_ for autoconf use?
[fun fact: the test target in the sparse Makefile is 'check' :-D ]

> I also fix another change in ds/blame-on-bloom, which I think it's worth to
> fix, see: <20200423133937.GA1984@danh.dev>

Yes, looks good.

> This series is developed from latest master.

I have some comments on the patches (I'm running out of time here,
so I may not get to them till tomorrow).

> It's conflicted when merge down next and pu.
> 
> For next, please ignore the conflict with fmt-merge-msg.c and
> apply [5/4] instead.
> 
> For pu, reftable.c has too much warnings, I'm too lazy to look into it.

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?
  >     SP reftable/block.c
  >     SP reftable/bytes.c
  >     SP reftable/file.c
  > reftable/file.c:57:37: warning: symbol 'file_vtable' was not declared. Should it be static?
  >     SP reftable/iter.c
  > reftable/iter.c:32:33: warning: symbol 'empty_vtable' was not declared. Should it be static?
  > reftable/iter.c:61:31: warning: Using plain integer as NULL pointer
  > reftable/iter.c:69:31: warning: Using plain integer as NULL pointer
  > reftable/iter.c:96:57: warning: Using plain integer as NULL pointer
  > reftable/iter.c:124:33: warning: symbol 'filtering_ref_iterator_vtable' was not declared. Should it be static?
  > reftable/iter.c:224:33: warning: symbol 'indexed_table_ref_iter_vtable' was not declared. Should it be static?
  >     SP reftable/merged.c
  > reftable/merged.c:141:33: warning: symbol 'merged_iter_vtable' was not declared. Should it be static?
  > reftable/merged.c:283:31: warning: Using plain integer as NULL pointer
  > reftable/merged.c:296:31: warning: Using plain integer as NULL pointer
  >     SP reftable/pq.c
  >     SP reftable/reader.c
  > reftable/reader.c:180:42: warning: Using plain integer as NULL pointer
  > reftable/reader.c:181:42: warning: Using plain integer as NULL pointer
  > reftable/reader.c:284:41: warning: Using plain integer as NULL pointer
  > reftable/reader.c:360:44: warning: Using plain integer as NULL pointer
  > reftable/reader.c:396:33: warning: symbol 'table_iter_vtable' was not declared. Should it be static?
  > reftable/reader.c:450:36: warning: Using plain integer as NULL pointer
  > reftable/reader.c:498:42: warning: Using plain integer as NULL pointer
  > reftable/reader.c:500:44: warning: Using plain integer as NULL pointer
  > reftable/reader.c:501:42: warning: Using plain integer as NULL pointer
  > reftable/reader.c:502:36: warning: Using plain integer as NULL pointer
  > reftable/reader.c:565:34: warning: Using plain integer as NULL pointer
  > reftable/reader.c:610:31: warning: Using plain integer as NULL pointer
  > reftable/reader.c:623:31: warning: Using plain integer as NULL pointer
  > reftable/reader.c:669:36: warning: Using plain integer as NULL pointer
  > reftable/reader.c:670:42: warning: Using plain integer as NULL pointer
  > reftable/reader.c:671:35: warning: Using plain integer as NULL pointer
  > reftable/reader.c:672:35: warning: Using plain integer as NULL pointer
  >     SP reftable/record.c
  > reftable/record.c:556:22: warning: symbol 'obj_record_vtable' was not declared. Should it be static?
  > reftable/record.c:839:22: warning: symbol 'reftable_log_record_vtable' was not declared. Should it be static?
  > reftable/record.c:961:22: warning: symbol 'index_record_vtable' was not declared. Should it be static?
  >     SP reftable/slice.c
  > reftable/slice.c:180:37: warning: symbol 'slice_vtable' was not declared. Should it be static?
  > reftable/slice.c:200:37: warning: symbol 'malloc_vtable' was not declared. Should it be static?
  > reftable/slice.c:204:30: warning: symbol 'malloc_block_source_instance' was not declared. Should it be static?
  >     SP reftable/stack.c
  > reftable/stack.c:157:62: warning: Using plain integer as NULL pointer
  > reftable/stack.c:667:41: warning: Using plain integer as NULL pointer
  > reftable/stack.c:668:44: warning: Using plain integer as NULL pointer
  > reftable/stack.c:669:44: warning: Using plain integer as NULL pointer
  > reftable/stack.c:1085:41: warning: Using plain integer as NULL pointer
  > reftable/stack.c:1111:41: warning: Using plain integer as NULL pointer
  >     SP reftable/tree.c
  >     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):

  $ ./static-check.pl >psc
  $ diff nsc psc
  71a72,136
  > reftable/basics.o	- reftable_free_ptr
  > reftable/basics.o	- reftable_malloc_ptr
  > reftable/basics.o	- reftable_realloc_ptr
  > reftable/basics.o	- reftable_set_alloc
  > reftable/block.o	- block_reader_seek
  > reftable/block.o	- block_writer_register_restart
  > reftable/file.o	- file_vtable
  > reftable/iter.o	- empty_vtable
  > reftable/iter.o	- filtering_ref_iterator_vtable
  > reftable/iter.o	- indexed_table_ref_iter_vtable
  > reftable/merged.o	- merged_iter_vtable
  > reftable/merged.o	- reftable_merged_table_max_update_index
  > reftable/merged.o	- reftable_merged_table_min_update_index
  > reftable/merged.o	- reftable_merged_table_seek_log_at
  > reftable/pq.o	- merged_iter_pqueue_check
  > reftable/pq.o	- pq_less
  > reftable/reader.o	- block_source_close
  > reftable/reader.o	- block_source_read_block
  > reftable/reader.o	- block_source_size
  > reftable/reader.o	- init_reader
  > reftable/reader.o	- reftable_reader_hash_id
  > reftable/reader.o	- reftable_reader_refs_for
  > reftable/reader.o	- reftable_reader_seek_log
  > reftable/reader.o	- reftable_reader_seek_log_at
  > reftable/reader.o	- table_iter_vtable
  > reftable/record.o	- get_var_int
  > reftable/record.o	- index_record_vtable
  > reftable/record.o	- obj_record_vtable
  > reftable/record.o	- put_var_int
  > reftable/record.o	- record_as_log
  > reftable/record.o	- record_as_ref
  > reftable/record.o	- reftable_log_record_equal
  > reftable/record.o	- reftable_log_record_print
  > reftable/record.o	- reftable_log_record_vtable
  > reftable/record.o	- reftable_ref_record_equal
  > reftable/record.o	- reftable_ref_record_print
  > reftable/record.o	- reftable_ref_record_vtable
  > reftable/slice.o	- block_source_from_slice
  > reftable/slice.o	- malloc_block_source_instance
  > reftable/slice.o	- malloc_vtable
  > reftable/slice.o	- slice_equal
  > reftable/slice.o	- slice_vtable
  > reftable/slice.o	- slice_write
  > reftable/slice.o	- slice_write_void
  > reftable/slice.o	- slice_yield
  > reftable/stack.o	- fastlog2
  > reftable/stack.o	- read_lines
  > reftable/stack.o	- reftable_addition_add
  > reftable/stack.o	- reftable_addition_close
  > reftable/stack.o	- reftable_addition_commit
  > reftable/stack.o	- reftable_stack_auto_compact
  > reftable/stack.o	- reftable_stack_compaction_stats
  > reftable/stack.o	- reftable_stack_destroy
  > reftable/stack.o	- reftable_stack_new_addition
  > reftable/stack.o	- reftable_stack_read_log
  > reftable/stack.o	- reftable_stack_reload
  > reftable/stack.o	- sizes_to_segments
  > reftable/stack.o	- stack_try_add
  > reftable/stack.o	- stack_write_compact
  > reftable/stack.o	- suggest_compaction_segment
  > reftable/writer.o	- debug
  > reftable/writer.o	- writer_clear_index
  > reftable/writer.o	- writer_finish_public_section
  > reftable/writer.o	- writer_flush_block
  > reftable/writer.o	- writer_stats

Note: I have not looked at any of the reftable patches/files.

ATB,
Ramsay Jones
Đoàn Trần Công Danh April 23, 2020, 11:58 p.m. UTC | #2
On 2020-04-24 00:10:25+0100, Ramsay Jones <ramsay@ramsayjones.plus.com> wrote:
> 
> 
> On 23/04/2020 14:47, Đoàn Trần Công Danh wrote:
> > 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 people

For some reason, people refer to autotools as autohell

> 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

Yes, Linux kernel, and Git don't like GNU Coding Standards (and me
neither, because of their weird bracket position). But, it's
reasonable expectation if autotools is used.

> > Git's Makefile told me to run `make sparse` instead.
> 
> In which case, you must have had sparse installed, otherwise you would
> have been directed to 'make test'. [See commit 912f9980d2 ("Makefile: help
> people who run 'make check' by mistake", 2008-11-11)]
> 
> The 'check' target was introduced in commit 44c9e8594e ("Fix up header file
> dependencies and add sparse checking rules", 2005-07-03). As you can see,
> that target has nothing to do with autoconf/configure.
> 
> Exactly a year later, support for autoconf tools was added in commit
> 556677144b ("autoconf: Use autoconf to write installation
> directories to config.mak.autogen", 2006-07-03). This provides an
> 'alternative' to just
> using the Makefile (which is the _primary_ method used to build git).
> 
> I suspect that the majority of git developers don't use the autoconf
> tools (I have no numbers, just gut feeling).

I also think so.
 
> I added the 'sparse' target in commit 0bcd9ae85d ("sparse: Fix
> errors due to missing target-specific variables", 2011-04-21). After
> nine years, we could
> perhaps just drop the 'check' target altogether? dunno.
> 
> > I /think/ if we have a rule in Makefile, we should adhere to it.
> 
> Hmm, do you mean that 'make check' should be _reserved_ for autoconf use?
> [fun fact: the test target in the sparse Makefile is 'check' :-D ]

No, I didn't mean that, I just want to fix sparse warning.

I don't care much about the target's name,
in fact, I prefer `make test` over `make check`.

If we don't really care about sparse warning.
Let's remove this sparse target.

But, I think we do care about some sparse warning that modern compiler
stopped caring about, like the one with final_new_line.

> > I also fix another change in ds/blame-on-bloom, which I think it's worth to
> > fix, see: <20200423133937.GA1984@danh.dev>
> 
> Yes, looks good.
> 
> > This series is developed from latest master.
> 
> I have some comments on the patches (I'm running out of time here,
> so I may not get to them till tomorrow).
> 
> > It's conflicted when merge down next and pu.
> > 
> > For next, please ignore the conflict with fmt-merge-msg.c and
> > apply [5/4] instead.
> > 
> > For pu, reftable.c has too much warnings, I'm too lazy to look into it.
> 
> 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?
>   >     SP reftable/block.c
>   >     SP reftable/bytes.c
>   >     SP reftable/file.c
>   > reftable/file.c:57:37: warning: symbol 'file_vtable' was not declared. Should it be static?
>   >     SP reftable/iter.c
>   > reftable/iter.c:32:33: warning: symbol 'empty_vtable' was not declared. Should it be static?
>   > reftable/iter.c:61:31: warning: Using plain integer as NULL pointer
>   > reftable/iter.c:69:31: warning: Using plain integer as NULL pointer
>   > reftable/iter.c:96:57: warning: Using plain integer as NULL pointer
>   > reftable/iter.c:124:33: warning: symbol 'filtering_ref_iterator_vtable' was not declared. Should it be static?
>   > reftable/iter.c:224:33: warning: symbol 'indexed_table_ref_iter_vtable' was not declared. Should it be static?
>   >     SP reftable/merged.c
>   > reftable/merged.c:141:33: warning: symbol 'merged_iter_vtable' was not declared. Should it be static?
>   > reftable/merged.c:283:31: warning: Using plain integer as NULL pointer
>   > reftable/merged.c:296:31: warning: Using plain integer as NULL pointer
>   >     SP reftable/pq.c
>   >     SP reftable/reader.c
>   > reftable/reader.c:180:42: warning: Using plain integer as NULL pointer
>   > reftable/reader.c:181:42: warning: Using plain integer as NULL pointer
>   > reftable/reader.c:284:41: warning: Using plain integer as NULL pointer
>   > reftable/reader.c:360:44: warning: Using plain integer as NULL pointer
>   > reftable/reader.c:396:33: warning: symbol 'table_iter_vtable' was not declared. Should it be static?
>   > reftable/reader.c:450:36: warning: Using plain integer as NULL pointer
>   > reftable/reader.c:498:42: warning: Using plain integer as NULL pointer
>   > reftable/reader.c:500:44: warning: Using plain integer as NULL pointer
>   > reftable/reader.c:501:42: warning: Using plain integer as NULL pointer
>   > reftable/reader.c:502:36: warning: Using plain integer as NULL pointer
>   > reftable/reader.c:565:34: warning: Using plain integer as NULL pointer
>   > reftable/reader.c:610:31: warning: Using plain integer as NULL pointer
>   > reftable/reader.c:623:31: warning: Using plain integer as NULL pointer
>   > reftable/reader.c:669:36: warning: Using plain integer as NULL pointer
>   > reftable/reader.c:670:42: warning: Using plain integer as NULL pointer
>   > reftable/reader.c:671:35: warning: Using plain integer as NULL pointer
>   > reftable/reader.c:672:35: warning: Using plain integer as NULL pointer
>   >     SP reftable/record.c
>   > reftable/record.c:556:22: warning: symbol 'obj_record_vtable' was not declared. Should it be static?
>   > reftable/record.c:839:22: warning: symbol 'reftable_log_record_vtable' was not declared. Should it be static?
>   > reftable/record.c:961:22: warning: symbol 'index_record_vtable' was not declared. Should it be static?
>   >     SP reftable/slice.c
>   > reftable/slice.c:180:37: warning: symbol 'slice_vtable' was not declared. Should it be static?
>   > reftable/slice.c:200:37: warning: symbol 'malloc_vtable' was not declared. Should it be static?
>   > reftable/slice.c:204:30: warning: symbol 'malloc_block_source_instance' was not declared. Should it be static?
>   >     SP reftable/stack.c
>   > reftable/stack.c:157:62: warning: Using plain integer as NULL pointer
>   > reftable/stack.c:667:41: warning: Using plain integer as NULL pointer
>   > reftable/stack.c:668:44: warning: Using plain integer as NULL pointer
>   > reftable/stack.c:669:44: warning: Using plain integer as NULL pointer
>   > reftable/stack.c:1085:41: warning: Using plain integer as NULL pointer
>   > reftable/stack.c:1111:41: warning: Using plain integer as NULL pointer
>   >     SP reftable/tree.c
>   >     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.

>   $ ./static-check.pl >psc
>   $ diff nsc psc
>   71a72,136
>   > reftable/basics.o	- reftable_free_ptr
>   > reftable/basics.o	- reftable_malloc_ptr
>   > reftable/basics.o	- reftable_realloc_ptr
>   > reftable/basics.o	- reftable_set_alloc
>   > reftable/block.o	- block_reader_seek
>   > reftable/block.o	- block_writer_register_restart
>   > reftable/file.o	- file_vtable
>   > reftable/iter.o	- empty_vtable
>   > reftable/iter.o	- filtering_ref_iterator_vtable
>   > reftable/iter.o	- indexed_table_ref_iter_vtable
>   > reftable/merged.o	- merged_iter_vtable
>   > reftable/merged.o	- reftable_merged_table_max_update_index
>   > reftable/merged.o	- reftable_merged_table_min_update_index
>   > reftable/merged.o	- reftable_merged_table_seek_log_at
>   > reftable/pq.o	- merged_iter_pqueue_check
>   > reftable/pq.o	- pq_less
>   > reftable/reader.o	- block_source_close
>   > reftable/reader.o	- block_source_read_block
>   > reftable/reader.o	- block_source_size
>   > reftable/reader.o	- init_reader
>   > reftable/reader.o	- reftable_reader_hash_id
>   > reftable/reader.o	- reftable_reader_refs_for
>   > reftable/reader.o	- reftable_reader_seek_log
>   > reftable/reader.o	- reftable_reader_seek_log_at
>   > reftable/reader.o	- table_iter_vtable
>   > reftable/record.o	- get_var_int
>   > reftable/record.o	- index_record_vtable
>   > reftable/record.o	- obj_record_vtable
>   > reftable/record.o	- put_var_int
>   > reftable/record.o	- record_as_log
>   > reftable/record.o	- record_as_ref
>   > reftable/record.o	- reftable_log_record_equal
>   > reftable/record.o	- reftable_log_record_print
>   > reftable/record.o	- reftable_log_record_vtable
>   > reftable/record.o	- reftable_ref_record_equal
>   > reftable/record.o	- reftable_ref_record_print
>   > reftable/record.o	- reftable_ref_record_vtable
>   > reftable/slice.o	- block_source_from_slice
>   > reftable/slice.o	- malloc_block_source_instance
>   > reftable/slice.o	- malloc_vtable
>   > reftable/slice.o	- slice_equal
>   > reftable/slice.o	- slice_vtable
>   > reftable/slice.o	- slice_write
>   > reftable/slice.o	- slice_write_void
>   > reftable/slice.o	- slice_yield
>   > reftable/stack.o	- fastlog2
>   > reftable/stack.o	- read_lines
>   > reftable/stack.o	- reftable_addition_add
>   > reftable/stack.o	- reftable_addition_close
>   > reftable/stack.o	- reftable_addition_commit
>   > reftable/stack.o	- reftable_stack_auto_compact
>   > reftable/stack.o	- reftable_stack_compaction_stats
>   > reftable/stack.o	- reftable_stack_destroy
>   > reftable/stack.o	- reftable_stack_new_addition
>   > reftable/stack.o	- reftable_stack_read_log
>   > reftable/stack.o	- reftable_stack_reload
>   > reftable/stack.o	- sizes_to_segments
>   > reftable/stack.o	- stack_try_add
>   > reftable/stack.o	- stack_write_compact
>   > reftable/stack.o	- suggest_compaction_segment
>   > reftable/writer.o	- debug
>   > reftable/writer.o	- writer_clear_index
>   > reftable/writer.o	- writer_finish_public_section
>   > reftable/writer.o	- writer_flush_block
>   > reftable/writer.o	- writer_stats
> 
> Note: I have not looked at any of the reftable patches/files.

Me neither.
Ramsay Jones April 24, 2020, 4:38 p.m. UTC | #3
On 24/04/2020 00:58, Danh Doan wrote:
> On 2020-04-24 00:10:25+0100, Ramsay Jones <ramsay@ramsayjones.plus.com> wrote:
>> On 23/04/2020 14:47, Đoàn Trần Công Danh wrote:
>>> 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 people
> 
> For some reason, people refer to autotools as autohell
> 
>> 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]
>> 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]

>>   >     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
Johannes Schindelin April 25, 2020, 1:13 p.m. UTC | #4
Hi Danh,

On Thu, 23 Apr 2020, Đoàn Trần Công Danh wrote:

> It's happened that I tried to run make check on project that support autoconf.
> Git's Makefile told me to run `make sparse` instead.
>
> I /think/ if we have a rule in Makefile, we should adhere to it.
> I also fix another change in ds/blame-on-bloom, which I think it's worth to
> fix, see: <20200423133937.GA1984@danh.dev>

FWIW there is still an Azure Pipeline building `sparse` for Ubuntu every
two weeks: https://dev.azure.com/git/git/_build?definitionId=10&_a=summary

I created this Pipeline in order to support the proposed project at
https://github.com/gitgitgadget/git/issues/345 which is: teach our CI
builds to run `make sparse`.

Maybe it is time to tackle that?

Ciao,
Dscho
Đoàn Trần Công Danh April 26, 2020, 3:32 a.m. UTC | #5
On 2020-04-25 15:13:53+0200, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Hi Danh,
> 
> On Thu, 23 Apr 2020, Đoàn Trần Công Danh wrote:
> 
> > It's happened that I tried to run make check on project that support autoconf.
> > Git's Makefile told me to run `make sparse` instead.
> >
> > I /think/ if we have a rule in Makefile, we should adhere to it.
> > I also fix another change in ds/blame-on-bloom, which I think it's worth to
> > fix, see: <20200423133937.GA1984@danh.dev>
> 
> FWIW there is still an Azure Pipeline building `sparse` for Ubuntu every
> two weeks: https://dev.azure.com/git/git/_build?definitionId=10&_a=summary
> 
> I created this Pipeline in order to support the proposed project at
> https://github.com/gitgitgadget/git/issues/345 which is: teach our CI
> builds to run `make sparse`.
> 
> Maybe it is time to tackle that?

I don't think it's ready, yet!

May be it's.

But we'll need

	make sparse |
	grep -v -e 'plain integer as NULL pointer' \
		-e 'redeclared with different type'

The first one for:

	struct foo val = { 0 };

to zero structure.

The second one for different in declaration and definition (which is
fixed in sparse's master).
Ramsay Jones April 26, 2020, 4:24 p.m. UTC | #6
On 26/04/2020 04:32, Danh Doan wrote:
> On 2020-04-25 15:13:53+0200, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>> Hi Danh,
>>
>> On Thu, 23 Apr 2020, Đoàn Trần Công Danh wrote:
>>
>>> It's happened that I tried to run make check on project that support autoconf.
>>> Git's Makefile told me to run `make sparse` instead.
>>>
>>> I /think/ if we have a rule in Makefile, we should adhere to it.
>>> I also fix another change in ds/blame-on-bloom, which I think it's worth to
>>> fix, see: <20200423133937.GA1984@danh.dev>
>>
>> FWIW there is still an Azure Pipeline building `sparse` for Ubuntu every
>> two weeks: https://dev.azure.com/git/git/_build?definitionId=10&_a=summary
>>
>> I created this Pipeline in order to support the proposed project at
>> https://github.com/gitgitgadget/git/issues/345 which is: teach our CI
>> builds to run `make sparse`.
>>
>> Maybe it is time to tackle that?
> 
> I don't think it's ready, yet!

Heh, not too long ago, the 'master' and 'next' branches were 'sparse clean'.
(on non NO_REGEX builds anyway, and even on those for some of us. ;-) )
The 'pu' branch was frequently 'unclean', of course.

ATB,
Ramsay Jones

> 
> May be it's.
> 
> But we'll need
> 
> 	make sparse |
> 	grep -v -e 'plain integer as NULL pointer' \
> 		-e 'redeclared with different type'
> 
> The first one for:
> 
> 	struct foo val = { 0 };
> 
> to zero structure.
> 
> The second one for different in declaration and definition (which is
> fixed in sparse's master).
> 
>
Johannes Schindelin May 1, 2020, 8:02 p.m. UTC | #7
Hi,

On Sun, 26 Apr 2020, Ramsay Jones wrote:

> On 26/04/2020 04:32, Danh Doan wrote:
> > On 2020-04-25 15:13:53+0200, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> >> Hi Danh,
> >>
> >> On Thu, 23 Apr 2020, Đoàn Trần Công Danh wrote:
> >>
> >>> It's happened that I tried to run make check on project that support autoconf.
> >>> Git's Makefile told me to run `make sparse` instead.
> >>>
> >>> I /think/ if we have a rule in Makefile, we should adhere to it.
> >>> I also fix another change in ds/blame-on-bloom, which I think it's worth to
> >>> fix, see: <20200423133937.GA1984@danh.dev>
> >>
> >> FWIW there is still an Azure Pipeline building `sparse` for Ubuntu every
> >> two weeks: https://dev.azure.com/git/git/_build?definitionId=10&_a=summary
> >>
> >> I created this Pipeline in order to support the proposed project at
> >> https://github.com/gitgitgadget/git/issues/345 which is: teach our CI
> >> builds to run `make sparse`.
> >>
> >> Maybe it is time to tackle that?
> >
> > I don't think it's ready, yet!
>
> Heh, not too long ago, the 'master' and 'next' branches were 'sparse clean'.
> (on non NO_REGEX builds anyway, and even on those for some of us. ;-) )

Maybe we should spend the time to make it "sparse clean" again.

Of course, that would mean that reftables would have a ton of work in
front of it (not that it does already...).

> The 'pu' branch was frequently 'unclean', of course.

But mostly because there was no automated job to tell contributors about
it.

Ciao,
Dscho

>
> ATB,
> Ramsay Jones
>
> >
> > May be it's.
> >
> > But we'll need
> >
> > 	make sparse |
> > 	grep -v -e 'plain integer as NULL pointer' \
> > 		-e 'redeclared with different type'
> >
> > The first one for:
> >
> > 	struct foo val = { 0 };
> >
> > to zero structure.
> >
> > The second one for different in declaration and definition (which is
> > fixed in sparse's master).
> >
> >
>