[Groonga-commit] groonga/groonga at 3f8b8f5 [master] clang: suppress a warning

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Jun 11 17:50:22 JST 2013


Kouhei Sutou	2013-06-11 17:50:22 +0900 (Tue, 11 Jun 2013)

  New Revision: 3f8b8f56567f6faf9b17083a8608740ecd69e75c
  https://github.com/groonga/groonga/commit/3f8b8f56567f6faf9b17083a8608740ecd69e75c

  Message:
    clang: suppress a warning
    
    Initialize variable explicitly.
    
        ii.c:2909:17: warning: variable 'dcn' is used uninitialized whenever '||'
              condition is true [-Wsometimes-uninitialized]
                    if (!actual_chunk_size || !(rc = chunk_new(ctx, ii, &dcn,...
                        ^~~~~~~~~~~~~~~~~~
        ii.c:2911:50: note: uninitialized use occurs here
                      fake_map2(ctx, ii->chunk, &dw, dc, dcn, actual_chunk_size);
                                                         ^~~
        ii.c:2909:17: note: remove the '||' if its condition is always false
                    if (!actual_chunk_size || !(rc = chunk_new(ctx, ii, &dcn,...
                        ^~~~~~~~~~~~~~~~~~~~~
        ii.c:2886:30: note: initialize the variable 'dcn' to silence this warning
          uint32_t ds, pseg, scn, dcn;
                                     ^
                                      = 0

  Modified files:
    lib/ii.c

  Modified: lib/ii.c (+1 -1)
===================================================================
--- lib/ii.c    2013-06-11 17:21:00 +0900 (6ba9bf2)
+++ lib/ii.c    2013-06-11 17:50:22 +0900 (6a194a4)
@@ -2883,7 +2883,7 @@ buffer_flush(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h)
   grn_io_win sw, dw;
   buffer *sb, *db = NULL;
   uint8_t *dc, *sc = NULL;
-  uint32_t ds, pseg, scn, dcn;
+  uint32_t ds, pseg, scn, dcn = 0;
   if (ii->header->binfo[seg] == NOT_ASSIGNED) { return GRN_FILE_CORRUPT; }
   if ((ds = segment_get(ctx, ii)) == MAX_PSEG) { return GRN_NO_MEMORY_AVAILABLE; }
   pseg = buffer_open(ctx, ii, SEG2POS(seg, 0), NULL, &sb);
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index