2022-08-22 19:00:00 -05:00
|
|
|
include ../tools.mk
|
2014-11-15 07:51:22 -06:00
|
|
|
|
|
|
|
all:
|
|
|
|
#Option taking a number
|
2017-11-23 09:19:50 -06:00
|
|
|
$(RUSTC) -C codegen-units dummy.rs 2>&1 | \
|
|
|
|
$(CGREP) 'codegen option `codegen-units` requires a number'
|
|
|
|
$(RUSTC) -C codegen-units= dummy.rs 2>&1 | \
|
|
|
|
$(CGREP) 'incorrect value `` for codegen option `codegen-units` - a number was expected'
|
|
|
|
$(RUSTC) -C codegen-units=foo dummy.rs 2>&1 | \
|
|
|
|
$(CGREP) 'incorrect value `foo` for codegen option `codegen-units` - a number was expected'
|
2014-11-15 07:51:22 -06:00
|
|
|
$(RUSTC) -C codegen-units=1 dummy.rs
|
|
|
|
#Option taking a string
|
2017-11-23 09:19:50 -06:00
|
|
|
$(RUSTC) -C extra-filename dummy.rs 2>&1 | \
|
|
|
|
$(CGREP) 'codegen option `extra-filename` requires a string'
|
2014-11-15 07:51:22 -06:00
|
|
|
$(RUSTC) -C extra-filename= dummy.rs 2>&1
|
|
|
|
$(RUSTC) -C extra-filename=foo dummy.rs 2>&1
|
|
|
|
#Option taking no argument
|
2017-11-23 09:19:50 -06:00
|
|
|
$(RUSTC) -C lto= dummy.rs 2>&1 | \
|
2018-09-04 10:57:17 -05:00
|
|
|
$(CGREP) 'codegen option `lto` - either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted'
|
2017-11-23 09:19:50 -06:00
|
|
|
$(RUSTC) -C lto=1 dummy.rs 2>&1 | \
|
2018-09-04 10:57:17 -05:00
|
|
|
$(CGREP) 'codegen option `lto` - either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted'
|
2017-11-23 09:19:50 -06:00
|
|
|
$(RUSTC) -C lto=foo dummy.rs 2>&1 | \
|
2018-09-04 10:57:17 -05:00
|
|
|
$(CGREP) 'codegen option `lto` - either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted'
|
2014-11-15 07:51:22 -06:00
|
|
|
$(RUSTC) -C lto dummy.rs
|
2016-02-02 11:56:59 -06:00
|
|
|
|
|
|
|
# Should not link dead code...
|
2021-12-06 16:09:24 -06:00
|
|
|
$(RUSTC) --print link-args dummy.rs 2>&1 | \
|
2017-11-23 09:19:50 -06:00
|
|
|
$(CGREP) -e '--gc-sections|-z[^ ]* [^ ]*<ignore>|-dead_strip|/OPT:REF'
|
2016-02-02 11:56:59 -06:00
|
|
|
# ... unless you specifically ask to keep it
|
2021-12-06 16:09:24 -06:00
|
|
|
$(RUSTC) --print link-args -C link-dead-code dummy.rs 2>&1 | \
|
2017-11-23 09:19:50 -06:00
|
|
|
$(CGREP) -ve '--gc-sections|-z[^ ]* [^ ]*<ignore>|-dead_strip|/OPT:REF'
|