Skip to content

Commit b857de6

Browse files
nnethercoteLegNeato
authored andcommitted
Disabling comment generation in cust_raw.
Even with doxygen-binding, there are hundreds of warnings, due to (a) bad Doxygen formatting in the CUDA comments, and (b) shortcomings in doxygen-bindgen. Fixing these would be difficult, so disabling comments entirely seems easier. This also removes the dependency on doxygen-bindgen.
1 parent 38f7d2c commit b857de6

File tree

4 files changed

+24
-32
lines changed

4 files changed

+24
-32
lines changed

Cargo.lock

Lines changed: 0 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/cust_raw/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ build = "build/main.rs"
1313
bindgen = "0.71.1"
1414
bimap = "0.6.3"
1515
cc = "1.2.17"
16-
doxygen-bindgen = "0.1"
1716

1817
[package.metadata.docs.rs]
1918
features = [

crates/cust_raw/build/callbacks.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,6 @@ impl BindgenCallbacks {
3535
}
3636

3737
impl ParseCallbacks for BindgenCallbacks {
38-
fn process_comment(&self, comment: &str) -> Option<String> {
39-
// First replace backslashes with @ to avoid doctest parsing issues
40-
let cleaned = comment.replace('\\', "@");
41-
// Then transform doxygen syntax to rustdoc
42-
match doxygen_bindgen::transform(&cleaned) {
43-
Ok(res) => Some(res),
44-
Err(err) => {
45-
println!("cargo:warning=Problem processing doxygen comment: {comment}\n{err}");
46-
None
47-
}
48-
}
49-
}
50-
5138
fn will_parse_macro(&self, name: &str) -> MacroParsingBehavior {
5239
match self {
5340
Self::WithFunctionRenames {

crates/cust_raw/build/main.rs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fn main() {
7070
create_cuda_driver_bindings(&sdk, &outdir, &manifest_dir);
7171
create_cuda_runtime_bindings(&sdk, &outdir, &manifest_dir);
7272
create_cublas_bindings(&sdk, &outdir, &manifest_dir);
73-
create_nptx_compiler_bindings(&sdk, &outdir, &manifest_dir);
73+
create_nvptx_compiler_bindings(&sdk, &outdir, &manifest_dir);
7474
create_nvvm_bindings(&sdk, &outdir, &manifest_dir);
7575

7676
if cfg!(any(
@@ -154,6 +154,20 @@ fn create_cuda_driver_bindings(
154154
.size_t_is_usize(true)
155155
.layout_tests(true)
156156
.must_use_type("CUresult")
157+
// The CUDA docs have lots of malformed Doxygen directives, e.g.
158+
//
159+
// \sa
160+
// Foo,
161+
// Bar
162+
//
163+
// instead of
164+
//
165+
// \sa Foo
166+
// \sa Bar
167+
//
168+
// (And others.) If we try to convert these to rustdoc, even using the doxygen-bindgen
169+
// crate, we end up with rustdocs that trigger lots of warnings. So don't even try.
170+
.generate_comments(false)
157171
.generate()
158172
.expect("Unable to generate CUDA driver bindings.");
159173
bindings
@@ -203,6 +217,8 @@ fn create_cuda_runtime_bindings(
203217
.size_t_is_usize(true)
204218
.layout_tests(true)
205219
.must_use_type("cudaError_t")
220+
// See the comment on `generate_comments` in `create_cuda_runtime_bindings`.
221+
.generate_comments(false)
206222
.generate()
207223
.expect("Unable to generate CUDA runtime bindings.");
208224
bindings
@@ -254,6 +270,8 @@ fn create_cublas_bindings(sdk: &cuda_sdk::CudaSdk, outdir: &path::Path, manifest
254270
.size_t_is_usize(true)
255271
.layout_tests(true)
256272
.must_use_type("cublasStatus_t")
273+
// See the comment on `generate_comments` in `create_cuda_runtime_bindings`.
274+
.generate_comments(false)
257275
.generate()
258276
.unwrap_or_else(|_| panic!("Unable to generate {pkg} bindings."));
259277
bindings
@@ -262,7 +280,7 @@ fn create_cublas_bindings(sdk: &cuda_sdk::CudaSdk, outdir: &path::Path, manifest
262280
}
263281
}
264282

265-
fn create_nptx_compiler_bindings(
283+
fn create_nvptx_compiler_bindings(
266284
sdk: &cuda_sdk::CudaSdk,
267285
outdir: &path::Path,
268286
manifest_dir: &path::Path,
@@ -294,6 +312,8 @@ fn create_nptx_compiler_bindings(
294312
.size_t_is_usize(true)
295313
.layout_tests(true)
296314
.must_use_type("nvPTXCompileResult")
315+
// See the comment on `generate_comments` in `create_cuda_runtime_bindings`.
316+
.generate_comments(false)
297317
.generate()
298318
.expect("Unable to generate nvptx-compiler bindings.");
299319
bindings
@@ -327,6 +347,8 @@ fn create_nvvm_bindings(sdk: &cuda_sdk::CudaSdk, outdir: &path::Path, manifest_d
327347
.size_t_is_usize(true)
328348
.layout_tests(true)
329349
.must_use_type("nvvmResult")
350+
// See the comment on `generate_comments` in `create_cuda_runtime_bindings`.
351+
.generate_comments(false)
330352
.generate()
331353
.expect("Unable to generate libNVVM bindings.");
332354
bindings

0 commit comments

Comments
 (0)