File tree 1 file changed +28
-1
lines changed
1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change 1
1
//! Constants associated with each target.
2
2
3
- // Keep entries sorted alphabetically.
3
+ // Replaces the #[else] gate with #[cfg(not(any(…)))] of all the other gates.
4
+ // This ensures that they must be mutually exclusive and do not have precedence
5
+ // like cfg_if!.
6
+ macro cfg_unordered(
7
+ $( #[ cfg( $cfg: meta) ] $os: item) *
8
+ #[ else] $fallback: item
9
+ ) {
10
+ $( #[ cfg( $cfg) ] $os) *
11
+ #[ cfg ( not ( any ( $( $cfg) , * ) ) ) ] $fallback
12
+ }
13
+
14
+ // Keep entries sorted alphabetically and mutually exclusive.
15
+
16
+ cfg_unordered ! {
4
17
5
18
#[ cfg( target_os = "aix" ) ]
6
19
pub mod os {
@@ -375,3 +388,17 @@ pub mod os {
375
388
pub const EXE_SUFFIX : & str = ".exe" ;
376
389
pub const EXE_EXTENSION : & str = "exe" ;
377
390
}
391
+
392
+ // The fallback when none of the other gates match.
393
+ #[ else]
394
+ pub mod os {
395
+ pub const FAMILY : & str = "" ;
396
+ pub const OS : & str = "" ;
397
+ pub const DLL_PREFIX : & str = "" ;
398
+ pub const DLL_SUFFIX : & str = "" ;
399
+ pub const DLL_EXTENSION : & str = "" ;
400
+ pub const EXE_SUFFIX : & str = "" ;
401
+ pub const EXE_EXTENSION : & str = "" ;
402
+ }
403
+
404
+ }
You can’t perform that action at this time.
0 commit comments