aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog6
-rw-r--r--lib-src/etags.c182
2 files changed, 103 insertions, 85 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index d68569a8f6d..e0d54f1490d 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,9 @@
12001-02-23 Francesco Potorti` <pot@gnu.org>
2
3 * etags.c (enum sym_type): New label st_C_template.
4 (gperf input): Use it for switching to C++ from C.
5 (consider_token): Do it.
6
12001-02-22 Andrew Innes <andrewi@gnu.org> 72001-02-22 Andrew Innes <andrewi@gnu.org>
2 8
3 * makefile.nt ($(BLD)\movemail.obj): Remove reference to 9 * makefile.nt ($(BLD)\movemail.obj): Remove reference to
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 7ae810d96fc..69810b50193 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -32,7 +32,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
32 * Francesco Potort́ <pot@gnu.org> has maintained it since 1993. 32 * Francesco Potort́ <pot@gnu.org> has maintained it since 1993.
33 */ 33 */
34 34
35char pot_etags_version[] = "@(#) pot revision number is 14.15"; 35char pot_etags_version[] = "@(#) pot revision number is 14.18";
36 36
37#define TRUE 1 37#define TRUE 1
38#define FALSE 0 38#define FALSE 0
@@ -58,7 +58,11 @@ char pot_etags_version[] = "@(#) pot revision number is 14.15";
58# undef static 58# undef static
59# define ETAGS_REGEXPS /* use the regexp features */ 59# define ETAGS_REGEXPS /* use the regexp features */
60# define LONG_OPTIONS /* accept long options */ 60# define LONG_OPTIONS /* accept long options */
61#endif /* HAVE_CONFIG_H */ 61#else
62# ifndef __STDC__
63# define static /* remove static for old compilers' sake */
64# endif
65#endif /* !HAVE_CONFIG_H */
62 66
63#ifndef _GNU_SOURCE 67#ifndef _GNU_SOURCE
64# define _GNU_SOURCE 1 /* enables some compiler checks on GNU */ 68# define _GNU_SOURCE 1 /* enables some compiler checks on GNU */
@@ -1943,7 +1947,7 @@ enum sym_type
1943 st_C_ignore, 1947 st_C_ignore,
1944 st_C_javastruct, 1948 st_C_javastruct,
1945 st_C_operator, 1949 st_C_operator,
1946 st_C_class, 1950 st_C_class, st_C_template,
1947 st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef, st_C_typespec 1951 st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef, st_C_typespec
1948}; 1952};
1949 1953
@@ -1953,7 +1957,6 @@ static enum sym_type C_symtype P_((char *, int, int));
1953 1957
1954/* Feed stuff between (but not including) %[ and %] lines to: 1958/* Feed stuff between (but not including) %[ and %] lines to:
1955 gperf -c -k 1,3 -o -p -r -t 1959 gperf -c -k 1,3 -o -p -r -t
1956 then put a `static' keyword in front of the in_word_set function.
1957%[ 1960%[
1958struct C_stab_entry { char *name; int c_ext; enum sym_type type; } 1961struct C_stab_entry { char *name; int c_ext; enum sym_type type; }
1959%% 1962%%
@@ -1982,6 +1985,7 @@ enum, 0, st_C_enum
1982typedef, 0, st_C_typedef 1985typedef, 0, st_C_typedef
1983define, 0, st_C_define 1986define, 0, st_C_define
1984operator, C_PLPL, st_C_operator 1987operator, C_PLPL, st_C_operator
1988template, 0, st_C_template
1985bool, C_PLPL, st_C_typespec 1989bool, C_PLPL, st_C_typespec
1986long, 0, st_C_typespec 1990long, 0, st_C_typespec
1987short, 0, st_C_typespec 1991short, 0, st_C_typespec
@@ -2016,12 +2020,12 @@ then make in_word_set static. */
2016/* Command-line: gperf -c -k 1,3 -o -p -r -t */ 2020/* Command-line: gperf -c -k 1,3 -o -p -r -t */
2017struct C_stab_entry { char *name; int c_ext; enum sym_type type; }; 2021struct C_stab_entry { char *name; int c_ext; enum sym_type type; };
2018 2022
2019#define TOTAL_KEYWORDS 46 2023#define TOTAL_KEYWORDS 47
2020#define MIN_WORD_LENGTH 2 2024#define MIN_WORD_LENGTH 2
2021#define MAX_WORD_LENGTH 15 2025#define MAX_WORD_LENGTH 15
2022#define MIN_HASH_VALUE 13 2026#define MIN_HASH_VALUE 18
2023#define MAX_HASH_VALUE 121 2027#define MAX_HASH_VALUE 138
2024/* maximum key range = 109, duplicates = 0 */ 2028/* maximum key range = 121, duplicates = 0 */
2025 2029
2026#ifdef __GNUC__ 2030#ifdef __GNUC__
2027__inline 2031__inline
@@ -2033,32 +2037,32 @@ hash (str, len)
2033{ 2037{
2034 static unsigned char asso_values[] = 2038 static unsigned char asso_values[] =
2035 { 2039 {
2036 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2040 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2037 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2041 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2038 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2042 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2039 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2043 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2040 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2044 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2041 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2045 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2042 122, 122, 122, 122, 57, 122, 122, 122, 55, 6, 2046 139, 139, 139, 139, 63, 139, 139, 139, 33, 44,
2043 60, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2047 62, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2044 51, 122, 122, 10, 2, 122, 122, 122, 122, 122, 2048 42, 139, 139, 12, 32, 139, 139, 139, 139, 139,
2045 122, 122, 122, 122, 122, 122, 122, 2, 52, 59, 2049 139, 139, 139, 139, 139, 139, 139, 34, 59, 37,
2046 49, 38, 56, 41, 122, 22, 122, 122, 9, 32, 2050 24, 58, 33, 3, 139, 16, 139, 139, 42, 60,
2047 33, 60, 26, 122, 1, 28, 46, 59, 44, 51, 2051 18, 11, 39, 139, 23, 57, 4, 63, 6, 20,
2048 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2052 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2049 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2053 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2050 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2054 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2051 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2055 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2052 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2056 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2053 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2057 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2054 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2058 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2055 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2059 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2056 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2060 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2057 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2061 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2058 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2062 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2059 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2063 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2060 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 2064 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
2061 122, 122, 122, 122, 122, 122 2065 139, 139, 139, 139, 139, 139
2062 }; 2066 };
2063 register int hval = len; 2067 register int hval = len;
2064 2068
@@ -2086,77 +2090,79 @@ in_word_set (str, len)
2086 static struct C_stab_entry wordlist[] = 2090 static struct C_stab_entry wordlist[] =
2087 { 2091 {
2088 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, 2092 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
2089 {""}, {""}, {""}, {""},
2090 {"ENTRY", 0, st_C_gnumacro},
2091 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, 2093 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
2092 {""},
2093 {"if", 0, st_C_ignore}, 2094 {"if", 0, st_C_ignore},
2095 {""}, {""}, {""}, {""},
2096 {"int", 0, st_C_typespec},
2094 {""}, {""}, 2097 {""}, {""},
2098 {"void", 0, st_C_typespec},
2099 {""}, {""},
2100 {"interface", C_JAVA, st_C_struct},
2101 {""},
2095 {"SYSCALL", 0, st_C_gnumacro}, 2102 {"SYSCALL", 0, st_C_gnumacro},
2103 {""},
2104 {"return", 0, st_C_ignore},
2096 {""}, {""}, {""}, {""}, {""}, {""}, {""}, 2105 {""}, {""}, {""}, {""}, {""}, {""}, {""},
2097 {"struct", 0, st_C_struct}, 2106 {"while", 0, st_C_ignore},
2098 {"static", 0, st_C_typespec},
2099 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
2100 {"long", 0, st_C_typespec},
2101 {""}, {""}, {""}, {""}, {""},
2102 {"auto", 0, st_C_typespec}, 2107 {"auto", 0, st_C_typespec},
2103 {"return", 0, st_C_ignore}, 2108 {""}, {""}, {""}, {""}, {""}, {""},
2109 {"float", 0, st_C_typespec},
2110 {"typedef", 0, st_C_typedef},
2111 {"typename", C_PLPL, st_C_typespec},
2112 {""}, {""}, {""},
2113 {"friend", C_PLPL, st_C_ignore},
2114 {"volatile", 0, st_C_typespec},
2115 {""}, {""},
2116 {"for", 0, st_C_ignore},
2117 {"const", 0, st_C_typespec},
2104 {"import", C_JAVA, st_C_ignore}, 2118 {"import", C_JAVA, st_C_ignore},
2105 {""}, 2119 {""},
2106 {"switch", 0, st_C_ignore}, 2120 {"define", 0, st_C_define},
2107 {""}, 2121 {"long", 0, st_C_typespec},
2108 {"implements", C_JAVA, st_C_javastruct}, 2122 {"implements", C_JAVA, st_C_javastruct},
2123 {"signed", 0, st_C_typespec},
2109 {""}, 2124 {""},
2110 {"for", 0, st_C_ignore}, 2125 {"extern", 0, st_C_extern},
2111 {"volatile", 0, st_C_typespec}, 2126 {"extends", C_JAVA, st_C_javastruct},
2112 {""},
2113 {"PSEUDO", 0, st_C_gnumacro},
2114 {""}, 2127 {""},
2128 {"mutable", C_PLPL, st_C_typespec},
2129 {"template", 0, st_C_template},
2130 {"short", 0, st_C_typespec},
2131 {"bool", C_PLPL, st_C_typespec},
2115 {"char", 0, st_C_typespec}, 2132 {"char", 0, st_C_typespec},
2116 {"class", 0, st_C_class}, 2133 {"class", 0, st_C_class},
2117 {"@protocol", 0, st_C_objprot}, 2134 {"operator", C_PLPL, st_C_operator},
2118 {""}, {""},
2119 {"void", 0, st_C_typespec},
2120 {"int", 0, st_C_typespec},
2121 {"explicit", C_PLPL, st_C_typespec},
2122 {""}, 2135 {""},
2123 {"namespace", C_PLPL, st_C_struct}, 2136 {"switch", 0, st_C_ignore},
2124 {"signed", 0, st_C_typespec}, 2137 {""},
2138 {"ENTRY", 0, st_C_gnumacro},
2125 {""}, 2139 {""},
2126 {"interface", C_JAVA, st_C_struct},
2127 {"while", 0, st_C_ignore},
2128 {"typedef", 0, st_C_typedef},
2129 {"typename", C_PLPL, st_C_typespec},
2130 {""}, {""}, {""},
2131 {"friend", C_PLPL, st_C_ignore},
2132 {"mutable", C_PLPL, st_C_typespec},
2133 {"union", 0, st_C_struct},
2134 {"domain", C_STAR, st_C_struct},
2135 {""}, {""},
2136 {"extern", 0, st_C_extern},
2137 {"extends", C_JAVA, st_C_javastruct},
2138 {"package", C_JAVA, st_C_ignore}, 2140 {"package", C_JAVA, st_C_ignore},
2139 {"short", 0, st_C_typespec}, 2141 {"union", 0, st_C_struct},
2140 {"@end", 0, st_C_objend}, 2142 {"@end", 0, st_C_objend},
2141 {"unsigned", 0, st_C_typespec}, 2143 {"struct", 0, st_C_struct},
2142 {""}, 2144 {"namespace", C_PLPL, st_C_struct},
2143 {"const", 0, st_C_typespec},
2144 {""}, {""}, 2145 {""}, {""},
2146 {"domain", C_STAR, st_C_struct},
2145 {"@interface", 0, st_C_objprot}, 2147 {"@interface", 0, st_C_objprot},
2146 {"enum", 0, st_C_enum}, 2148 {"PSEUDO", 0, st_C_gnumacro},
2147 {""}, {""},
2148 {"@implementation",0, st_C_objimpl},
2149 {""},
2150 {"operator", C_PLPL, st_C_operator},
2151 {""}, {""}, {""}, {""},
2152 {"define", 0, st_C_define},
2153 {""}, {""},
2154 {"double", 0, st_C_typespec}, 2149 {"double", 0, st_C_typespec},
2155 {""}, 2150 {""},
2156 {"bool", C_PLPL, st_C_typespec}, 2151 {"@protocol", 0, st_C_objprot},
2157 {""}, {""}, {""}, 2152 {""},
2153 {"static", 0, st_C_typespec},
2154 {""}, {""},
2158 {"DEFUN", 0, st_C_gnumacro}, 2155 {"DEFUN", 0, st_C_gnumacro},
2159 {"float", 0, st_C_typespec} 2156 {""}, {""}, {""}, {""},
2157 {"explicit", C_PLPL, st_C_typespec},
2158 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
2159 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
2160 {""},
2161 {"enum", 0, st_C_enum},
2162 {""}, {""},
2163 {"unsigned", 0, st_C_typespec},
2164 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
2165 {"@implementation",0, st_C_objimpl}
2160 }; 2166 };
2161 2167
2162 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) 2168 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
@@ -2523,12 +2529,15 @@ consider_token (str, len, c, c_extp, cblev, parlev, is_func_or_var)
2523 if (structdef == stagseen) 2529 if (structdef == stagseen)
2524 structdef = scolonseen; 2530 structdef = scolonseen;
2525 return FALSE; 2531 return FALSE;
2532 case st_C_template:
2526 case st_C_class: 2533 case st_C_class:
2527 if (cblev == 0 2534 if (cblev == 0
2528 && (*c_extp & C_AUTO) /* automatic detection of C++ language */ 2535 && (*c_extp & C_AUTO) /* automatic detection of C++ language */
2529 && definedef == dnone && structdef == snone 2536 && definedef == dnone && structdef == snone
2530 && typdef == tnone && fvdef == fvnone) 2537 && typdef == tnone && fvdef == fvnone)
2531 *c_extp = (*c_extp | C_PLPL) & ~C_AUTO; 2538 *c_extp = (*c_extp | C_PLPL) & ~C_AUTO;
2539 if (toktype == st_C_template)
2540 break;
2532 /* FALLTHRU */ 2541 /* FALLTHRU */
2533 case st_C_struct: 2542 case st_C_struct:
2534 case st_C_enum: 2543 case st_C_enum:
@@ -2792,7 +2801,7 @@ C_entries (c_ext, inf)
2792 cstack.cblev = xnew (cstack.size, int); 2801 cstack.cblev = xnew (cstack.size, int);
2793 } 2802 }
2794 2803
2795 tokoff = toklen = 0; /* keep compiler quiet */ 2804 tokoff = toklen = typdefcblev = 0; /* keep compiler quiet */
2796 curndx = newndx = 0; 2805 curndx = newndx = 0;
2797 lineno = 0; 2806 lineno = 0;
2798 charno = 0; 2807 charno = 0;
@@ -3370,8 +3379,10 @@ C_entries (c_ext, inf)
3370 break; 3379 break;
3371 if (typdef == ttypeseen) 3380 if (typdef == ttypeseen)
3372 { 3381 {
3373 typdefcblev = cblev; 3382 /* Whenever typdef is set to tinbody (currently only
3383 here), typdefcblev should be set to cblev. */
3374 typdef = tinbody; 3384 typdef = tinbody;
3385 typdefcblev = cblev;
3375 } 3386 }
3376 switch (fvdef) 3387 switch (fvdef)
3377 { 3388 {
@@ -3433,6 +3444,7 @@ C_entries (c_ext, inf)
3433 cblev--; 3444 cblev--;
3434 popclass_above (cblev); 3445 popclass_above (cblev);
3435 structdef = snone; 3446 structdef = snone;
3447 /* Only if typdef == tinbody is typdefcblev significant. */
3436 if (typdef == tinbody && cblev <= typdefcblev) 3448 if (typdef == tinbody && cblev <= typdefcblev)
3437 { 3449 {
3438 assert (cblev == typdefcblev); 3450 assert (cblev == typdefcblev);