diff options
| author | Francesco Potortì | 2007-11-15 15:38:52 +0000 |
|---|---|---|
| committer | Francesco Potortì | 2007-11-15 15:38:52 +0000 |
| commit | 89d8309f696e08378f907bf73583c772eca4ddf6 (patch) | |
| tree | 4a767c1a5d872bb7e4c2e55362acbc65344de94c /lib-src | |
| parent | f91311d1a17693acf9a2027c8a4df57702c2a592 (diff) | |
| download | emacs-89d8309f696e08378f907bf73583c772eca4ddf6.tar.gz emacs-89d8309f696e08378f907bf73583c772eca4ddf6.zip | |
Make prototypes for extern definitions, and add all
that are needed to quench warnings on 64-bit.
(main): Use the same defaults for ctags as for etags: find
typedefs, structure tags, macro constants, enum constants, struct
members and global variables.
(make_C_tag) [DEBUG]: Add debugging printout.
(C_entries): In case '}' decrement bracelev before testing it.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/etags.c | 73 |
1 files changed, 35 insertions, 38 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c index 0edc281e587..280399868d1 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -81,7 +81,7 @@ University of California, as described above. */ | |||
| 81 | * configuration file containing regexp definitions for etags. | 81 | * configuration file containing regexp definitions for etags. |
| 82 | */ | 82 | */ |
| 83 | 83 | ||
| 84 | char pot_etags_version[] = "@(#) pot revision number is 17.34"; | 84 | char pot_etags_version[] = "@(#) pot revision number is 17.38"; |
| 85 | 85 | ||
| 86 | #define TRUE 1 | 86 | #define TRUE 1 |
| 87 | #define FALSE 0 | 87 | #define FALSE 0 |
| @@ -160,14 +160,20 @@ char pot_etags_version[] = "@(#) pot revision number is 17.34"; | |||
| 160 | # include <stdlib.h> | 160 | # include <stdlib.h> |
| 161 | # include <string.h> | 161 | # include <string.h> |
| 162 | # else /* no standard C headers */ | 162 | # else /* no standard C headers */ |
| 163 | extern char *getenv (); | 163 | extern char *getenv __P((const char *)); |
| 164 | extern char *strcpy (); | 164 | extern char *strcpy __P((char *, const char *)); |
| 165 | extern char *strncpy (); | 165 | extern char *strncpy __P((char *, const char *, unsigned long)); |
| 166 | extern char *strcat (); | 166 | extern char *strcat __P((char *, const char *)); |
| 167 | extern char *strncat (); | 167 | extern char *strncat __P((char *, const char *, unsigned long)); |
| 168 | extern unsigned long strlen (); | 168 | extern int strcmp __P((const char *, const char *)); |
| 169 | extern PTR malloc (); | 169 | extern int strncmp __P((const char *, const char *, unsigned long)); |
| 170 | extern PTR realloc (); | 170 | extern int system __P((const char *)); |
| 171 | extern unsigned long strlen __P((const char *)); | ||
| 172 | extern void *malloc __P((unsigned long)); | ||
| 173 | extern void *realloc __P((void *, unsigned long)); | ||
| 174 | extern void exit __P((int)); | ||
| 175 | extern void free __P((void *)); | ||
| 176 | extern void *memmove __P((void *, const void *, unsigned long)); | ||
| 171 | # ifdef VMS | 177 | # ifdef VMS |
| 172 | # define EXIT_SUCCESS 1 | 178 | # define EXIT_SUCCESS 1 |
| 173 | # define EXIT_FAILURE 0 | 179 | # define EXIT_FAILURE 0 |
| @@ -491,7 +497,7 @@ static char | |||
| 491 | *midtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$0123456789"; | 497 | *midtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$0123456789"; |
| 492 | 498 | ||
| 493 | static bool append_to_tagfile; /* -a: append to tags */ | 499 | static bool append_to_tagfile; /* -a: append to tags */ |
| 494 | /* The next five default to TRUE for etags, but to FALSE for ctags. */ | 500 | /* The next five default to TRUE in C and derived languages. */ |
| 495 | static bool typedefs; /* -t: create tags for C and Ada typedefs */ | 501 | static bool typedefs; /* -t: create tags for C and Ada typedefs */ |
| 496 | static bool typedefs_or_cplusplus; /* -T: create tags for C typedefs, level */ | 502 | static bool typedefs_or_cplusplus; /* -T: create tags for C typedefs, level */ |
| 497 | /* 0 struct/enum/union decls, and C++ */ | 503 | /* 0 struct/enum/union decls, and C++ */ |
| @@ -883,7 +889,7 @@ etags --help --lang=ada."); | |||
| 883 | # define EMACS_NAME "standalone" | 889 | # define EMACS_NAME "standalone" |
| 884 | #endif | 890 | #endif |
| 885 | #ifndef VERSION | 891 | #ifndef VERSION |
| 886 | # define VERSION "17.34" | 892 | # define VERSION "17.38" |
| 887 | #endif | 893 | #endif |
| 888 | static void | 894 | static void |
| 889 | print_version () | 895 | print_version () |
| @@ -1239,15 +1245,12 @@ main (argc, argv) | |||
| 1239 | argbuffer = xnew (argc, argument); | 1245 | argbuffer = xnew (argc, argument); |
| 1240 | 1246 | ||
| 1241 | /* | 1247 | /* |
| 1242 | * If etags, always find typedefs and structure tags. Why not? | 1248 | * Always find typedefs and structure tags. |
| 1243 | * Also default to find macro constants, enum constants, struct | 1249 | * Also default to find macro constants, enum constants, struct |
| 1244 | * members and global variables. | 1250 | * members and global variables. Do it for both etags and ctags. |
| 1245 | */ | 1251 | */ |
| 1246 | if (!CTAGS) | 1252 | typedefs = typedefs_or_cplusplus = constantypedefs = TRUE; |
| 1247 | { | 1253 | globals = members = TRUE; |
| 1248 | typedefs = typedefs_or_cplusplus = constantypedefs = TRUE; | ||
| 1249 | globals = members = TRUE; | ||
| 1250 | } | ||
| 1251 | 1254 | ||
| 1252 | /* When the optstring begins with a '-' getopt_long does not rearrange the | 1255 | /* When the optstring begins with a '-' getopt_long does not rearrange the |
| 1253 | non-options arguments to be at the end, but leaves them alone. */ | 1256 | non-options arguments to be at the end, but leaves them alone. */ |
| @@ -1498,6 +1501,7 @@ main (argc, argv) | |||
| 1498 | exit (EXIT_SUCCESS); | 1501 | exit (EXIT_SUCCESS); |
| 1499 | } | 1502 | } |
| 1500 | 1503 | ||
| 1504 | /* From here on, we are in (CTAGS && !cxref_style) */ | ||
| 1501 | if (update) | 1505 | if (update) |
| 1502 | { | 1506 | { |
| 1503 | char cmd[BUFSIZ]; | 1507 | char cmd[BUFSIZ]; |
| @@ -3006,11 +3010,6 @@ consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var) | |||
| 3006 | return TRUE; | 3010 | return TRUE; |
| 3007 | } | 3011 | } |
| 3008 | 3012 | ||
| 3009 | /* | ||
| 3010 | * This structdef business is NOT invoked when we are ctags and the | ||
| 3011 | * file is plain C. This is because a struct tag may have the same | ||
| 3012 | * name as another tag, and this loses with ctags. | ||
| 3013 | */ | ||
| 3014 | switch (toktype) | 3013 | switch (toktype) |
| 3015 | { | 3014 | { |
| 3016 | case st_C_javastruct: | 3015 | case st_C_javastruct: |
| @@ -3246,16 +3245,16 @@ make_C_tag (isfun) | |||
| 3246 | { | 3245 | { |
| 3247 | /* This function is never called when token.valid is FALSE, but | 3246 | /* This function is never called when token.valid is FALSE, but |
| 3248 | we must protect against invalid input or internal errors. */ | 3247 | we must protect against invalid input or internal errors. */ |
| 3249 | if (!DEBUG && !token.valid) | ||
| 3250 | return; | ||
| 3251 | |||
| 3252 | if (token.valid) | 3248 | if (token.valid) |
| 3253 | make_tag (token_name.buffer, token_name.len, isfun, token.line, | 3249 | make_tag (token_name.buffer, token_name.len, isfun, token.line, |
| 3254 | token.offset+token.length+1, token.lineno, token.linepos); | 3250 | token.offset+token.length+1, token.lineno, token.linepos); |
| 3255 | else /* this case is optimised away if !DEBUG */ | 3251 | else if (DEBUG) |
| 3256 | make_tag (concat ("INVALID TOKEN:-->", token_name.buffer, ""), | 3252 | { /* this branch is optimised away if !DEBUG */ |
| 3257 | token_name.len + 17, isfun, token.line, | 3253 | make_tag (concat ("INVALID TOKEN:-->", token_name.buffer, ""), |
| 3258 | token.offset+token.length+1, token.lineno, token.linepos); | 3254 | token_name.len + 17, isfun, token.line, |
| 3255 | token.offset+token.length+1, token.lineno, token.linepos); | ||
| 3256 | error ("INVALID TOKEN", NULL); | ||
| 3257 | } | ||
| 3259 | 3258 | ||
| 3260 | token.valid = FALSE; | 3259 | token.valid = FALSE; |
| 3261 | } | 3260 | } |
| @@ -3978,7 +3977,7 @@ C_entries (c_ext, inf) | |||
| 3978 | make_C_tag (FALSE); /* a struct or enum */ | 3977 | make_C_tag (FALSE); /* a struct or enum */ |
| 3979 | break; | 3978 | break; |
| 3980 | } | 3979 | } |
| 3981 | bracelev++; | 3980 | bracelev += 1; |
| 3982 | break; | 3981 | break; |
| 3983 | case '*': | 3982 | case '*': |
| 3984 | if (definedef != dnone) | 3983 | if (definedef != dnone) |
| @@ -3992,20 +3991,18 @@ C_entries (c_ext, inf) | |||
| 3992 | case '}': | 3991 | case '}': |
| 3993 | if (definedef != dnone) | 3992 | if (definedef != dnone) |
| 3994 | break; | 3993 | break; |
| 3994 | bracelev -= 1; | ||
| 3995 | if (!ignoreindent && lp == newlb.buffer + 1) | 3995 | if (!ignoreindent && lp == newlb.buffer + 1) |
| 3996 | { | 3996 | { |
| 3997 | if (bracelev != 0) | 3997 | if (bracelev != 0) |
| 3998 | token.valid = FALSE; | 3998 | token.valid = FALSE; /* unexpected value, token unreliable */ |
| 3999 | bracelev = 0; /* reset brace level if first column */ | 3999 | bracelev = 0; /* reset brace level if first column */ |
| 4000 | parlev = 0; /* also reset paren level, just in case... */ | 4000 | parlev = 0; /* also reset paren level, just in case... */ |
| 4001 | } | 4001 | } |
| 4002 | else | 4002 | else if (bracelev < 0) |
| 4003 | { | 4003 | { |
| 4004 | if (--bracelev < 0) | 4004 | token.valid = FALSE; /* something gone amiss, token unreliable */ |
| 4005 | { | 4005 | bracelev = 0; |
| 4006 | bracelev = 0; | ||
| 4007 | token.valid = FALSE; /* something gone amiss, token unreliable */ | ||
| 4008 | } | ||
| 4009 | } | 4006 | } |
| 4010 | if (bracelev == 0 && fvdef == vignore) | 4007 | if (bracelev == 0 && fvdef == vignore) |
| 4011 | fvdef = fvnone; /* end of function */ | 4008 | fvdef = fvnone; /* end of function */ |