public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
* Build failure of 'seen'
@ 2021-10-16 23:18 Ramsay Jones
  2021-10-17  1:14 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Ramsay Jones @ 2021-10-16 23:18 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, Ævar Arnfjörð Bjarmason

Hi Junio,

Tonight's build of 'seen' failed for me (on Linux and Cygwin):

      CC refs/files-backend.o
  refs/files-backend.c: In function ‘files_reflog_expire’:
  refs/files-backend.c:3212:11: error: ‘type’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   3212 |    !(type & REF_ISSYMREF) &&
        |     ~~~~~~^~~~~~~~~~~~~~~
  cc1: all warnings being treated as errors
  make: *** [Makefile:2555: refs/files-backend.o] Error 1
  $ 

gcc correctly complains, since 'type' _will_ be used uninitialized.
Note that, despite passing &type to the lock_ref_oid_basic() function,
the body of that function does not mention the parameter at all. 

I just did the obvious to get it to compile:

  $ git diff
  diff --git a/refs/files-backend.c b/refs/files-backend.c
  index ca35950a80..c7ac1d1d6b 100644
  --- a/refs/files-backend.c
  +++ b/refs/files-backend.c
  @@ -3132,7 +3132,7 @@ static int files_reflog_expire(struct ref_store *ref_store,
          struct strbuf log_file_sb = STRBUF_INIT;
          char *log_file;
          int status = 0;
  -       int type;
  +       int type = 0;
          struct strbuf err = STRBUF_INIT;
          const struct object_id *oid;
   
  $ 

... but (as you already noted) it fails the testsuite anyway.

Don't quote me (because I didn't look too hard), but I think that
commit 5bad105452 ("refs/files: remove "name exist?" check in
lock_ref_oid_basic()", 2021-10-14) removed the last use of the 'type'
parameter to lock_ref_oid_basic(). (when removing a call to the function
refs_resolve_ref_unsafe()).

ATB,
Ramsay Jones




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-17 18:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-16 23:18 Build failure of 'seen' Ramsay Jones
2021-10-17  1:14 ` Junio C Hamano
2021-10-17 10:06   ` Ævar Arnfjörð Bjarmason
2021-10-17 18:32     ` Ramsay Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox