Skip to content

translate-c erroneously translates macro into a function with variadic parameters. #7594

Description

@lithdew

While attempting to import libmdbx v0.9.2 (amalgmated source-code) into Zig, I hit the compile error:

./zig-cache/o/f8c145dcff9dc1971436ccf5076fab7f/cimport.zig:954:5: error: non-extern function is variadic
pub fn MDBX_MAP_RESIZED_is_deprecated(...) callconv(.C) c_int {
^

The following C code in mdbx.h:

/** MDBX_MAP_RESIZED * \ingroup c_err * \deprecated Please review your code to use MDBX_UNABLE_EXTEND_MAPSIZE * instead. */MDBX_DEPRECATEDstatic __inline intMDBX_MAP_RESIZED_is_deprecated() {
returnMDBX_UNABLE_EXTEND_MAPSIZE;
}
#defineMDBX_MAP_RESIZED MDBX_MAP_RESIZED_is_deprecated()

... got translated to:

pubfnMDBX_MAP_RESIZED_is_deprecated(...) callconv(.C) c_int {
returnMDBX_UNABLE_EXTEND_MAPSIZE;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviortranslate-cC to Zig source translation feature (@cImport)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions