Skip to content

New compiler flags: -W all -W no-all -W err-all #2453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/rustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import std::getopts;
import io::{reader_util, writer_util};
import getopts::{optopt, optmulti, optflag, optflagopt, opt_present};
import back::{x86, x86_64};
import std::map::hashmap;

enum pp_mode {ppm_normal, ppm_expanded, ppm_typed, ppm_identified,
ppm_expanded_identified }
Expand Down Expand Up @@ -399,9 +400,22 @@ fn build_session_options(match: getopts::match,
let parse_only = opt_present(match, "parse-only");
let no_trans = opt_present(match, "no-trans");

let lint_flags = (getopts::opt_strs(match, "W")
+ getopts::opt_strs(match, "warn"));
let mut lint_flags = (getopts::opt_strs(match, "W")
+ getopts::opt_strs(match, "warn"));
let lint_dict = lint::get_lint_dict();
#info("Given lint flags: %?", lint_flags);
let exhaustive_flags = ["all", "no-all", "err-all"];
alt lint_flags.find({|elt| exhaustive_flags.contains(elt)}) {
some(all_flag) {
lint_flags = [];
let lint_prefix = str::replace(all_flag, "all", "");
for lint_dict.each_key {|key|
lint_flags += [lint_prefix + key];
}
}
none {}
}
#info("Processed lint flags: %?", lint_flags);
let lint_opts = vec::map(lint_flags) {|flag|
alt lint::lookup_lint(lint_dict, flag) {
none { early_error(demitter, #fmt("unknown warning: %s", flag)) }
Expand Down
3 changes: 3 additions & 0 deletions src/rustc/driver/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ Options:
-W <foo> enable warning <foo>
-W no-<foo> disable warning <foo>
-W err-<foo> enable warning <foo> as an error
-W all enable all warnings
-W no-all disable all warnings
-W err-all enable all warnings as errors
-W help Print available warnings and default settings

-Z help list internal options for debugging rustc
Expand Down