Hi

I see the following compilation warning when compiling
Vim-7.3a (2245:1bac28a53fae):

syntax.c:4506: warning: suggest braces around empty body in an ‘else’ statement

It happens when FEAT_MBYTE is defined & FEAT_CONCEAL is undefined
which is the case when configuring Vim with:

  ./configure -with-features=normal --enable-gui=gtk2

Code in syntax.c is

  4492 #ifdef FEAT_MBYTE
  4493             /* cchar=? */
  4494             if (has_mbyte)
  4495             {
  4496 # ifdef FEAT_CONCEAL
  4497                 *conceal_char = mb_ptr2char(arg + 6);
  4498 # endif
  4499                 arg += mb_ptr2len(arg + 6) - 1;
  4500             }
  4501             else
  4502 #endif
  4503 #ifdef FEAT_CONCEAL
  4504                 *conceal_char = arg[6];
  4505 #else
!!4506                 ;
  4507 #endif

Depending on whether FEAT_MBYTE and/or FEAT_CONCEAL
are defined/undefined, code becomes:

FEAT_MBYTE no -- FEAT_CONCEAL no  --> OK
================================
                ;

FEAT_MBYTE yes -- FEAT_CONCEAL no  --> Compilation warning!
=================================
            /* cchar=? */
            if (has_mbyte)
            {
                arg += mb_ptr2len(arg + 6) - 1;
            }
            else
                ;

FEAT_MBYTE no -- FEAT_CONCEAL yes --> OK
=================================
                *conceal_char = arg[6];

FEAT_MBYTE yes -- FEAT_CONCEAL yes --> OK
==================================
            /* cchar=? */
            if (has_mbyte)
            {
                *conceal_char = mb_ptr2char(arg + 6);
                arg += mb_ptr2len(arg + 6) - 1;
            }
            else
                *conceal_char = arg[6];


Attached patch fixes it.

-- Dominique

-- 
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
diff -r 1bac28a53fae src/syntax.c
--- a/src/syntax.c	Sat Jun 05 23:22:07 2010 +0200
+++ b/src/syntax.c	Sun Jun 06 09:53:31 2010 +0200
@@ -235,7 +235,7 @@
 
 /*
  * Another Annoying Hack(TM):  To prevent rules from other ":syn include"'d
- * files from from leaking into ALLBUT lists, we assign a unique ID to the
+ * files from leaking into ALLBUT lists, we assign a unique ID to the
  * rules in each ":syn include"'d file.
  */
 static int current_syn_inc_tag = 0;
@@ -4498,12 +4498,12 @@
 # endif
 		arg += mb_ptr2len(arg + 6) - 1;
 	    }
-	    else
-#endif
-#ifdef FEAT_CONCEAL
+#endif
+#ifdef FEAT_CONCEAL
+#  ifdef FEAT_MBYTE
+	    else
+#  endif
 		*conceal_char = arg[6];
-#else
-		;
 #endif
 	    arg = skipwhite(arg + 7);
 	}

Raspunde prin e-mail lui