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

'SenderContext' defines a non-default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator #4635

Open
tiziano88 opened this issue Jan 9, 2024 · 6 comments
Assignees

Comments

@tiziano88
Copy link
Collaborator

From clang-tidy:

/home/tzn/.cache/bazel/_bazel_tzn/dab993785bc8bd52220ddfe5340ed840/sandbox/linux-sandbox/5480/execroot/oak/cc/crypto/hpke/sender_context.h:33:7: error: class 'SenderContext' defines a non-default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions,-warnings-as-errors]

@ipetr0v could you take a quick look and fix that?

@ipetr0v
Copy link
Contributor

ipetr0v commented Jan 10, 2024

Is this error produced by an internal clang-tidy or by the one added in #4634 ?

I'm trying to run bazel build --config=clang-tidy //cc/... locally and I don't get this error

@tiziano88
Copy link
Collaborator Author

To reproduce you can add cppcoreguidelines-special-member-functions to the list of checks in https://github.com/project-oak/oak/blob/main/.clang-tidy and then run just clang-tidy

@ipetr0v
Copy link
Contributor

ipetr0v commented Jan 10, 2024

clang-tidy wants me to use reinterpret_cast here:

oak::crypto::SenderContext* sender_context =
(oak::crypto::SenderContext*)(env->GetLongField(obj, fid));

But then says

error: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr,-warnings-as-errors]

And we have to cast jlong into a pointer because of JNI

@ipetr0v
Copy link
Contributor

ipetr0v commented Jan 10, 2024

Currently had to add -performance-no-int-to-ptr to https://github.com/project-oak/oak/blob/main/.clang-tidy

@ipetr0v
Copy link
Contributor

ipetr0v commented Jan 10, 2024

Also about the error: consider replacing 'long' with 'int64' [google-runtime-int,-warnings-as-errors]. I'm not sure whether it's fine to do on Android JNI (needs additional double-checking).

jobject sender_context =
env->NewObject(sender_context_class, sender_context_constructor,
serialized_encapsulated_public_key, (long)native_sender_context->release());

cc @conradgrobler @k-naliuka

@tiziano88
Copy link
Collaborator Author

FYI I don't think this is urgent or is blocking anything, just something that should be cleaned up at some point.

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