]>
Commit | Line | Data |
---|---|---|
32a655c1 SL |
1 | // This test case tests the incremental compilation hash (ICH) implementation |
2 | // for `extern` modules. | |
3 | ||
4 | // The general pattern followed here is: Change one thing between rev1 and rev2 | |
5 | // and make sure that the hash has changed, then change nothing between rev2 and | |
6 | // rev3 and make sure that the hash has not changed. | |
7 | ||
416331ca | 8 | // build-pass (FIXME(62277): could be check-pass?) |
32a655c1 | 9 | // revisions: cfail1 cfail2 cfail3 |
ff7c6d11 | 10 | // compile-flags: -Z query-dep-graph -Zincremental-ignore-spans |
32a655c1 SL |
11 | |
12 | #![allow(warnings)] | |
13 | #![feature(rustc_attrs)] | |
14 | #![feature(unboxed_closures)] | |
15 | #![feature(link_args)] | |
fc512014 | 16 | #![crate_type = "rlib"] |
32a655c1 SL |
17 | |
18 | // Change function name -------------------------------------------------------- | |
19 | #[cfg(cfail1)] | |
fc512014 | 20 | extern "C" { |
32a655c1 SL |
21 | pub fn change_function_name1(c: i64) -> i32; |
22 | } | |
23 | ||
24 | #[cfg(not(cfail1))] | |
fc512014 XL |
25 | #[rustc_dirty(cfg = "cfail2", except = "hir_owner_nodes")] |
26 | #[rustc_clean(cfg = "cfail3")] | |
27 | extern "C" { | |
32a655c1 SL |
28 | pub fn change_function_name2(c: i64) -> i32; |
29 | } | |
30 | ||
32a655c1 SL |
31 | // Change parameter name ------------------------------------------------------- |
32 | #[cfg(cfail1)] | |
fc512014 | 33 | extern "C" { |
32a655c1 SL |
34 | pub fn change_parameter_name(c: i64) -> i32; |
35 | } | |
36 | ||
37 | #[cfg(not(cfail1))] | |
fc512014 XL |
38 | #[rustc_dirty(cfg = "cfail2", except = "hir_owner,hir_owner_nodes")] |
39 | #[rustc_clean(cfg = "cfail3")] | |
40 | extern "C" { | |
32a655c1 SL |
41 | pub fn change_parameter_name(d: i64) -> i32; |
42 | } | |
43 | ||
32a655c1 SL |
44 | // Change parameter type ------------------------------------------------------- |
45 | #[cfg(cfail1)] | |
fc512014 | 46 | extern "C" { |
32a655c1 SL |
47 | pub fn change_parameter_type(c: i64) -> i32; |
48 | } | |
49 | ||
50 | #[cfg(not(cfail1))] | |
fc512014 XL |
51 | #[rustc_dirty(cfg = "cfail2", except = "hir_owner,hir_owner_nodes")] |
52 | #[rustc_clean(cfg = "cfail3")] | |
53 | extern "C" { | |
32a655c1 SL |
54 | pub fn change_parameter_type(c: i32) -> i32; |
55 | } | |
56 | ||
32a655c1 SL |
57 | // Change return type ---------------------------------------------------------- |
58 | #[cfg(cfail1)] | |
fc512014 | 59 | extern "C" { |
32a655c1 SL |
60 | pub fn change_return_type(c: i32) -> i32; |
61 | } | |
62 | ||
63 | #[cfg(not(cfail1))] | |
fc512014 XL |
64 | #[rustc_dirty(cfg = "cfail2", except = "hir_owner,hir_owner_nodes")] |
65 | #[rustc_clean(cfg = "cfail3")] | |
66 | extern "C" { | |
32a655c1 SL |
67 | pub fn change_return_type(c: i32) -> i8; |
68 | } | |
69 | ||
32a655c1 SL |
70 | // Add parameter --------------------------------------------------------------- |
71 | #[cfg(cfail1)] | |
fc512014 | 72 | extern "C" { |
32a655c1 SL |
73 | pub fn add_parameter(c: i32) -> i32; |
74 | } | |
75 | ||
76 | #[cfg(not(cfail1))] | |
fc512014 XL |
77 | #[rustc_dirty(cfg = "cfail2", except = "hir_owner,hir_owner_nodes")] |
78 | #[rustc_clean(cfg = "cfail3")] | |
79 | extern "C" { | |
32a655c1 SL |
80 | pub fn add_parameter(c: i32, d: i32) -> i32; |
81 | } | |
82 | ||
32a655c1 SL |
83 | // Add return type ------------------------------------------------------------- |
84 | #[cfg(cfail1)] | |
fc512014 | 85 | extern "C" { |
32a655c1 SL |
86 | pub fn add_return_type(c: i32); |
87 | } | |
88 | ||
89 | #[cfg(not(cfail1))] | |
fc512014 XL |
90 | #[rustc_dirty(cfg = "cfail2", except = "hir_owner,hir_owner_nodes")] |
91 | #[rustc_clean(cfg = "cfail3")] | |
92 | extern "C" { | |
32a655c1 SL |
93 | pub fn add_return_type(c: i32) -> i32; |
94 | } | |
95 | ||
32a655c1 SL |
96 | // Make function variadic ------------------------------------------------------ |
97 | #[cfg(cfail1)] | |
fc512014 | 98 | extern "C" { |
32a655c1 SL |
99 | pub fn make_function_variadic(c: i32); |
100 | } | |
101 | ||
102 | #[cfg(not(cfail1))] | |
fc512014 XL |
103 | #[rustc_dirty(cfg = "cfail2", except = "hir_owner,hir_owner_nodes")] |
104 | #[rustc_clean(cfg = "cfail3")] | |
105 | extern "C" { | |
32a655c1 SL |
106 | pub fn make_function_variadic(c: i32, ...); |
107 | } | |
108 | ||
32a655c1 SL |
109 | // Change calling convention --------------------------------------------------- |
110 | #[cfg(cfail1)] | |
111 | extern "C" { | |
112 | pub fn change_calling_convention(c: i32); | |
113 | } | |
114 | ||
115 | #[cfg(not(cfail1))] | |
fc512014 XL |
116 | #[rustc_dirty(cfg = "cfail2", except = "hir_owner_nodes")] |
117 | #[rustc_clean(cfg = "cfail3")] | |
32a655c1 SL |
118 | extern "rust-call" { |
119 | pub fn change_calling_convention(c: i32); | |
120 | } | |
121 | ||
32a655c1 SL |
122 | // Make function public -------------------------------------------------------- |
123 | #[cfg(cfail1)] | |
fc512014 | 124 | extern "C" { |
32a655c1 SL |
125 | fn make_function_public(c: i32); |
126 | } | |
127 | ||
128 | #[cfg(not(cfail1))] | |
fc512014 XL |
129 | #[rustc_dirty(cfg = "cfail2", except = "hir_owner_nodes")] |
130 | #[rustc_clean(cfg = "cfail3")] | |
131 | extern "C" { | |
32a655c1 SL |
132 | pub fn make_function_public(c: i32); |
133 | } | |
134 | ||
32a655c1 SL |
135 | // Add function ---------------------------------------------------------------- |
136 | #[cfg(cfail1)] | |
fc512014 | 137 | extern "C" { |
32a655c1 SL |
138 | pub fn add_function1(c: i32); |
139 | } | |
140 | ||
141 | #[cfg(not(cfail1))] | |
fc512014 XL |
142 | #[rustc_dirty(cfg = "cfail2", except = "hir_owner_nodes")] |
143 | #[rustc_clean(cfg = "cfail3")] | |
144 | extern "C" { | |
32a655c1 SL |
145 | pub fn add_function1(c: i32); |
146 | pub fn add_function2(); | |
147 | } | |
148 | ||
32a655c1 SL |
149 | // Change link-args ------------------------------------------------------------ |
150 | #[cfg(cfail1)] | |
151 | #[link_args = "-foo -bar"] | |
fc512014 | 152 | extern "C" { |
32a655c1 SL |
153 | pub fn change_link_args(c: i32); |
154 | } | |
155 | ||
156 | #[cfg(not(cfail1))] | |
fc512014 XL |
157 | #[rustc_dirty(cfg = "cfail2", except = "hir_owner_nodes")] |
158 | #[rustc_clean(cfg = "cfail3")] | |
32a655c1 | 159 | #[link_args = "-foo -bar -baz"] |
fc512014 | 160 | extern "C" { |
32a655c1 SL |
161 | pub fn change_link_args(c: i32); |
162 | } | |
163 | ||
32a655c1 SL |
164 | // Change link-name ------------------------------------------------------------ |
165 | #[cfg(cfail1)] | |
166 | #[link(name = "foo")] | |
fc512014 | 167 | extern "C" { |
32a655c1 SL |
168 | pub fn change_link_name(c: i32); |
169 | } | |
170 | ||
171 | #[cfg(not(cfail1))] | |
fc512014 XL |
172 | #[rustc_dirty(cfg = "cfail2", except = "hir_owner_nodes")] |
173 | #[rustc_clean(cfg = "cfail3")] | |
32a655c1 | 174 | #[link(name = "bar")] |
fc512014 | 175 | extern "C" { |
32a655c1 SL |
176 | pub fn change_link_name(c: i32); |
177 | } | |
178 | ||
179 | type c_i32 = i32; | |
180 | type c_i64 = i64; | |
181 | ||
182 | // Indirectly change parameter type -------------------------------------------- | |
183 | mod indirectly_change_parameter_type { | |
184 | #[cfg(cfail1)] | |
185 | use super::c_i32 as c_int; | |
186 | #[cfg(not(cfail1))] | |
187 | use super::c_i64 as c_int; | |
188 | ||
fc512014 XL |
189 | #[rustc_dirty(cfg = "cfail2", except = "hir_owner,hir_owner_nodes")] |
190 | #[rustc_clean(cfg = "cfail3")] | |
191 | extern "C" { | |
32a655c1 SL |
192 | pub fn indirectly_change_parameter_type(c: c_int); |
193 | } | |
194 | } | |
195 | ||
32a655c1 SL |
196 | // Indirectly change return type -------------------------------------------- |
197 | mod indirectly_change_return_type { | |
198 | #[cfg(cfail1)] | |
199 | use super::c_i32 as c_int; | |
200 | #[cfg(not(cfail1))] | |
201 | use super::c_i64 as c_int; | |
202 | ||
fc512014 XL |
203 | #[rustc_dirty(cfg = "cfail2", except = "hir_owner,hir_owner_nodes")] |
204 | #[rustc_clean(cfg = "cfail3")] | |
205 | extern "C" { | |
32a655c1 SL |
206 | pub fn indirectly_change_return_type() -> c_int; |
207 | } | |
208 | } |