Re: Patch 8.0.1569

2018-03-06 Fir de Conversatie Bram Moolenaar

Kazunobu Kuriyama wrote:

> 2018-03-05 20:43 GMT+09:00 Bram Moolenaar :
> 
> >
> > Patch 8.0.1569
> > Problem:Warning for uninitialized variable from gcc.
> > Solution:   Initialize the variable.
> > Files:  src/quickfix.c
> >
> >
> > *** ../vim-8.0.1568/src/quickfix.c  2018-03-04 18:07:04.276592296
> > +0100
> > --- src/quickfix.c  2018-03-05 12:41:09.402675093 +0100
> > ***
> > *** 4099,4105 
> >   win_T *wp = NULL;
> >   qf_info_T *qi = _info;
> >   char_u*au_name = NULL;
> > ! int   save_qfid;
> >   int   res;
> >
> >   switch (eap->cmdidx)
> > --- 4099,4105 
> >   win_T *wp = NULL;
> >   qf_info_T *qi = _info;
> >   char_u*au_name = NULL;
> > ! int   save_qfid = 0;  // init for gcc
> >   int   res;
> >
> >   switch (eap->cmdidx)
> > *** ../vim-8.0.1568/src/version.c   2018-03-05 10:54:49.416071960 +0100
> > --- src/version.c   2018-03-05 12:41:53.838414951 +0100
> > ***
> > *** 768,769 
> > --- 768,771 
> >   {   /* Add new patch number below this line */
> > + /**/
> > + 1569,
> >   /**/
> >
> 
> According to :h style-compiler, // comments are not permitted in favor of
> C89.

My mistake, thanks for noticing.

> In conjunction with that, os_macosx.m doesn't conform to C89, either.
> Although it could be possible to make it meet C89, there've been good
> reasons not to do so (Just like C++, it preferable for Objective-C to defer
> variable/object declarations until they are actually used and initialize
> variables/objects thoroughly when they are declared).  Personally, I think
> it's better to keep it as-is and rather permit it not to conform to C89.
> For that, suppressing compiler warnings issued when the file is compiled
> with -ansi, -std=c89, -std=c90 or __STRICT_ANSI__,  is a good way to make
> the intention clear.
> 
> The attached patch addresses those two different, yet closely related,
> issues.

I'll include this too, thanks.

-- 
FIRST VILLAGER: We have found a witch.  May we burn her?
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 8.0.1569

2018-03-06 Fir de Conversatie Kazunobu Kuriyama
2018-03-05 20:43 GMT+09:00 Bram Moolenaar :

>
> Patch 8.0.1569
> Problem:Warning for uninitialized variable from gcc.
> Solution:   Initialize the variable.
> Files:  src/quickfix.c
>
>
> *** ../vim-8.0.1568/src/quickfix.c  2018-03-04 18:07:04.276592296
> +0100
> --- src/quickfix.c  2018-03-05 12:41:09.402675093 +0100
> ***
> *** 4099,4105 
>   win_T *wp = NULL;
>   qf_info_T *qi = _info;
>   char_u*au_name = NULL;
> ! int   save_qfid;
>   int   res;
>
>   switch (eap->cmdidx)
> --- 4099,4105 
>   win_T *wp = NULL;
>   qf_info_T *qi = _info;
>   char_u*au_name = NULL;
> ! int   save_qfid = 0;  // init for gcc
>   int   res;
>
>   switch (eap->cmdidx)
> *** ../vim-8.0.1568/src/version.c   2018-03-05 10:54:49.416071960 +0100
> --- src/version.c   2018-03-05 12:41:53.838414951 +0100
> ***
> *** 768,769 
> --- 768,771 
>   {   /* Add new patch number below this line */
> + /**/
> + 1569,
>   /**/
>

According to :h style-compiler, // comments are not permitted in favor of
C89.

In conjunction with that, os_macosx.m doesn't conform to C89, either.
Although it could be possible to make it meet C89, there've been good
reasons not to do so (Just like C++, it preferable for Objective-C to defer
variable/object declarations until they are actually used and initialize
variables/objects thoroughly when they are declared).  Personally, I think
it's better to keep it as-is and rather permit it not to conform to C89.
For that, suppressing compiler warnings issued when the file is compiled
with -ansi, -std=c89, -std=c90 or __STRICT_ANSI__,  is a good way to make
the intention clear.

The attached patch addresses those two different, yet closely related,
issues.

Best regards,
Kazunobu Kuriyama


> --
> Why I like vim:
> > I like VIM because, when I ask a question in this newsgroup, I get a
> > one-line answer.  With xemacs, I get a 1Kb lisp script with bugs in it
> ;-)
>
>  /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net
>  \\\
> ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/
> \\\
> \\\  an exciting new programming language -- http://www.Zimbu.org
> ///
>  \\\help me help AIDS victims -- http://ICCF-Holland.org
> ///
>
> --
> --
> 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 vim_dev+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


c89-compliance.diff
Description: Binary data