@@ -40,15 +40,8 @@ impl EarlyProps {
4040 None ,
4141 & mut |ln| {
4242 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" ) ||
5245 ignore_gdb ( config, ln) ||
5346 ignore_lldb ( config, ln) ||
5447 ignore_llvm ( config, ln) ;
@@ -62,28 +55,11 @@ impl EarlyProps {
6255
6356 return props;
6457
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- }
7858 fn ignore_gdb ( config : & Config , line : & str ) -> bool {
7959 if config. mode != common:: DebugInfoGdb {
8060 return false ;
8161 }
8262
83- if config. parse_name_directive ( line, "ignore-gdb" ) {
84- return true ;
85- }
86-
8763 if let Some ( actual_version) = config. gdb_version {
8864 if line. starts_with ( "min-gdb-version" ) {
8965 let ( start_ver, end_ver) = extract_gdb_version_range ( line) ;
@@ -144,10 +120,6 @@ impl EarlyProps {
144120 return false ;
145121 }
146122
147- if config. parse_name_directive ( line, "ignore-lldb" ) {
148- return true ;
149- }
150-
151123 if let Some ( ref actual_version) = config. lldb_version {
152124 if line. starts_with ( "min-lldb-version" ) {
153125 let min_version = line. trim_right ( )
@@ -525,6 +497,30 @@ impl Config {
525497 }
526498 }
527499
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+
528524 fn parse_name_directive ( & self , line : & str , directive : & str ) -> bool {
529525 // Ensure the directive is a whole word. Do not match "ignore-x86" when
530526 // the line says "ignore-x86_64".
0 commit comments