cin_ispreproc(s)
char_u *s;
{
- s = skipwhite(s);
- if (*s == '#')
+ if (*skipwhite(s) == '#')
return TRUE;
return FALSE;
}
else
s = *sp;
+ /* Ignore line starting with #. */
+ if (cin_ispreproc(s))
+ return FALSE;
+
while (*s && *s != '(' && *s != ';' && *s != '\'' && *s != '"')
{
if (cin_iscomment(s)) /* ignore comments */
retval = TRUE;
goto done;
}
- if (*s == ',' && cin_nocode(s + 1))
+ if ((*s == ',' && cin_nocode(s + 1)) || s[1] == NUL || cin_nocode(s))
{
- /* ',' at the end: continue looking in the next line */
+ int comma = (*s == ',');
+
+ /* ',' at the end: continue looking in the next line.
+ * At the end: check for ',' in the next line, for this style:
+ * func(arg1
+ * , arg2) */
+ for (;;)
+ {
+ if (lnum >= curbuf->b_ml.ml_line_count)
+ break;
+ s = ml_get(++lnum);
+ if (!cin_ispreproc(s))
+ break;
+ }
if (lnum >= curbuf->b_ml.ml_line_count)
break;
-
- s = ml_get(++lnum);
+ /* Require a comma at end of the line or a comma or ')' at the
+ * start of next line. */
+ s = skipwhite(s);
+ if (!comma && *s != ',' && *s != ')')
+ break;
}
else if (cin_iscomment(s)) /* ignore comments */
s = cin_skipcomment(s);
foo;
}
+STARTTEST
+:set cino=(0,ts
+2kdd=][
+ENDTEST
+
+void func(int a
+#if defined(FOO)
+ , int b
+ , int c
+#endif
+ )
+{
+}
+
+STARTTEST
+:set cino=(0
+2kdd=][
+ENDTEST
+
+void
+func(int a
+#if defined(FOO)
+ , int b
+ , int c
+#endif
+ )
+{
+}
+
STARTTEST
:g/^STARTTEST/.,/^ENDTEST/d
:1;/start of AUTO/,$wq! test.out