@@ -40,15 +40,8 @@ impl EarlyProps {
40
40
None ,
41
41
& mut |ln| {
42
42
props. ignore =
43
- props. ignore || config. parse_name_directive ( ln, "ignore-test" ) ||
44
- config. parse_name_directive ( ln, & ignore_target ( config) ) ||
45
- config. parse_name_directive ( ln, & ignore_architecture ( config) ) ||
46
- config. parse_name_directive ( ln, & ignore_stage ( config) ) ||
47
- config. parse_name_directive ( ln, & ignore_env ( config) ) ||
48
- ( config. mode == common:: Pretty &&
49
- config. parse_name_directive ( ln, "ignore-pretty" ) ) ||
50
- ( config. target != config. host &&
51
- config. parse_name_directive ( ln, "ignore-cross-compile" ) ) ||
43
+ props. ignore ||
44
+ config. parse_cfg_name_directive ( ln, "ignore" ) ||
52
45
ignore_gdb ( config, ln) ||
53
46
ignore_lldb ( config, ln) ||
54
47
ignore_llvm ( config, ln) ;
@@ -62,28 +55,11 @@ impl EarlyProps {
62
55
63
56
return props;
64
57
65
- fn ignore_target ( config : & Config ) -> String {
66
- format ! ( "ignore-{}" , util:: get_os( & config. target) )
67
- }
68
- fn ignore_architecture ( config : & Config ) -> String {
69
- format ! ( "ignore-{}" , util:: get_arch( & config. target) )
70
- }
71
- fn ignore_stage ( config : & Config ) -> String {
72
- format ! ( "ignore-{}" , config. stage_id. split( '-' ) . next( ) . unwrap( ) )
73
- }
74
- fn ignore_env ( config : & Config ) -> String {
75
- format ! ( "ignore-{}" ,
76
- util:: get_env( & config. target) . unwrap_or( "<unknown>" ) )
77
- }
78
58
fn ignore_gdb ( config : & Config , line : & str ) -> bool {
79
59
if config. mode != common:: DebugInfoGdb {
80
60
return false ;
81
61
}
82
62
83
- if config. parse_name_directive ( line, "ignore-gdb" ) {
84
- return true ;
85
- }
86
-
87
63
if let Some ( actual_version) = config. gdb_version {
88
64
if line. starts_with ( "min-gdb-version" ) {
89
65
let ( start_ver, end_ver) = extract_gdb_version_range ( line) ;
@@ -144,10 +120,6 @@ impl EarlyProps {
144
120
return false ;
145
121
}
146
122
147
- if config. parse_name_directive ( line, "ignore-lldb" ) {
148
- return true ;
149
- }
150
-
151
123
if let Some ( ref actual_version) = config. lldb_version {
152
124
if line. starts_with ( "min-lldb-version" ) {
153
125
let min_version = line. trim_right ( )
@@ -525,6 +497,30 @@ impl Config {
525
497
}
526
498
}
527
499
500
+ /// Parses a name-value directive which contains config-specific information, e.g. `ignore-x86`
501
+ /// or `normalize-stderr-32bit`. Returns `true` if the line matches it.
502
+ fn parse_cfg_name_directive ( & self , line : & str , prefix : & str ) -> bool {
503
+ if line. starts_with ( prefix) && line. as_bytes ( ) . get ( prefix. len ( ) ) == Some ( & b'-' ) {
504
+ let name = line[ prefix. len ( ) +1 ..] . split ( & [ ':' , ' ' ] [ ..] ) . next ( ) . unwrap ( ) ;
505
+
506
+ name == "test" ||
507
+ name == util:: get_os ( & self . target ) || // target
508
+ name == util:: get_arch ( & self . target ) || // architecture
509
+ name == util:: get_pointer_width ( & self . target ) || // pointer width
510
+ name == self . stage_id . split ( '-' ) . next ( ) . unwrap ( ) || // stage
511
+ Some ( name) == util:: get_env ( & self . target ) || // env
512
+ match self . mode {
513
+ common:: DebugInfoGdb => name == "gdb" ,
514
+ common:: DebugInfoLldb => name == "lldb" ,
515
+ common:: Pretty => name == "pretty" ,
516
+ _ => false ,
517
+ } ||
518
+ ( self . target != self . host && name == "cross-compile" )
519
+ } else {
520
+ false
521
+ }
522
+ }
523
+
528
524
fn parse_name_directive ( & self , line : & str , directive : & str ) -> bool {
529
525
// Ensure the directive is a whole word. Do not match "ignore-x86" when
530
526
// the line says "ignore-x86_64".
0 commit comments