Build failure of 'seen'

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

 



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






[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