Skip to content

Conversation

dancollins
Copy link
Contributor

The pico SDK uses typeof() and the current approach, in CMakeLists.txt, wasn't enough. This commit adds a
dependency on GNU extensions to ensure the builds pass.

See #90936 for full details.

The pico SDK uses typeof() and the current approach, in
CMakeLists.txt, wasn't enough. This commit adds a
dependency on GNU extensions to ensure the builds pass.

Signed-off-by: Dan Collins <[email protected]>
@josuah
Copy link
Contributor

josuah commented Jun 2, 2025

Short brainstorming:

  • One way is to enable GNU extensions
  • One way is to enable C23
  • One way is this workaround:
    /* Required for C99 compilation (required for GCC-8.x version,
    * where typeof is used instead of __typeof__)
    */
    #ifndef typeof
    #define typeof __typeof__
    #endif

More reading:

Thank you!

Copy link

sonarqubecloud bot commented Jun 2, 2025

@soburi
Copy link
Member

soburi commented Jun 2, 2025

zephyrproject-rtos/hal_rpi_pico#9
#90939
(And also reverting recent changes #90896)

This was discussed in the PR above, and unless there are any new issues that require a change in policy, we would like to proceed with the current situation.

Since pico-sdk requires gcc extensions or c24, we have no choice but to introduce this for the har_rpi_pico domain, but we would like to maintain c99 for the rest.

The current method is a bit hacky, but I think it's not bad from the perspective of achieving both of the above goals.

@dancollins
Copy link
Contributor Author

dancollins commented Jun 2, 2025

I had searched for 'typeof' but didn't think to search for the C standard :) Thanks @josuah and @soburi.

Your approach, setting gnu11 for just the pico sources, is much less heavy-handed so I will close this.

@dancollins dancollins closed this Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants