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

Use default equality for asm_syntax structs #592

Merged
merged 3 commits into from
Feb 21, 2024
Merged

Use default equality for asm_syntax structs #592

merged 3 commits into from
Feb 21, 2024

Conversation

elazarg
Copy link
Collaborator

@elazarg elazarg commented Feb 21, 2024

Use C++20 default equality operator for the internal eBPF syntax. This is more robust to changes, and any instruction should be encoded in a way that supports this operator.

The only struct that uses a custom operator is Call; it contains type and name information that do not really belong there, and should be extracted in a future PR (which may help generalizing callx implementation from the basic support in #584).

Some unmarshalling tests are affected:

  • Unary byteswap operations have an unused is64 field; for now it is worked around in the test. (Branch cleanup-c++20 implements an alternative, encoding width for all unary operations).
  • Negation was incorrectly implemented as the comment in the code suggested, and is amended accordinly.

IMO this PR is better merged before #591.

@coveralls
Copy link

coveralls commented Feb 21, 2024

Coverage Status

coverage: 90.171% (+0.04%) from 90.13%
when pulling a695ea6 on default-equality
into 1056586 on main.

src/test/test_marshal.cpp Show resolved Hide resolved
src/test/test_marshal.cpp Outdated Show resolved Hide resolved
elazarg and others added 2 commits February 21, 2024 19:19
Signed-off-by: Elazar Gershuni <[email protected]>

Co-authored-by: Dave Thaler <[email protected]>
Signed-off-by: Elazar Gershuni <[email protected]>

Co-authored-by: Dave Thaler <[email protected]>
@dthaler
Copy link
Contributor

dthaler commented Feb 21, 2024

  • Negation was incorrectly implemented as the comment in the code suggested, and is amended accordinly.

bpf_conformance wasn't catching this. I've now filed
Alan-Jowett/bpf_conformance#204
to update bpf_conformance.

@elazarg elazarg merged commit 3db1b62 into main Feb 21, 2024
12 of 13 checks passed
@elazarg elazarg deleted the default-equality branch February 21, 2024 18:21
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

Successfully merging this pull request may close these issues.

3 participants