Skip to content

Bug? anonymous union error thrown #55

Closed

Description

@bradmartin

Apologies for not having a better grasp of c++ to possibly fix this issue.

I upgraded to using:

FetchContent_Declare(
  cmodule
  URL "https://github.com/scapix-com/cmodule/archive/refs/tags/v1.0.43.tar.gz"
  URL_HASH SHA256=4840662739925f1d815e49e69c01dfab642f54ef0dc3808e0aa75accfa38a4cd
)

in our CMakeLists.txt and end up with an error about use if undeclared identifier 'anonymous' errors which causes the build to fail.

I guess my question is, is this a bug/issue that needs to be addressed in the cpp file or could Scapix improve the handling of the code generation here?

Example of the cpp code (some info renamed for privacy):

 union {
      Data data;
      Command command;
      RenamedThing::Error error;
      OTA ota;
      uint8_t subtype;
    };

warning and error thrown:

/Users/bradmartin/projects/test/renamedthing-watchos/renamedthing-cpp-lib/generated/bridge/objc/cpplib/bridge/Packet.h:97:1: warning: 
      typedef requires a name [-Wmissing-declarations]
typedef struct {
^~~~~~~
/Users/bradmartin/projects/test/smartdrive-watchos/renamedthing-cpp-lib/generated/bridge/objc/cpplib/bridge/Packet.mm:243:54: error: 
      expected unqualified-id
struct scapix::link::objc::struct_<permobil::Packet::(anonymous union at /Users/bradmartin/projects/test...
                                                     ^
/Users/bradmartin/projects/test/renamedthing-watchos/renamedthing-cpp-lib/generated/bridge/objc/cpplib/bridge/Packet.mm:243:55: error: 
      use of undeclared identifier 'anonymous'
struct scapix::link::objc::struct_<test::Packet::(anonymous union at /Users/bradmartin/projects/test...
                                                      ^
1 warning and 2 errors generated.

Activity

  1. Boris-Rasin commented on Feb 21, 2024

    @Boris-Rasin
    Member

    Thank you for your report.
    This was indeed a bug - in some cases, Scapix attempted to generate bindings for unions, which are not supported.

    I have fixed this bug and released a new version.
    Please use new version 1.0.44:
    https://github.com/scapix-com/cmodule/releases

  2. bradmartin commented on Feb 21, 2024

    @bradmartin
    Author

    Thanks, confirmed that does allow the build to succeed and generate the bridge files.

  3. bradmartin commented on Feb 21, 2024

    @bradmartin
    Author

    @Boris-Rasin - I sent a message via the scapix website, would appreciate your reply if you have time. It's about some potential hourly consulting to fix some build issues with the project using Scapix. Thanks for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions