alphaville / optimization-engine

Nonconvex embedded optimization: code generation for fast real-time optimization

Home Page:https://alphaville.github.io/optimization-engine/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiler warnings for generated code

michael-p opened this issue · comments

Dear all,

This isn't really a bug, more like a small annoyance, but given the superb quality of this crate I figured I'd report it anyway... :)

On recent nightly (rustc 1.62.0-nightly (34a6c9f26 2022-04-13)), the generated code produces a compiler warning:

warning: unused doc comment
  --> crates/blimp_mpc/path_follow/icasadi_path_follow/src/lib.rs:33:1
   |
33 |   /// C interface (Function API exactly as provided by CasADi)
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
34 | / extern "C" {
35 | |     fn cost_function_path_follow(
36 | |         arg: *const *const c_double,
37 | |         casadi_results: *mut *mut c_double) -> c_int;
...  |
49 | |     ) -> c_int;
50 | | } // END of extern C
   | |_- rustdoc does not generate documentation for extern block
   |
   = note: `#[warn(unused_doc_comments)]` on by default
   = help: use `//` for a plain comment

The corresponding generated code block is:

/// C interface (Function API exactly as provided by CasADi)
extern "C" {
    fn cost_function_path_follow(
        arg: *const *const c_double,
        casadi_results: *mut *mut c_double) -> c_int;
    fn grad_cost_function_path_follow(
        arg: *const *const c_double,
        casadi_results: *mut *mut c_double)
        -> c_int;
    fn mapping_f1_function_path_follow(
        arg: *const *const c_double,
        casadi_results: *mut *mut c_double,
    ) -> c_int;
    fn mapping_f2_function_path_follow(
        arg: *const *const c_double,
        casadi_results: *mut *mut c_double,
    ) -> c_int;
} // END of extern C

Thanks,
Michael

Hi Michael. Many thanks for reporting this. We'll fix it in the next release.