From 37dddac63c5ce29a85c74387c0f959b960e05c9d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Francesco=20Potort=C3=AC?= Date: Tue, 20 Nov 2007 16:17:40 +0000 Subject: [PATCH] Backporting bug corrections from trunk. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2007-11-15 Francesco Potort� * etags.c: (C_entries): In case '}' decrement bracelev before testing it. 2007-11-15 Masatake YAMATO * etags.c (C_entries): In case '}', set fvdef to fvnone unconditioned to (!ignoreindent && lp == newlb.buffer + 1). 2007-11-15 Francesco Potort� * 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. --- lib-src/etags.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/lib-src/etags.c b/lib-src/etags.c index 5da144c46b0..47db26a5dd7 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -61,10 +61,10 @@ University of California, as described above. */ /* * 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 @@ etags --help --lang=ada."); # define EMACS_NAME "standalone" #endif #ifndef VERSION -# define VERSION "version" +# define VERSION "17.26" #endif static void print_version () @@ -1468,6 +1468,7 @@ main (argc, argv) exit (EXIT_SUCCESS); } + /* From here on, we are in (CTAGS && !cxref_style) */ if (update) { char cmd[BUFSIZ]; @@ -2976,11 +2977,6 @@ consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var) 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 @@ C_entries (c_ext, inf) case '/': if (*lp == '*') { - lp++; incomm = TRUE; - continue; + lp++; + c = ' '; } else if (/* cplpl && */ *lp == '/') { c = '\0'; - break; } - else break; case '%': if ((c_ext & YACC) && *lp == '%') @@ -3950,7 +3944,7 @@ C_entries (c_ext, inf) make_C_tag (FALSE); /* a struct or enum */ break; } - bracelev++; + bracelev += 1; break; case '*': if (definedef != dnone) @@ -3964,17 +3958,21 @@ C_entries (c_ext, inf) 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. */ -- 2.39.2