changeset 79457:24f4925384aa

Backporting bug corrections from trunk. 2007-11-15 Francesco Potort?<pot@gnu.org> * etags.c: (C_entries): In case '}' decrement bracelev before testing it. 2007-11-15 Masatake YAMATO <jet@gyve.org> * etags.c (C_entries): In case '}', set fvdef to fvnone unconditioned to (!ignoreindent && lp == newlb.buffer + 1). 2007-11-15 Francesco Potort?<pot@gnu.org> * etags.c: (C_entries): Reset the fvdef machine when out of function. (C_entries): Parse start of C comment as a space == end of token. This is not necessary for C++ comment, already parsed as newline.
author Francesco Potortì <pot@gnu.org>
date Tue, 20 Nov 2007 16:17:40 +0000
parents 36075b913c8a
children 6659094e0d7d
files lib-src/etags.c
diffstat 1 files changed, 17 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/etags.c	Tue Nov 20 16:17:03 2007 +0000
+++ b/lib-src/etags.c	Tue Nov 20 16:17:40 2007 +0000
@@ -61,10 +61,10 @@
 
 /*
  * Authors:
- *	Ctags originally by Ken Arnold.
- *	Fortran added by Jim Kleckner.
- *	Ed Pelegri-Llopart added C typedefs.
- *	Gnu Emacs TAGS format and modifications by RMS?
+ * 1983	Ctags originally by Ken Arnold.
+ * 1984	Fortran added by Jim Kleckner.
+ * 1984	Ed Pelegri-Llopart added C typedefs.
+ * 1985	Emacs TAGS format by Richard Stallman.
  * 1989	Sam Kendall added C++.
  * 1992 Joseph B. Wells improved C and C++ parsing.
  * 1993	Francesco Potort́ reorganised C and C++.
@@ -876,7 +876,7 @@
 # define EMACS_NAME "standalone"
 #endif
 #ifndef VERSION
-# define VERSION "version"
+# define VERSION "17.26"
 #endif
 static void
 print_version ()
@@ -1468,6 +1468,7 @@
       exit (EXIT_SUCCESS);
     }
 
+  /* From here on, we are in (CTAGS && !cxref_style) */
   if (update)
     {
       char cmd[BUFSIZ];
@@ -2976,11 +2977,6 @@
        return TRUE;
      }
 
-   /*
-    * This structdef business is NOT invoked when we are ctags and the
-    * file is plain C.  This is because a struct tag may have the same
-    * name as another tag, and this loses with ctags.
-    */
    switch (toktype)
      {
      case st_C_javastruct:
@@ -3398,16 +3394,14 @@
 	case '/':
 	  if (*lp == '*')
 	    {
+	      incomm = TRUE;
 	      lp++;
-	      incomm = TRUE;
-	      continue;
+	      c = ' ';
 	    }
 	  else if (/* cplpl && */ *lp == '/')
 	    {
 	      c = '\0';
-	      break;
 	    }
-	  else
 	    break;
 	case '%':
 	  if ((c_ext & YACC) && *lp == '%')
@@ -3950,7 +3944,7 @@
 	      make_C_tag (FALSE);  /* a struct or enum */
 	      break;
 	    }
-	  bracelev++;
+	  bracelev += 1;
 	  break;
 	case '*':
 	  if (definedef != dnone)
@@ -3964,17 +3958,21 @@
 	case '}':
 	  if (definedef != dnone)
 	    break;
+	  bracelev -= 1;
 	  if (!ignoreindent && lp == newlb.buffer + 1)
 	    {
 	      if (bracelev != 0)
-		token.valid = FALSE;
+		token.valid = FALSE; /* unexpected value, token unreliable */
 	      bracelev = 0;	/* reset brace level if first column */
 	      parlev = 0;	/* also reset paren level, just in case... */
 	    }
-	  else if (bracelev > 0)
-	    bracelev--;
-	  else
+	  else if (bracelev < 0)
+	    {
 	    token.valid = FALSE; /* something gone amiss, token unreliable */
+	      bracelev = 0;
+	    }
+	  if (bracelev == 0 && fvdef == vignore)
+	    fvdef = fvnone;		/* end of function */
 	  popclass_above (bracelev);
 	  structdef = snone;
 	  /* Only if typdef == tinbody is typdefbracelev significant. */