Closed barracuda156 closed 6 months ago
It looks like you're compiling with the c99 standard. Can you try compiling with the c11 or gnu11 standard and see if that fixes it?
Edit: If that's not possible or doesn't work, the _Static_assert
macro is considered deprecated, so I'd prefer you to put those static asserts inside an #ifdef __APPLE__
clause (or create a custom wrapper macro if you're up to it).
@JFreegman Thank you for responding.
Can you try compiling with the c11 or gnu11 standard and see if that fixes it?
Perhaps the build system should pass the required standard rather than a user being in need of guessing it? We used C99, because a higher standard was not asked for.
Edit: If that's not possible or doesn't work, the
_Static_assert
macro is considered deprecated,
This is not exactly the case; it is considered deprecated only in C23. C23 would be a rather radical requirement, given that otherwise this builds fine with C99.
so I'd prefer you to put those static asserts inside an
#ifdef __APPLE__
clause (or create a custom wrapper macro if you're up to it).
Maybe this will work and satisfy everyone? https://github.com/python/cpython/blob/v3.12.1/Include/pymacro.h#L20-L24 I am unsure where it is better to place it though.
@barracuda156
Perhaps the build system should pass the required standard rather than a user being in need of guessing it? We used C99, because a higher standard was not asked for.
Toxic's build system is a simple Makefile, which uses c11 by default. It looks like the mac port is overriding the Makefile's settings, in which case there's nothing I can really about it. I can only strongly recommend compiling with the same flags that we have set in our Makefile, but I can't force it.
Maybe this will work and satisfy everyone? https://github.com/python/cpython/blob/v3.12.1/Include/pymacro.h#L20-L24 I am unsure where it is better to place it though.
That looks reasonable. You could put it in toxic.h
. You'll need to include assert.h above the new macro, and remove the assert.h header from (edit: actually you can leave those)conference.c
, settings.c
and notify.c
@JFreegman Sure, I will set it to C11 then, though I am not sure at the moment why flags were dropped. Normally compiler.c_standard
value does not enforce the standard (and should not override anything), but merely affects compiler choice (I believe, with Xcode 3.x setting to 1999 will rule out gcc-4.0, so inconsequential otherwise). Both compilers used (which produced failures reported here) support at least up to C20 and likely C23.
Also, when you're ready to implement your changes, could you please close this PR and open it in the toktok repo?
@JFreegman Ok, sure. I will get back to this soonish.
UPD. Okay, I know why we had C99: it was needed for gcc-4.2
and previously inconsequential for newer compilers, so it was added unconditionally into Darwin config. Now that has to be changed, of course.
Closing, since moved to https://github.com/TokTok/toxic/pull/358
Current code does not build: tested on macOS 14.3.1 with Clang and macOS 10.6 with GCC.
On Sonoma it fails like:
On macOS 10.6
static_assert
is not defined inassert.h
, so the build fails due to that._Static_assert
works fine on both, however.