Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anonymous union types in structs lead to invalid generated code #190

Open
david-bouyssie opened this issue Jan 28, 2019 · 0 comments
Open
Assignees

Comments

@david-bouyssie
Copy link

In this header file
https://github.com/mzdb/rmzdb/blob/master/src/libmzdb.h

I have a struct defining an inner anonymous union like this:

typedef struct libmzdb_spectrum_data
{
    libmzdb_data_encoding_t data_encoding;
    int peak_count;
    union {
        double* mz_array_as_doubles;
        float* mz_array_as_floats;
    };
    union {
        double* intensity_array_as_doubles;
        float* intensity_array_as_floats;
    };
    float* lwhm_array; // warning: can be NULL
    float* rwhm_array; // warning: can be NULL
} libmzdb_spectrum_data_t;

In the generated bindings some parts of the code are missing (see ERROR comments):

object struct_libmzdb_spectrum_data {
    import implicits._
    def apply()(implicit z: native.Zone): native.Ptr[struct_libmzdb_spectrum_data] = native.alloc[struct_libmzdb_spectrum_data]
    def apply(
      data_encoding: native.Ptr[libmzdb_data_encoding_t],
      peak_count: native.CInt,
       : native.Ptr[union_anonymous_1], // ERROR: argument name missing
       : native.Ptr[union_anonymous_2],  // ERROR: argument name missing
      lwhm_array: native.Ptr[native.CFloat],
      rwhm_array: native.Ptr[native.CFloat]
)(implicit z: native.Zone): native.Ptr[struct_libmzdb_spectrum_data] = {
      val ptr = native.alloc[struct_libmzdb_spectrum_data]
      ptr.data_encoding = data_encoding
      ptr.peak_count = peak_count
      ptr. =  // ERROR
      ptr. =  // ERROR
      ptr.lwhm_array = lwhm_array
      ptr.rwhm_array = rwhm_array
      ptr
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants