From 3e3f827a96aeb613956a3ba163324fcca74321c2 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Thu, 9 Feb 2023 11:56:21 -0600 Subject: [PATCH 1/2] Reword `push_cc_arg()` doc comments. * Clarify that the flag is added after other arguments (although obvious from the function name), * Push extraneous info to the second paragraph to display nicer in IDE completions, * Reword the bits about nvcc and the `-Xcompiler` flag. --- src/lib.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index d26ba67b..0806a13c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3277,11 +3277,12 @@ impl Tool { self.removed_args.push(flag); } - /// Add a flag, and optionally prepend the NVCC wrapper flag "-Xcompiler". + /// Push a flag to the end of the compiler's arguments list. /// - /// Currently this is only used for compiling CUDA sources, since NVCC only - /// accepts a limited set of GNU-like flags, and the rest must be prefixed - /// with a "-Xcompiler" flag to get passed to the underlying C++ compiler. + /// Currently `-Xcompiler` is inserted before the passed flag when compiling + /// CUDA sources since NVCC only accepts a limited set of GNU-like flags, + /// while the rest must be prefixed with the `-Xcompiler` flag to get passed + /// to the underlying C++ compiler. fn push_cc_arg(&mut self, flag: OsString) { if self.cuda { self.args.push("-Xcompiler".into()); From 0b68d59b464b7115d2dac2ed70fd0f093b5ebd8e Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Thu, 9 Feb 2023 15:01:24 -0600 Subject: [PATCH 2/2] Clarify implementation limitations of funcs in doc comment --- src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 0806a13c..688f476f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3290,6 +3290,9 @@ impl Tool { self.args.push(flag); } + /// Checks if an argument or flag has already been specified or conflicts. + /// + /// Currently only checks optimization flags. fn is_duplicate_opt_arg(&self, flag: &OsString) -> bool { let flag = flag.to_str().unwrap(); let mut chars = flag.chars(); @@ -3317,7 +3320,7 @@ impl Tool { return false; } - /// Don't push optimization arg if it conflicts with existing args + /// Don't push optimization arg if it conflicts with existing args. fn push_opt_unless_duplicate(&mut self, flag: OsString) { if self.is_duplicate_opt_arg(&flag) { println!("Info: Ignoring duplicate arg {:?}", &flag);