dropbox / djinni

A tool for generating cross-language type declarations and interface bindings.
Apache License 2.0
2.88k stars 487 forks source link

New "flags" archetype for enums oriented towards bitwise flags #323

Closed choiip closed 7 years ago

choiip commented 7 years ago

This change is originally committed by mknejp with resolved the conflict. I fixed issues pointed out by artwyman.

artwyman commented 7 years ago

@xianwen can do the test & merge from here.

artwyman commented 7 years ago

The CLA-bot doesn't seem to have triggered, but I manually confirmed that @choiip has signed the CLA.

xianwen commented 7 years ago

Oops, make all passed on master branch, so I merged this commit.

But when I'm trying to merge this changes to python branch, I got the following errors:

Undefined symbols for architecture i386:
  "testsuite::FlagRoundtrip::roundtrip_empty_boxed(std::experimental::fundamentals_v1::optional<testsuite::empty_flags>)", referenced from:
      _cw__flag_roundtrip_roundtrip_empty_boxed in cw__flag_roundtrip.o
  "testsuite::FlagRoundtrip::roundtrip_access_boxed(std::experimental::fundamentals_v1::optional<testsuite::access_flags>)", referenced from:
      _cw__flag_roundtrip_roundtrip_access_boxed in cw__flag_roundtrip.o
ld: symbol(s) not found for architecture i386

Any ideas why this is happening and how to fix it?

artwyman commented 7 years ago

That kind of thing can happen because Python isn't fully feature-complete on everything, and in particular nobody's implemented this flags feature for Python yet. The general approach to that is the forking of the test suites, so in particular the .djinni input files for the test suite are separated into "common" files which all test suites use, and then some which are used only for non-Python, and others used only for Python. My suspicion is that the new test cases for flags were included in the common set, and need to be moved into the non-Python set, just by moving things around in .djinni files. If that doesn't work, and Python is actually triggering errors when parsing input which doesn't include any flags, then there might be a more complicated issue, but you should check that first.