Hi Tony and All,

2016-1-12(Tue) 12:31:32 UTC+9 Tony Mechelynck:
> On Mon, Jan 11, 2016 at 6:01 AM, h_east <[email protected]> wrote:
> > Hi Tony,
> >
> > 2016-1-11(Mon) 11:43:51 UTC+9 Tony Mechelynck:
> >> Here is what appears in the Tiny build (the Huge build has the same
> >> warning with a much longer gcc command-line):
> >>
> >> gcc -c -I. -Iproto -DHAVE_CONFIG_H     -O2 -fno-strength-reduce -Wall
> >> -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       -o objects/ops.o ops.c
> >> ops.c: In function ‘op_addsub’:
> >> ops.c:5419:17: warning: ‘length’ may be used uninitialized in this
> >> function [-Wmaybe-uninitialized]
> >>       one_change = do_addsub(oap->op_type, &pos, length, amount);
> >
> > I couldn't reproduce it.
> > But attached patch would be fixed this warning.
> > Please confirm this.
> > Thanks for reporting.
> > --
> > Best regards,
> > Hirohito Higashi (a.k.a h_east)
> >
> The warning has indeed disappeared.
> 
> I am not qualified to say if, in this case, the code does the same
> thing without the additional "if"

I explain in a little more detail.
(Hey, I'm bit drunk :-)

src/ops.c
5382         pos = oap->start;
5383         for (; pos.lnum <= oap->end.lnum; ++pos.lnum)
5384         {
5385             if (oap->block_mode)        /* Visual block mode */
5386             {
5387                 block_prep(oap, &bd, pos.lnum, FALSE);
5388                 pos.col = bd.textcol;
5389                 length = bd.textlen;
5390             }
5391             else
5392             {
5393                 if (oap->motion_type == MLINE)
5394                 {
5395                     curwin->w_cursor.col = 0;
5396                     pos.col = 0;
5397                     length = (colnr_T)STRLEN(ml_get(pos.lnum));
5398                 }
5399                 else
5400                 {
5401                     if (!oap->inclusive)
5402                         dec(&(oap->end));
5403                     length = (colnr_T)STRLEN(ml_get(pos.lnum));
5404                     pos.col = 0;
5405                     if (pos.lnum == oap->start.lnum)
5406                     {
5407                         pos.col += oap->start.col;
5408                         length -= oap->start.col;
5409                     }
5410                     if (pos.lnum == oap->end.lnum)
5411                     {
5412                         length = (int)STRLEN(ml_get(oap->end.lnum));
5413                         if (oap->end.col >= length)
5414                             oap->end.col = length - 1;
5415                         length = oap->end.col - pos.col + 1;
5416                     }
5417                 }
5418             }
5419             one_change = do_addsub(oap->op_type, &pos, length, amount);

oap->motion_type can have four types of values.
It's following value. (in src/vim.h : 1465)
    /*
    * Motion types, used for operators and for yank/delete registers.
    */
    #define MCHAR   0               /* character-wise movement/register */
    #define MLINE   1               /* line-wise movement/register */
    #define MBLOCK  2               /* block-wise register */

    #define MAUTO   0xff            /* Decide between MLINE/MCHAR */

When this function is called will have been set are three except the MAUTO.
If oap->motion_type is MBLOCK, oap->block_mode always become true.
Thus in this case, fall in 5387.
5392 at the time of entering the oap->motion_type will be MLINE or MCHAR.
So, When enter the 5401 only oap->motion_type is MCHAR.
Therefore "else if (oap->motion_type == MCHAR)" and "else" is same code in 5399.

how is it?

Thanks.
--
Best regards,
Hirohito Higashi (a.k.a h_east)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui