Re: [PATCH 0/4] fix make sparse warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxx>

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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux