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
Implement $Cxx.omitSchemas annotation #1502
Conversation
Let's make sure this is tested. I think you could just apply the option to |
I did the simple test of adding the annotation to the existing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding tests! Just a bunch of style nitpicks...
Co-authored-by: Kenton Varda <kenton@sandstorm.io>
Implemented style changes and added newlines |
Looks good, thanks! Bazel failure seems unrelated. |
Other builds fail because of the same error:
|
I personally am on windows and i dont think the current bazel build supports it, so i cannot run local testing and all my information is gathered from reading github action logs. It appears that the problem is on the linker level as the object file already exists, if i had to guess it is because A possible workaround I can think of is instead of fully stripping schema data to emit a zero length array of data. |
@mikea Sorry, when I looked at the log I was confused by all of the sign-compare warnings and didn't see the link errors. We should disable that warning (it's disabled in the other builds). All of the CI builds other than Bazel passed. (Well, and MinGW which has been broken for a while.) |
Weirdly the cmake build fails for me locally (although the automake build does not, and obviously neither failed in CI). |
I've reverted the change for now. @Vadmeme we need a version that actually removes the declarations from the header file, I think. |
I looked into simply removing the An alternative is what i have suggested above of replacing the buffer with schema data with a zero sized placeholder as shown below. I have already implemented this and it seems to work and pass all test cases and should not cause any linker issues. However before i make another PR id like to make sure this workaround is something you would be open too. static const ::capnp::_::AlignedData<0> b_f6bd77f100ecb0ff = {{}};
::capnp::word const* const bp_f6bd77f100ecb0ff = b_f6bd77f100ecb0ff.words;
#if !CAPNP_LITE
static const ::capnp::_::RawSchema* const d_f6bd77f100ecb0ff[] = {
&s_a0a8f314b80b63fd,
&s_bc55b08b672b5d97,
&s_e682ab4cf923a417,
};
static const uint16_t m_f6bd77f100ecb0ff[] = {1, 2, 0};
static const uint16_t i_f6bd77f100ecb0ff[] = {0, 1, 2};
const ::capnp::_::RawSchema s_f6bd77f100ecb0ff = {
0xf6bd77f100ecb0ff, b_f6bd77f100ecb0ff.words, 0, d_f6bd77f100ecb0ff, m_f6bd77f100ecb0ff,
3, 3, i_f6bd77f100ecb0ff, nullptr, nullptr, { &s_f6bd77f100ecb0ff, nullptr, nullptr, 0, 0, nullptr }
};
#endif // !CAPNP_LITE |
I don't like the empty buffer approach as it means any attempt to use the schemas (e.g. stringifying a message) would compile just fine and fail at runtime. I'd rather the error be at compile time. |
The only other option i see is manually editing everything that exposed an |
Ideally I think we don't want to declare Maybe what we need to do here is split the macros like |
What you suggested would be ideal but i personally do not know enough about the inner workings of the generated headers to implement it yet. Nothing SHOULD break if |
Implements a
$Cxx.omitSchemas
annotation that strips schema information from the binary as discussed in #1498