diff options
| author | Eli Zaretskii | 2017-03-12 17:36:41 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2017-03-12 17:36:41 +0200 |
| commit | f08362594e2889cb6f7c9b260bda48f518575765 (patch) | |
| tree | 2f210ad3a0fe98eb7bcb32792d53c80af2491986 /lib-src | |
| parent | 649fe4246eb954f2960dc31d27c9a3e844fb9cb1 (diff) | |
| download | emacs-f08362594e2889cb6f7c9b260bda48f518575765.tar.gz emacs-f08362594e2889cb6f7c9b260bda48f518575765.zip | |
Teach etags to process ENUM_BF correctly
* lib-src/etags.c (sym_type): New enumeration value st_C_enum_bf.
(hash): Regenerated values for asso_values[] array.
(in_word_set): Update values of TOTAL_KEYWORDS and
MAX_HASH_VALUE. Add "ENUM_BF" to the wordlist[] array.
(in_enum_bf): New file-global variable.
(consider_token): Skip ENUM_BF if not in a macro definition.
(C_entries): Reset the in_enum_bf flag when past its closing
parenthesis.
* test/manual/etags/ETAGS.good_1:
* test/manual/etags/ETAGS.good_2:
* test/manual/etags/ETAGS.good_3:
* test/manual/etags/ETAGS.good_4:
* test/manual/etags/ETAGS.good_5:
* test/manual/etags/ETAGS.good_6:
* test/manual/etags/CTAGS.good: Adapt to changes in etags.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/etags.c | 93 |
1 files changed, 59 insertions, 34 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c index 39b90cc6cbf..015cbbe0ef3 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -2458,7 +2458,7 @@ enum sym_type | |||
| 2458 | st_none, | 2458 | st_none, |
| 2459 | st_C_objprot, st_C_objimpl, st_C_objend, | 2459 | st_C_objprot, st_C_objimpl, st_C_objend, |
| 2460 | st_C_gnumacro, | 2460 | st_C_gnumacro, |
| 2461 | st_C_ignore, st_C_attribute, | 2461 | st_C_ignore, st_C_attribute, st_C_enum_bf, |
| 2462 | st_C_javastruct, | 2462 | st_C_javastruct, |
| 2463 | st_C_operator, | 2463 | st_C_operator, |
| 2464 | st_C_class, st_C_template, | 2464 | st_C_class, st_C_template, |
| @@ -2507,6 +2507,7 @@ DEFUN, 0, st_C_gnumacro | |||
| 2507 | SYSCALL, 0, st_C_gnumacro | 2507 | SYSCALL, 0, st_C_gnumacro |
| 2508 | ENTRY, 0, st_C_gnumacro | 2508 | ENTRY, 0, st_C_gnumacro |
| 2509 | PSEUDO, 0, st_C_gnumacro | 2509 | PSEUDO, 0, st_C_gnumacro |
| 2510 | ENUM_BF, 0, st_C_enum_bf | ||
| 2510 | # These are defined inside C functions, so currently they are not met. | 2511 | # These are defined inside C functions, so currently they are not met. |
| 2511 | # EXFUN used in glibc, DEFVAR_* in emacs. | 2512 | # EXFUN used in glibc, DEFVAR_* in emacs. |
| 2512 | #EXFUN, 0, st_C_gnumacro | 2513 | #EXFUN, 0, st_C_gnumacro |
| @@ -2514,46 +2515,48 @@ PSEUDO, 0, st_C_gnumacro | |||
| 2514 | %] | 2515 | %] |
| 2515 | and replace lines between %< and %> with its output, then: | 2516 | and replace lines between %< and %> with its output, then: |
| 2516 | - remove the #if characterset check | 2517 | - remove the #if characterset check |
| 2517 | - make in_word_set static and not inline. */ | 2518 | - remove any #line directives |
| 2519 | - make in_word_set static and not inline | ||
| 2520 | - remove any 'register' qualifications from variable decls. */ | ||
| 2518 | /*%<*/ | 2521 | /*%<*/ |
| 2519 | /* C code produced by gperf version 3.0.1 */ | 2522 | /* C code produced by gperf version 3.0.1 */ |
| 2520 | /* Command-line: gperf -m 5 */ | 2523 | /* Command-line: gperf -m 5 */ |
| 2521 | /* Computed positions: -k'2-3' */ | 2524 | /* Computed positions: -k'2-3' */ |
| 2522 | 2525 | ||
| 2523 | struct C_stab_entry { const char *name; int c_ext; enum sym_type type; }; | 2526 | struct C_stab_entry { const char *name; int c_ext; enum sym_type type; }; |
| 2524 | /* maximum key range = 33, duplicates = 0 */ | 2527 | /* maximum key range = 34, duplicates = 0 */ |
| 2525 | 2528 | ||
| 2526 | static int | 2529 | static int |
| 2527 | hash (const char *str, int len) | 2530 | hash (const char *str, int len) |
| 2528 | { | 2531 | { |
| 2529 | static char const asso_values[] = | 2532 | static char const asso_values[] = |
| 2530 | { | 2533 | { |
| 2531 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2534 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2532 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2535 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2533 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2536 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2534 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2537 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2535 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2538 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2536 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2539 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2537 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 3, | 2540 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 3, |
| 2538 | 26, 35, 35, 35, 35, 35, 35, 35, 27, 35, | 2541 | 27, 36, 36, 36, 36, 36, 36, 36, 26, 36, |
| 2539 | 35, 35, 35, 24, 0, 35, 35, 35, 35, 0, | 2542 | 36, 36, 36, 25, 0, 0, 36, 36, 36, 0, |
| 2540 | 35, 35, 35, 35, 35, 1, 35, 16, 35, 6, | 2543 | 36, 36, 36, 36, 36, 1, 36, 16, 36, 6, |
| 2541 | 23, 0, 0, 35, 22, 0, 35, 35, 5, 0, | 2544 | 23, 0, 0, 36, 22, 0, 36, 36, 5, 0, |
| 2542 | 0, 15, 1, 35, 6, 35, 8, 19, 35, 16, | 2545 | 0, 15, 1, 36, 6, 36, 8, 19, 36, 16, |
| 2543 | 4, 5, 35, 35, 35, 35, 35, 35, 35, 35, | 2546 | 4, 5, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2544 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2547 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2545 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2548 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2546 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2549 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2547 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2550 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2548 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2551 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2549 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2552 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2550 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2553 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2551 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2554 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2552 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2555 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2553 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2556 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2554 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2557 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2555 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | 2558 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
| 2556 | 35, 35, 35, 35, 35, 35 | 2559 | 36, 36, 36, 36, 36, 36 |
| 2557 | }; | 2560 | }; |
| 2558 | int hval = len; | 2561 | int hval = len; |
| 2559 | 2562 | ||
| @@ -2574,11 +2577,11 @@ in_word_set (register const char *str, register unsigned int len) | |||
| 2574 | { | 2577 | { |
| 2575 | enum | 2578 | enum |
| 2576 | { | 2579 | { |
| 2577 | TOTAL_KEYWORDS = 33, | 2580 | TOTAL_KEYWORDS = 34, |
| 2578 | MIN_WORD_LENGTH = 2, | 2581 | MIN_WORD_LENGTH = 2, |
| 2579 | MAX_WORD_LENGTH = 15, | 2582 | MAX_WORD_LENGTH = 15, |
| 2580 | MIN_HASH_VALUE = 2, | 2583 | MIN_HASH_VALUE = 2, |
| 2581 | MAX_HASH_VALUE = 34 | 2584 | MAX_HASH_VALUE = 35 |
| 2582 | }; | 2585 | }; |
| 2583 | 2586 | ||
| 2584 | static struct C_stab_entry wordlist[] = | 2587 | static struct C_stab_entry wordlist[] = |
| @@ -2613,8 +2616,9 @@ in_word_set (register const char *str, register unsigned int len) | |||
| 2613 | {"undef", 0, st_C_define}, | 2616 | {"undef", 0, st_C_define}, |
| 2614 | {"package", (C_JAVA & ~C_PLPL), st_C_ignore}, | 2617 | {"package", (C_JAVA & ~C_PLPL), st_C_ignore}, |
| 2615 | {"__attribute__", 0, st_C_attribute}, | 2618 | {"__attribute__", 0, st_C_attribute}, |
| 2616 | {"SYSCALL", 0, st_C_gnumacro}, | ||
| 2617 | {"ENTRY", 0, st_C_gnumacro}, | 2619 | {"ENTRY", 0, st_C_gnumacro}, |
| 2620 | {"SYSCALL", 0, st_C_gnumacro}, | ||
| 2621 | {"ENUM_BF", 0, st_C_enum_bf}, | ||
| 2618 | {"PSEUDO", 0, st_C_gnumacro}, | 2622 | {"PSEUDO", 0, st_C_gnumacro}, |
| 2619 | {"DEFUN", 0, st_C_gnumacro} | 2623 | {"DEFUN", 0, st_C_gnumacro} |
| 2620 | }; | 2624 | }; |
| @@ -2651,6 +2655,11 @@ C_symtype (char *str, int len, int c_ext) | |||
| 2651 | */ | 2655 | */ |
| 2652 | static bool inattribute; /* looking at an __attribute__ construct */ | 2656 | static bool inattribute; /* looking at an __attribute__ construct */ |
| 2653 | 2657 | ||
| 2658 | /* Ignoring ENUM_BF (type) | ||
| 2659 | * | ||
| 2660 | */ | ||
| 2661 | static bool in_enum_bf; /* inside parentheses following ENUM_BF */ | ||
| 2662 | |||
| 2654 | /* | 2663 | /* |
| 2655 | * C functions and variables are recognized using a simple | 2664 | * C functions and variables are recognized using a simple |
| 2656 | * finite automaton. fvdef is its state variable. | 2665 | * finite automaton. fvdef is its state variable. |
| @@ -2891,6 +2900,15 @@ consider_token (char *str, int len, int c, int *c_extp, | |||
| 2891 | return false; | 2900 | return false; |
| 2892 | } | 2901 | } |
| 2893 | 2902 | ||
| 2903 | /* | ||
| 2904 | * Skip ENUM_BF | ||
| 2905 | */ | ||
| 2906 | if (toktype == st_C_enum_bf && definedef == dnone) | ||
| 2907 | { | ||
| 2908 | in_enum_bf = true; | ||
| 2909 | return false; | ||
| 2910 | } | ||
| 2911 | |||
| 2894 | /* | 2912 | /* |
| 2895 | * Advance the definedef state machine. | 2913 | * Advance the definedef state machine. |
| 2896 | */ | 2914 | */ |
| @@ -3496,7 +3514,8 @@ C_entries (int c_ext, FILE *inf) | |||
| 3496 | && templatelev == 0 | 3514 | && templatelev == 0 |
| 3497 | && (definedef != dnone | 3515 | && (definedef != dnone |
| 3498 | || structdef != scolonseen) | 3516 | || structdef != scolonseen) |
| 3499 | && !inattribute) | 3517 | && !inattribute |
| 3518 | && !in_enum_bf) | ||
| 3500 | { | 3519 | { |
| 3501 | if (midtoken) | 3520 | if (midtoken) |
| 3502 | { | 3521 | { |
| @@ -3959,6 +3978,12 @@ C_entries (int c_ext, FILE *inf) | |||
| 3959 | inattribute = false; | 3978 | inattribute = false; |
| 3960 | break; | 3979 | break; |
| 3961 | } | 3980 | } |
| 3981 | if (in_enum_bf) | ||
| 3982 | { | ||
| 3983 | if (--parlev == 0) | ||
| 3984 | in_enum_bf = false; | ||
| 3985 | break; | ||
| 3986 | } | ||
| 3962 | if (definedef != dnone) | 3987 | if (definedef != dnone) |
| 3963 | break; | 3988 | break; |
| 3964 | if (objdef == ocatseen && parlev == 1) | 3989 | if (objdef == ocatseen && parlev == 1) |