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

Fix GCC/Posix port compilation on FreeBSD (#1239) #1240

Merged

Conversation

tymmej
Copy link
Contributor

@tymmej tymmej commented Feb 6, 2025

On FreeBSD pthread_once_t is a struct and cast is required. Otherwise there's compilation error:

../../mocks/freertos/port.c:261:23: error: expected expression
    hSigSetupThread = PTHREAD_ONCE_INIT;
                      ^

PTHREAD_ONCE_INIT is defined as: { PTHREAD_NEEDS_INIT, NULL } on FreeBSD

Description

On FreeBSD pthread_once_t is a struct containing two elements and compiler complains about it.

Test Steps

Build demo app for Posix/GCC.

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.
  • I have tested my changes by compiling demo app for Posix/GCC on Ubuntu and FreeBSD. NOTE: On FreeBSD PTHREAD_STACK_MIN is not defined. As it is used in FreeRTOSConfig.h I've modified this locally to 16 * 1024.

Related Issue

#1239

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

On FreeBSD pthread_once_t is a struct and cast is required.
Otherwise there's compilation error:
../../mocks/freertos/port.c:261:23: error: expected expression
    hSigSetupThread = PTHREAD_ONCE_INIT;
                      ^
PTHREAD_ONCE_INIT is defined as: { PTHREAD_NEEDS_INIT, NULL } on FreeBSD
@tymmej tymmej requested a review from a team as a code owner February 6, 2025 12:51
Copy link

sonarqubecloud bot commented Feb 6, 2025

@kar-rahul-aws
Copy link
Member

Thank you for your contribution @tymmej

@kar-rahul-aws kar-rahul-aws merged commit d10ee46 into FreeRTOS:main Feb 7, 2025
17 checks passed
@tymmej tymmej deleted the fix_freebsd_posix_gcc_port_compile branch February 7, 2025 06:55
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