Skip to content

Non-enum structs are silently dropped without a wrapper file #116

Description

@fcooper8472

CppClassWrapperWriter.write() routes every struct into the struct-enum special case (cppwg/writers/class_writer.py:280-303):

if type_traits_classes.is_struct(class_decl):
    enums = class_decl.enumerations(allow_empty=True)
    if len(enums) == 1:
        ...
        self.write_files(work_dir, class_py_name)
    continue

is_struct is pygccxml's keyword test, so a struct with any enum count other than exactly one hits the bare continue and no .cppwg.hpp/.cpp is written. Nothing is logged — the run still prints INFO Generating wrappers for class Foo.

CppModuleWrapperWriter.write_module_wrapper() (module_writer.py:156-162) emits an #include "Foo.cppwg.hpp" for every non-excluded class regardless, so the failure only surfaces as a compile error in the generated module:

_pychaste_all.main.cppwg.cpp:327:10: fatal error: SemNScaledParameters.cppwg.hpp: No such file or directory

Seen with cppwg 0.4.1 wrapping struct SemNScaledParameters { double a, b, c, d; };.

Two separable points:

  • non-enum structs should fall through to the normal class path rather than being skipped
  • if a class is skipped, it should warn and/or be omitted from the module includes, rather than surfacing as a missing header at compile time

Related: there is no public data member support anywhere in the package (no def_readwrite/def_readonly), so even a struct that did get a wrapper would reach Python with no readable fields.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions