-
Notifications
You must be signed in to change notification settings - Fork 918
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
Does not build for strict C99 #339
Comments
Helpful if you give build output; also how you chose to add -std=c99 |
In my project I added the -std=c99 compiler flag in CMakeCache.txt, after running cmake, like this... //Flags used by the C compiler during all build types. This line... #include "pico/stdlib.h" eventually includes platform.h, and it's this code that causes the error... inline static int32_t __mul_instruction(int32_t a, int32_t b) { The errors are first it thinks asm is a function and complains about an implicit declaration, then it barfs on the : in the middle as it's not C. I have tried reproducing it using the standard examples, for example blink.c. I made the same change to pico-examples/build/CMakeCache.txt, but the blink project built without error so somehow the -std=c99 compiler flags I made is not getting transmitted through the examples build process. My cmake file is unremarkable...
If it helps, the project I tried it on is here... https://github.com/miniwinwm/miniwinwm/tree/master/RaspberryPi/Pico/MiniWinSimple |
Does it work with |
It gets through the asm problem, but then fails on static_assert in address_mapped.h. I think typeof in sem.c is going to be a problem as well. It looks like that one needs to be __typeof. |
Note the best way to specify C99 is to do
which will do
for now. you can edit a header, or inject it via the
and it will be included in all files. |
note that we don't claim to work with C99, however if the changes needed for support arer non invasive we will fix them individually |
Thanks for your input. I shall work through the problems to see if I can make progress and if it's only trivial changes needed to get it to work I'll add them here. |
C99 has no static assert, but one might use typedef trick to create one if there's no compiler-specific way
|
I am running into this problem now with trying to compile.
if i comment it out all good. any thoughts to adding a check to all the static_asserts:
or piggy backing off of @Wirtos adding something like this to pico/assert.h:
|
Whoops, that one had a little mistake with concat being unused. Indeed this solution should work in most of the use-cases except static asserts declared inside structs or unions, also could add compiler-specific flags to silence unused warnings about declared typedefs #define concat_(a, b) a##b
#define concat(a, b) concat_(a, b)
#define static_assert(cond, message) typedef char concat(assertion_on_line_, __LINE__)[(cond) ? 1 : -1] |
If compiler option -std=c99 is added the build fails because of some inline assembly instructions. While this is not a major problem, some projects require it.
The text was updated successfully, but these errors were encountered: