Skip to content

Commit

Permalink
remove leading comma from macro expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
DebugSteven committed Dec 31, 2022
1 parent c495558 commit b2cd337
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,8 +934,8 @@ def main():
if len(sys.argv) > 1 and sys.argv[1] == 'help':
sys.argv = [sys.argv[0], '-h'] + sys.argv[2:]

help_triggered = (
'-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1)
# help_triggered = ('-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1)
help_triggered = len(sys.argv) == 1 or any(x in ["-h", "--help", "--version"] for x in sys.argv)
try:
bootstrap(help_triggered)
if not help_triggered:
Expand Down
2 changes: 1 addition & 1 deletion src/tools/tidy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ pub mod ui_tests;
pub mod unit_tests;
pub mod unstable_book;
pub mod walk;
pub mod x;
pub mod x_version;
22 changes: 3 additions & 19 deletions src/tools/tidy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,34 +53,18 @@ fn main() {
VecDeque::with_capacity(concurrency.get());

macro_rules! check {
($p:ident) => {
while handles.len() >= concurrency.get() {
handles.pop_front().unwrap().join().unwrap();
}

let handle = s.spawn(|| {
let mut flag = false;
$p::check(&mut flag);
if (flag) {
bad.store(true, Ordering::Relaxed);
}
});
handles.push_back(handle);
};

($p:ident $(, $args:expr)* ) => {
drain_handles(&mut handles);

let handle = s.spawn(|| {
let mut flag = false;
$p::check($($args),* , &mut flag);
$p::check($($args, )* &mut flag);
if (flag) {
bad.store(true, Ordering::Relaxed);
}
});
handles.push_back(handle);
};

}
}

check!(target_specific_tests, &src_path);
Expand Down Expand Up @@ -123,7 +107,7 @@ fn main() {
check!(alphabetical, &compiler_path);
check!(alphabetical, &library_path);

check!(x);
check!(x_version);

let collected = {
drain_handles(&mut handles);
Expand Down
4 changes: 1 addition & 3 deletions src/tools/tidy/src/x.rs → src/tools/tidy/src/x_version.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use std::process::Command;

pub fn check(_bad: &mut bool) {
let result = Command::new("x")
.arg("--version")
.output();
let result = Command::new("x").arg("--version").output();
let output = match result {
Ok(output) => output,
Err(_e) => todo!(),
Expand Down

0 comments on commit b2cd337

Please sign in to comment.