1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/// NOTE: We don't have a proper black box in stable Rust. This is
/// a workaround implementation, that may have a too big performance overhead,
/// depending on operation, or it may fail to properly avoid having code
/// optimized out. It is good enough that it is used by default.
///
/// A function that is opaque to the optimizer, to allow benchmarks to
/// pretend to use outputs to assist in avoiding dead-code
/// elimination.
// copied from https://docs.rs/bencher/0.1.5/src/bencher/lib.rs.html#590-596
/// If the block of code which contains this macro doesn't get dead code
/// eliminated, this macro ensures that the resulting binary contains a
/// easy-to-find static string with the format `"<$feature,$ctx>"`.
///
/// In `gdbstub`, this macro makes it easy to see if the Rust compiler was able
/// to dead-code-eliminate the packet parsing / handling code associated with
/// unimplemented protocol extensions.
///
/// e.g: if the target didn't implement the `MonitorCmd` extension, then running
/// the unix command `strings <finalbinary> | grep "<qRcmd,"` should return no
/// results.