Skip to content

Conversation

rhulme
Copy link
Contributor

@rhulme rhulme commented Sep 6, 2025

In particular this allows compile-time checks to be performed on the contents of pio_program structs via 'static_assert'.

This could be used (for example) to confirm that multiple PIO programs fit in a single PIO module and abort compilation if not.

Fixes #2650

In particular this allows compile-time checks to be performed on the
contents of pio_program structs via 'static_assert'.

This could be used (for example) to confirm that multiple PIO programs
fit in a single PIO module and abort compilation if not.

Fixes raspberrypi#2650
@@ -79,6 +79,13 @@ struct c_sdk_output : public output_format {
fprintf(out, "#endif\n");
fprintf(out, "\n");

fprintf(out, "#ifdef __cplusplus\n");
Copy link
Contributor

Choose a reason for hiding this comment

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

https://en.cppreference.com/w/cpp/language/constexpr.html says that constexpr was only added in C++11, so should this line perhaps be

Suggested change
fprintf(out, "#ifdef __cplusplus\n");
fprintf(out, "#if defined(__cplusplus) && defined(__cpp_constexpr)\n");

so that it doesn't break older C++ compilers? (Or perhaps simply #ifdef __cpp_constexpr is sufficient?)

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.

2 participants