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

pkg/tinydtls: fix compilation with sock_async #21105

Conversation

maribu
Copy link
Member

@maribu maribu commented Dec 23, 2024

Contribution description

When module sock_async is used but sock_async_event is not, compilation previously failed. This fixes the issue.

Testing procedure

In master

USEMODULE=sock_async make -C tests/net/nanocoap_cli BOARD=native64 -j
[...]
/home/[email protected]/Repos/software/RIOT/master/pkg/tinydtls/contrib/sock_dtls.c: In function ‘sock_dtls_set_cb’:
/home/[email protected]/Repos/software/RIOT/master/pkg/tinydtls/contrib/sock_dtls.c:1067:9: error: unknown type name ‘sock_async_ctx_t’; did you mean ‘sock_async_flags_t’?
 1067 |         sock_async_ctx_t *ctx = sock_dtls_get_async_ctx(sock);
      |         ^~~~~~~~~~~~~~~~
      |         sock_async_flags_t
/home/[email protected]/Repos/software/RIOT/master/pkg/tinydtls/contrib/sock_dtls.c:1067:33: error: implicit declaration of function ‘sock_dtls_get_async_ctx’ [-Werror=implicit-function-declaration]
 1067 |         sock_async_ctx_t *ctx = sock_dtls_get_async_ctx(sock);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~
/home/[email protected]/Repos/software/RIOT/master/pkg/tinydtls/contrib/sock_dtls.c:1067:33: error: initialization of ‘int *’ from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
/home/[email protected]/Repos/software/RIOT/master/pkg/tinydtls/contrib/sock_dtls.c:1068:16: error: request for member ‘queue’ in something not a structure or union
 1068 |         if (ctx->queue) {
      |                ^~
/home/[email protected]/Repos/software/RIOT/master/pkg/tinydtls/contrib/sock_dtls.c:1069:52: error: request for member ‘queue’ in something not a structure or union
 1069 |             sock_udp_event_init(sock->udp_sock, ctx->queue, _udp_cb, sock);
      |                                                    ^~
cc1: all warnings being treated as errors

This PR

USEMODULE=sock_async make -C tests/net/nanocoap_cli BOARD=native64 -j
[...]
   text	  data	   bss	   dec	   hex	filename
 265870	  4328	154128	424326	 67986	/home/[email protected]/Repos/software/RIOT/master/tests/net/nanocoap_cli/bin/native64/tests_nanocoap_cli.elf
make: Leaving directory '/home/[email protected]/Repos/software/RIOT/master/tests/net/nanocoap_cli'

Issues/PRs references

None

When module `sock_async` is used but `sock_async_event` is not,
compilation previously failed. This fixes the issue.
@maribu maribu added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Dec 23, 2024
@github-actions github-actions bot added the Area: pkg Area: External package ports label Dec 23, 2024
@riot-ci
Copy link

riot-ci commented Dec 23, 2024

Murdock results

✔️ PASSED

e08fb49 pkg/tinydtls: fix compilation with sock_async

Success Failures Total Runtime
10246 0 10248 16m:51s

Artifacts

@maribu maribu enabled auto-merge December 23, 2024 12:28
@maribu maribu added this pull request to the merge queue Dec 23, 2024
}
#endif
sock_udp_set_cb(sock->udp_sock, _udp_cb, sock);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait doesn't sock_udp_set_cb() also require sock_async?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but what is hidden behind condition compilation now is related to sock_async_event rather than sock_async.

The difference is that with sock_async_event an event handler does perform the actual callback (hence, a user defined thread), while sock_async will perform the callback in an implementation defined context.

@benpicco benpicco added the Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer label Dec 23, 2024
Merged via the queue into RIOT-OS:master with commit 95fe972 Dec 23, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants