git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Danh Doan <congdanhqx@gmail.com>
To: Ramsay Jones <ramsay@ramsayjones.plus.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 0/4] fix make sparse warning
Date: Fri, 24 Apr 2020 06:58:09 +0700	[thread overview]
Message-ID: <20200423235809.GA1949@danh.dev> (raw)
In-Reply-To: <86ef24e2-3ab6-5e9c-900b-0eb4dbc1bb04@ramsayjones.plus.com>

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.

-- 
Danh

  reply	other threads:[~2020-04-23 23:58 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-23 13:47 Đoàn Trần Công Danh
2020-04-23 13:47 ` [PATCH 1/4] C: s/0/NULL/ for pointer type Đoàn Trần Công Danh
2020-04-24  0:39   ` Ramsay Jones
2020-04-24  0:54     ` Junio C Hamano
2020-04-24  1:09       ` Danh Doan
2020-04-24  1:54         ` Junio C Hamano
2020-05-14 21:37       ` Luc Van Oostenryck
2020-04-23 13:47 ` [PATCH 2/4] compat/regex: silence `make sparse` warning Đoàn Trần Công Danh
2020-04-24  0:51   ` Ramsay Jones
2020-04-24  1:04     ` Danh Doan
2020-04-23 13:47 ` [PATCH 3/4] graph.c: limit linkage of internal variable Đoàn Trần Công Danh
2020-04-24  0:52   ` Ramsay Jones
2020-04-23 13:47 ` [PATCH 4/4] progress.c: silence cgcc suggestion about internal linkage Đoàn Trần Công Danh
2020-04-24  0:58   ` Ramsay Jones
2020-04-24  5:54     ` Jeff King
2020-04-23 13:47 ` [PATCH 5/4] fmt-merge-msg.c: fix `make sparse` on next Đoàn Trần Công Danh
2020-04-23 23:10 ` [PATCH 0/4] fix make sparse warning Ramsay Jones
2020-04-23 23:58   ` Danh Doan [this message]
2020-04-24 16:38     ` Ramsay Jones
2020-04-24 15:12 ` [PATCH v2 0/4] Fix Sparse Warning Đoàn Trần Công Danh
2020-04-24 15:12   ` [PATCH v2 1/4] test-parse-pathspec-file.c: s/0/NULL/ for pointer type Đoàn Trần Công Danh
2020-04-24 15:12   ` [PATCH v2 2/4] compat/regex: include alloca.h before undef it Đoàn Trần Công Danh
2020-04-24 16:56     ` Ramsay Jones
2020-04-24 17:09       ` Danh Doan
2020-04-24 18:29         ` Ramsay Jones
2020-04-24 22:34           ` Danh Doan
2020-04-25 20:28             ` Ramsay Jones
2020-04-26  0:54               ` Danh Doan
2020-04-26  1:10                 ` Danh Doan
2020-04-26 16:17                 ` Ramsay Jones
2020-04-26 19:38                   ` Ramsay Jones
2020-04-26 22:37                     ` Junio C Hamano
2020-04-27  1:08                   ` Danh Doan
2020-04-27 16:28                     ` Ramsay Jones
2020-04-27 16:46                       ` Danh Doan
2020-04-27 17:21                         ` Ramsay Jones
2020-04-24 15:12   ` [PATCH v2 3/4] graph.c: limit linkage of internal variable Đoàn Trần Công Danh
2020-04-24 15:12   ` [PATCH v2 4/4] progress.c: silence cgcc suggestion about internal linkage Đoàn Trần Công Danh
2020-04-24 16:40   ` [PATCH v2 0/4] Fix Sparse Warning Ramsay Jones
2020-04-25 13:13 ` [PATCH 0/4] fix make sparse warning Johannes Schindelin
2020-04-26  3:32   ` Danh Doan
2020-04-26 16:24     ` Ramsay Jones
2020-05-01 20:02       ` Johannes Schindelin
2020-04-27 14:22 ` [PATCH v3 0/4] Partial fix `make sparse` Đoàn Trần Công Danh
2020-04-27 14:22   ` [PATCH v3 1/4] test-parse-pathspec-file.c: s/0/NULL/ for pointer type Đoàn Trần Công Danh
2020-04-27 14:22   ` [PATCH v3 2/4] compat/regex: move stdlib.h up in inclusion chain Đoàn Trần Công Danh
2020-04-27 16:41     ` Ramsay Jones
2020-04-27 14:22   ` [PATCH v3 3/4] graph.c: limit linkage of internal variable Đoàn Trần Công Danh
2020-04-27 14:22   ` [PATCH v3 4/4] progress.c: silence cgcc suggestion about internal linkage Đoàn Trần Công Danh
2020-05-01 20:09     ` Johannes Schindelin
2020-04-27 16:35   ` [PATCH v3 0/4] Partial fix `make sparse` Ramsay Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200423235809.GA1949@danh.dev \
    --to=congdanhqx@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ramsay@ramsayjones.plus.com \
    --subject='Re: [PATCH 0/4] fix make sparse warning' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).