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

bluetooth: CTS: Fix includes to avoid build error with some libCs #81415

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aescolar
Copy link
Member

@aescolar aescolar commented Nov 14, 2024

Remove unnecessary include in header and source file which causes conflicting type definitions with some libCs.

gmtime_r() is an extension to the C library, and therefore one needs to explicitly ask for its prototype to have it exposed. This is done by defining _POSIX_C_SOURCE so let's do so.

These two changes fix build errors with some libCs. Tested with pico, newlib, minimal and the host glibc with CONFIG_BT_CTS_HELPER_API set to n and y

Related to #81412
Fixes #81416

Remove unnecessary include in header and source file.

gmtime_r() is an extension to the C library, and therefore one
needs to explicitly ask for its prototype to have it exposed.
This is done by defining _POSIX_C_SOURCE so let's do so.

These two changes fix build errors with some libCs.
Tested with pico, newlib, minimal and the host glibc.

Signed-off-by: Alberto Escolar Piedras <[email protected]>
Comment on lines +12 to +13
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809L
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a code comment here explaining why you're doing this (i.e. which libc API needs this)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BT CTS fails to build with some libCs
4 participants