Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
fc52b47
va_args implementation for AAPCS.
JamieCunliffe Jun 30, 2020
31c7aae
Stabilize control-flow-guard codegen option
ajpaverd Jul 14, 2020
5300ca3
cleanup ty_is_~non~_local_constructor
lcnr Jul 17, 2020
1ac3713
refactor ty_is_non_local
lcnr Jul 17, 2020
cfa3a33
compiletest: Rewrite extract_lldb_version function
tesuji Jul 11, 2020
d778f32
compiletest: Rewrite extract_gdb_version function
tesuji Jul 11, 2020
07d56cb
Fix panic as passing wrong format to `extract_gdb_version`
tesuji Jul 11, 2020
79d5cbb
Use Option::as_deref
tesuji Jul 11, 2020
75caee0
Extract closure to function
tesuji Jul 11, 2020
5aa33b1
Use subslice pattern
tesuji Jul 11, 2020
5e5d816
Add missing : after min-gdb-version
tesuji Jul 18, 2020
2bcefa8
Add missing : after *llvm-version
tesuji Jul 19, 2020
99e3a3c
Extract extract_version_range
tesuji Jul 19, 2020
60fac34
Rewrite extract_llvm_version
tesuji Jul 19, 2020
1314d31
Rewrite extract_version_range
tesuji Jul 19, 2020
40df8fd
Apply #66379 to `*mut T` `as_ref`
aticu Jul 20, 2020
cf52d5f
Use forge links for prioritization procedure
spastorino Jul 20, 2020
c71b196
review
lcnr Jul 20, 2020
cfcbca6
update coherence docs
lcnr Jul 20, 2020
7f3e2c0
refactor and reword intra-doc link errors
euclio Jul 19, 2020
8b58eb9
Remove the assert on alignment check.
JamieCunliffe Jul 21, 2020
3eed7da
Update books
ehuss Jul 21, 2020
96225b1
Fix tooltip position if the documentation starts with a code block
GuillaumeGomez Jul 22, 2020
dade0f1
Rollup merge of #73655 - JamieCunliffe:jamie_va-args-c, r=nikic
Manishearth Jul 22, 2020
8afb305
Rollup merge of #73893 - ajpaverd:cfguard-stabilize, r=nikomatsakis
Manishearth Jul 22, 2020
216ed3c
Rollup merge of #74237 - lzutao:compiletest, r=Mark-Simulacrum
Manishearth Jul 22, 2020
e811e29
Rollup merge of #74454 - lcnr:negative-impls, r=nikomatsakis
Manishearth Jul 22, 2020
f4079ce
Rollup merge of #74528 - euclio:intra-link-errors, r=jyn514
Manishearth Jul 22, 2020
d180c79
Rollup merge of #74568 - aticu:master, r=Mark-Simulacrum
Manishearth Jul 22, 2020
2bf5499
Rollup merge of #74570 - spastorino:fix-prioritization-procedures-lin…
Manishearth Jul 22, 2020
3de0de1
Rollup merge of #74589 - ehuss:update-books, r=ehuss
Manishearth Jul 22, 2020
05a2466
Rollup merge of #74635 - GuillaumeGomez:fix-tooltip-pos, r=Manishearth
Manishearth Jul 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
compiletest: Rewrite extract_gdb_version function
  • Loading branch information
tesuji committed Jul 19, 2020
commit d778f326c385b2df7053b84fb5e3f89361b5fc3a
89 changes: 27 additions & 62 deletions src/tools/compiletest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -841,71 +841,36 @@ fn extract_gdb_version(full_version_line: &str) -> Option<u32> {
// This particular form is documented in the GNU coding standards:
// https://www.gnu.org/prep/standards/html_node/_002d_002dversion.html#g_t_002d_002dversion

// don't start parsing in the middle of a number
let mut prev_was_digit = false;
let mut in_parens = false;
for (pos, c) in full_version_line.char_indices() {
if in_parens {
if c == ')' {
in_parens = false;
}
continue;
} else if c == '(' {
in_parens = true;
continue;
}

if prev_was_digit || !c.is_digit(10) {
prev_was_digit = c.is_digit(10);
continue;
let mut splits = full_version_line.rsplit(' ');
let version_string = splits.next().unwrap();

let mut splits = version_string.split('.');
let major = splits.next().unwrap();
let minor = splits.next().unwrap();
let patch = splits.next();

let major: u32 = major.parse().unwrap();
let (minor, patch): (u32, u32) = match minor.find(|c: char| !c.is_digit(10)) {
None => {
let minor = minor.parse().unwrap();
let patch: u32 = match patch {
Some(patch) => match patch.find(|c: char| !c.is_digit(10)) {
None => patch.parse().unwrap(),
Some(idx) if idx > 3 => 0,
Some(idx) => patch[..idx].parse().unwrap(),
},
None => 0,
};
(minor, patch)
}

prev_was_digit = true;

let line = &full_version_line[pos..];

let next_split = match line.find(|c: char| !c.is_digit(10)) {
Some(idx) => idx,
None => continue, // no minor version
};

if line.as_bytes()[next_split] != b'.' {
continue; // no minor version
// There is no patch version after minor-date (e.g. "4-2012").
Some(idx) => {
let minor = minor[..idx].parse().unwrap();
(minor, 0)
}
};

let major = &line[..next_split];
let line = &line[next_split + 1..];

let (minor, patch) = match line.find(|c: char| !c.is_digit(10)) {
Some(idx) => {
if line.as_bytes()[idx] == b'.' {
let patch = &line[idx + 1..];

let patch_len =
patch.find(|c: char| !c.is_digit(10)).unwrap_or_else(|| patch.len());
let patch = &patch[..patch_len];
let patch = if patch_len > 3 || patch_len == 0 { None } else { Some(patch) };

(&line[..idx], patch)
} else {
(&line[..idx], None)
}
}
None => (line, None),
};

if minor.is_empty() {
continue;
}

let major: u32 = major.parse().unwrap();
let minor: u32 = minor.parse().unwrap();
let patch: u32 = patch.unwrap_or("0").parse().unwrap();

return Some(((major * 1000) + minor) * 1000 + patch);
}

None
Some(((major * 1000) + minor) * 1000 + patch)
}

/// Returns (LLDB version, LLDB is rust-enabled)
Expand Down
2 changes: 1 addition & 1 deletion src/tools/compiletest/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::*;

#[test]
fn test_extract_gdb_version() {
macro_rules! test { ($($expectation:tt: $input:tt,)*) => {{$(
macro_rules! test { ($($expectation:literal: $input:literal,)*) => {{$(
assert_eq!(extract_gdb_version($input), Some($expectation));
)*}}}

Expand Down