Skip to content

Commit

Permalink
Make rust_eh_personality optional.
Browse files Browse the repository at this point in the history
  - Not all version of rustc emit rust_eh_personality.  Make it
    optional.

  - Closes #11.
  • Loading branch information
nwalfield committed Sep 30, 2022
1 parent 7c43292 commit c042f28
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ _rpmDigestFinal

# Threse symbols are exposed by Rust :/
# See: https://gitlab.com/sequoia-pgp/rpm-sequoia/-/issues/3
rust_eh_personality
?rust_eh_personality

27 changes: 19 additions & 8 deletions tests/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,22 @@ fn symbols() -> anyhow::Result<()> {
if symbol.is_empty() {
continue;
}
expected_symbols.push(symbol);
if symbol.chars().nth(0) == Some('?') {
expected_symbols.push((&symbol[1..], true));
} else {
expected_symbols.push((symbol, true));

This comment has been minimized.

Copy link
@riking

riking Oct 26, 2022

both branches push true for the 2nd item

This comment has been minimized.

Copy link
@nwalfield

nwalfield Oct 27, 2022

Author Collaborator

Thanks for the review. You're looking at an old version of the code. This was fixed here: 661ce16

}
}
expected_symbols.sort();

eprintln!("Expected {} symbols:", expected_symbols.len());
for symbol in expected_symbols.iter() {
eprintln!(" {}", symbol);
for (symbol, optional) in expected_symbols.iter() {
eprint!(" {}", symbol);
if *optional {
eprint!(" (optional)");
} else {
eprint!("");
}
}

let mut i = 0;
Expand All @@ -91,26 +100,28 @@ fn symbols() -> anyhow::Result<()> {

if i < symbols.len()
&& j < expected_symbols.len()
&& symbols[i] == expected_symbols[j]
&& symbols[i] == expected_symbols[j].0
{
i += 1;
j += 1;
} else if (i < symbols.len()
&& j < expected_symbols.len()
&& symbols[i] < expected_symbols[j])
&& symbols[i] < expected_symbols[j].0)
|| j == expected_symbols.len()
{
eprintln!("Found unexpected symbol {}", symbols[i]);
i += 1;
bad = true;
} else if (i < symbols.len()
&& j < expected_symbols.len()
&& symbols[i] > expected_symbols[j])
&& symbols[i] > expected_symbols[j].0)
|| i == symbols.len()
{
eprintln!("Missing expected symbol {}", expected_symbols[j]);
if ! expected_symbols[j].1 {
eprintln!("Missing expected symbol {}", expected_symbols[j].0);
bad = true;
}
j += 1;
bad = true;
} else {
unreachable!();
}
Expand Down

0 comments on commit c042f28

Please sign in to comment.