about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2016-01-25 11:36:18 -0800
committerAlex Crichton <alex@alexcrichton.com>2016-02-08 14:28:46 -0800
commita1ffe6b6bbfec7374f91dbbfb2e51a3fa5fadb1e (patch)
treec61ac15eeccf5ae60a37d1e40410b8a866640be3 /src/test
parent26105b1a3765a73bab44fb18ccbd5a4635018fdf (diff)
downloadrust-a1ffe6b6bbfec7374f91dbbfb2e51a3fa5fadb1e.tar.gz
rust-a1ffe6b6bbfec7374f91dbbfb2e51a3fa5fadb1e.zip
rustc: Implement a new `--print cfg` flag
This commit is an implementation of the new compiler flags required by [RFC
1361][rfc]. This specifically adds a new `cfg` option to the `--print` flag to
the compiler. This new directive will print the defined `#[cfg]` directives by
the compiler for the target in question.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1361-cargo-cfg-dependencies.md
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-make/print-cfg/Makefile15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/run-make/print-cfg/Makefile b/src/test/run-make/print-cfg/Makefile
new file mode 100644
index 00000000000..c74233d495b
--- /dev/null
+++ b/src/test/run-make/print-cfg/Makefile
@@ -0,0 +1,15 @@
+-include ../tools.mk
+
+all: default
+	$(RUSTC) --target x86_64-pc-windows-gnu --print cfg | grep windows
+	$(RUSTC) --target x86_64-pc-windows-gnu --print cfg | grep x86_64
+	$(RUSTC) --target i686-pc-windows-msvc --print cfg | grep msvc
+	$(RUSTC) --target i686-apple-darwin --print cfg | grep macos
+
+ifdef IS_WINDOWS
+default:
+	$(RUSTC) --print cfg | grep windows
+else
+default:
+	$(RUSTC) --print cfg | grep unix
+endif