Navigation Menu

Skip to content

Commit

Permalink
clang: suppress warnings
Browse files Browse the repository at this point in the history
Initialize variables explicitly.

    ii.c:3249:21: warning: variable 'dcn0' is used uninitialized whenever '||'
          condition is true [-Wsometimes-uninitialized]
                    if (!actual_db0_chunk_size ||
                        ^~~~~~~~~~~~~~~~~~~~~~
    ii.c:3252:56: note: uninitialized use occurs here
      ...fake_map2(ctx, ii->chunk, &dw0, dc0, dcn0, actual_db0_chunk_size);
                                              ^~~~
    ii.c:3249:21: note: remove the '||' if its condition is always false
                    if (!actual_db0_chunk_size ||
                        ^~~~~~~~~~~~~~~~~~~~~~~~~
    ii.c:3222:50: note: initialize the variable 'dcn0' to silence this warning
      uint32_t dps0, dps1, dls0, dls1, sps, scn, dcn0, dcn1;
                                                     ^
                                                      = 0
    ii.c:3261:27: warning: variable 'dcn1' is used uninitialized whenever '||'
          condition is true [-Wsometimes-uninitialized]
                          if (!actual_db1_chunk_size ||
                              ^~~~~~~~~~~~~~~~~~~~~~
    ii.c:3263:62: note: uninitialized use occurs here
      ...fake_map2(ctx, ii->chunk, &dw1, dc1, dcn1, actual_db1_chunk_size);
                                              ^~~~
    ii.c:3261:27: note: remove the '||' if its condition is always false
                          if (!actual_db1_chunk_size ||
                              ^~~~~~~~~~~~~~~~~~~~~~~~~
    ii.c:3222:56: note: initialize the variable 'dcn1' to silence this warning
      uint32_t dps0, dps1, dls0, dls1, sps, scn, dcn0, dcn1;
                                                           ^
                                                            = 0
  • Loading branch information
kou committed Jun 11, 2013
1 parent 3f8b8f5 commit fd32766
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ii.c
Expand Up @@ -3219,7 +3219,7 @@ buffer_split(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h)
grn_io_win sw, dw0, dw1;
buffer *sb, *db0 = NULL, *db1 = NULL;
uint8_t *sc = NULL, *dc0, *dc1;
uint32_t dps0, dps1, dls0, dls1, sps, scn, dcn0, dcn1;
uint32_t dps0, dps1, dls0, dls1, sps, scn, dcn0 = 0, dcn1 = 0;
if (ii->header->binfo[seg] == NOT_ASSIGNED) { return GRN_FILE_CORRUPT; }
if ((rc = buffer_segment_reserve(ctx, ii, &dls0, &dps0, &dls1, &dps1))) {
return rc;
Expand Down

0 comments on commit fd32766

Please sign in to comment.