-
Notifications
You must be signed in to change notification settings - Fork 13.3k
debuginfo: Ignore optimized enum tests for GDB versions that can't handle them. #39039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
|
||
// ignore-tidy-linelength | ||
// ignore-lldb | ||
// ignore-gdb-version: 7.11.90 - 7.12 | ||
|
||
// compile-flags:-g | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,19 +73,24 @@ impl EarlyProps { | |
return false; | ||
} | ||
|
||
if parse_name_directive(line, "ignore-gdb") { | ||
if !line.contains("ignore-gdb-version") && | ||
parse_name_directive(line, "ignore-gdb") { | ||
return true; | ||
} | ||
|
||
if let Some(actual_version) = config.gdb_version { | ||
if line.contains("min-gdb-version") { | ||
let min_version = line.trim() | ||
.split(' ') | ||
.last() | ||
.expect("Malformed GDB version directive"); | ||
let min_version = extract_gdb_version_range(line); | ||
|
||
if min_version.0 != min_version.1 { | ||
panic!("Expected single GDB version") | ||
} | ||
// Ignore if actual version is smaller the minimum required | ||
// version | ||
actual_version < extract_gdb_version(min_version).unwrap() | ||
actual_version < min_version.0 | ||
} else if line.contains("ignore-gdb-version") { | ||
let version_range = extract_gdb_version_range(line); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, I'd prefer to destructure here. |
||
actual_version >= version_range.0 && actual_version <= version_range.1 | ||
} else { | ||
false | ||
} | ||
|
@@ -94,6 +99,30 @@ impl EarlyProps { | |
} | ||
} | ||
|
||
fn extract_gdb_version_range(line: &str) -> (u32, u32) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a comment explaining the return type please? |
||
const ERROR_MESSAGE: &'static str = "Malformed GDB version directive"; | ||
|
||
let range_components = line.split(' ') | ||
.flat_map(|word| word.split('-')) | ||
.filter(|word| word.len() > 0) | ||
.skip_while(|word| extract_gdb_version(word).is_none()) | ||
.collect::<Vec<&str>>(); | ||
|
||
match range_components.len() { | ||
0 => panic!(ERROR_MESSAGE), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could be removed |
||
1 => { | ||
let v = extract_gdb_version(range_components[0]).unwrap(); | ||
(v, v) | ||
} | ||
2 => { | ||
let v_min = extract_gdb_version(range_components[0]).unwrap(); | ||
let v_max = extract_gdb_version(range_components[1]).expect(ERROR_MESSAGE); | ||
(v_min, v_max) | ||
} | ||
_ => panic!(ERROR_MESSAGE), | ||
} | ||
} | ||
|
||
fn ignore_lldb(config: &Config, line: &str) -> bool { | ||
if config.mode != common::DebugInfoLldb { | ||
return false; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the name is misleading because it is both the min and max version? Rather, than renaming, using a destructuring
let
rather than tuple indexing would probably be more readable.