Bug 439685 compiler warning in callgrind/main.c
[valgrind.git] / memcheck / tests / demangle-rust.c
blobf5805ff42bbc4a3547bb6d999ab51b61af51e00a
1 // Valgrind supports demangling Rust symbols (both the "v0" and "legacy"
2 // mangling schemes), but we don't want to add a dependency on the Rust
3 // compiler for a single test. So this is a C program with function names that
4 // are mangled Rust symbols. In the output, they become demangled Rust names.
5 // It's a hack, but a useful one.
7 #include <stdlib.h>
9 // A v0 symbol that demangles to: <rustc_middle::ty::PredicateKind as rustc_middle::ty::fold::TypeFoldable>::fold_with::<rustc_infer::infer::resolve::OpportunisticVarResolver>
10 int _RINvYNtNtCs4uGc65yWeeX_12rustc_middle2ty13PredicateKindNtNtB5_4fold12TypeFoldable9fold_withNtNtNtCsgI90OQiJWEs_11rustc_infer5infer7resolve24OpportunisticVarResolverECsdozMG8X9FIu_21rustc_trait_selection(int *p)
12 free(p);
13 free(p);
14 return 1;
17 // A v0 symbol that demangles to: rustc_expand::mbe::macro_parser::parse_tt
18 int _RNvNtNtCsaqSe1lZGvEL_12rustc_expand3mbe12macro_parser8parse_tt(int* p)
20 return _RINvYNtNtCs4uGc65yWeeX_12rustc_middle2ty13PredicateKindNtNtB5_4fold12TypeFoldable9fold_withNtNtNtCsgI90OQiJWEs_11rustc_infer5infer7resolve24OpportunisticVarResolverECsdozMG8X9FIu_21rustc_trait_selection(p);
23 // A legacy symbol that demangles to: core::str::lossy::Utf8Lossy::from_bytes
24 int _ZN4core3str5lossy9Utf8Lossy10from_bytes17heb1677c8cb728b0bE(int* p)
26 return _RNvNtNtCsaqSe1lZGvEL_12rustc_expand3mbe12macro_parser8parse_tt(p);
29 int main(void)
31 return _ZN4core3str5lossy9Utf8Lossy10from_bytes17heb1677c8cb728b0bE(malloc(sizeof(int)));