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 sarray2.h to build with gcc #22
Conversation
gcc does not allow arithmetic on const expressions (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53091), make data_size and data_mask #defines if compiling with gcc.
I've also added gcc to the travis build matrix to catch stuff like that. The tests don't build currently (which is kinda expected). I'm not sure whether I'm interested in sifting through them to see which ones we should be able to run with gcc… |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like this, as it's a work around for a gcc bug and is likely to mean that we carry around code supporting a buggy compiler that can't usefully build the runtime anyway (you need clang for the .m files to get a runtime that works sensibly with ARC)
sarray2.h
Outdated
static const uint32_t data_size = 256; | ||
#else | ||
#define data_size 256 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we at least make this (uint32_t)256
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely.
I don't have any particular interest in gcc as an Objective-C compiler either, but there is case to be made that libobjc2 still works as a drop-in replacement for the gcc runtime. That being said, I think it would be nice to deprecate gcc support in the 1.9.0 release, together with all the legacy runtime functions -- so that we can eventually remove them? |
I tried building with gcc a few months ago and almost all of the tests fail. I think it's too broken to support. |
Hi David,
gcc and clang disagree on to deal with const expressions in static initialisations (bug report here), so the sparse array code currently doesn't compile with gcc. Making data_size and data_mask #defines when not compiling with clang helps.