cocci: add a index-compatibility.pending.cocci
Add a coccinelle rule which covers the rest of the macros guarded by "USE_THE_INDEX_COMPATIBILITY_MACROS" cache.h. If the result of this were applied it can be reduced down to just: #ifdef USE_THE_INDEX_COMPATIBILITY_MACROS extern struct index_state the_index; #endif But that patch is just under 2000 lines, so let's first add this as a "pending", and then incrementally pick changes from it in subsequent commits. In doing that we'll migrate rules from this "index-compatibility.pending.cocci" to the "index-compatibility.cocci" created in a preceding commit. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Nov 19, 2022 at 14:07 UTC
0e6550a2c631e032c1c283398e50e9e654c171f0
1 file changed
+110
contrib/coccinelle/index-compatibility.pending.cocci
new
+110
@@ -0,0 +1,110 @@
1
+// the_index.* variables
2
+@@
3
+@@
4
+(
5
+- active_cache
6
++ the_index.cache
7
+|
8
+- active_nr
9
++ the_index.cache_nr
10
+|
11
+- active_cache_changed
12
++ the_index.cache_changed
13
+|
14
+- active_cache_tree
15
++ the_index.cache_tree
16
+)
17
+
18
+// "the_repository" simple cases
19
+@@
20
+@@
21
+(
22
+- read_cache
23
++ repo_read_index
24
+|
25
+- hold_locked_index
26
++ repo_hold_locked_index
27
+)
28
+ (
29
++ the_repository,
30
+ ...)
31
+
32
+// "the_index" simple cases
33
+@@
34
+@@
35
+(
36
+- discard_cache
37
++ discard_index
38
+|
39
+- cache_name_pos
40
++ index_name_pos
41
+|
42
+- add_cache_entry
43
++ add_index_entry
44
+|
45
+- remove_file_from_cache
46
++ remove_file_from_index
47
+|
48
+- ce_match_stat
49
++ ie_match_stat
50
+|
51
+- ce_modified
52
++ ie_modified
53
+|
54
+- resolve_undo_clear
55
++ resolve_undo_clear_index
56
+)
57
+ (
58
++ &the_index,
59
+ ...)
60
+
61
+// "the_repository" special-cases
62
+@@
63
+@@
64
+(
65
+- read_cache_preload
66
++ repo_read_index_preload
67
+)
68
+ (
69
++ the_repository,
70
+ ...
71
++ , 0
72
+ )
73
+
74
+@@
75
+@@
76
+(
77
+- refresh_and_write_cache
78
++ repo_refresh_and_write_index
79
+)
80
+ (
81
++ the_repository,
82
+ ...
83
++ , NULL, NULL, NULL
84
+ )
85
+
86
+
87
+// "the_index" special-cases
88
+@@
89
+@@
90
+(
91
+- read_cache_from
92
++ read_index_from
93
+)
94
+ (
95
++ &the_index,
96
+ ...
97
++ , get_git_dir()
98
+ )
99
+
100
+@@
101
+@@
102
+(
103
+- refresh_cache
104
++ refresh_index
105
+)
106
+ (
107
++ &the_index,
108
+ ...
109
++ , NULL, NULL, NULL
110
+ )