Closed clbr closed 1 year ago
hashmap.h includes <assert.h>
, which defines the static_assert
macro in C11 and C17. What's your system/platform?
assert.h comes from glibc, not gcc. This system's glibc is older and its assert.h does not define that.
Then your system glibc is not C11 compliant (or so not enough compliant for rgbds). glibc added the static_assert macro over 11 years ago, you really should upgrade.
The GBC was released 25 years ago ;)
It's fine to close this if you don't want to support older setups, this would be a simple change though.
The issue is that this is a bottomless pit of mini-fixes. "Older setups" can mean all sorts of non-conforming things, not just this one. How long until someone comes around with their copy of GCC 2.95 and asks why it can't build RGBDS?
Your problem can be trivially solved by putting conformant headers in your include path, anyway.
(And anyway, the issue title is misleading — the GCC version has nothing to do with anything here. You knew this, as you diagnosed the issue yourself, so why did you put it there?)
I can send a PR if it's an issue of who does the work?
Oh, you edited the post. I put in the gcc version because otherwise you'd have complained I must have been using a too old gcc, obviously.
You're using glibc version that came out before gcc even had _Static_assert implemented in the first place. You're using a dramatically newer compiler compared the glibc version you have.
Oh, you edited the post. I put in the gcc version because otherwise you'd have complained I must have been using a too old gcc, obviously.
You're using an ancient toolchain. It's just that it's a different part of the toolchain causing the problem.
Yes. Do you want to close this or me to send a PR?
Tbh, the change is minimal (adding an underscore and capitalising one letter), so I'm fine with a change being submitted to increase compat ever so slightly. (As long as it doesn't break anyone else, hopefully.)
Tbh, the change is minimal (adding an underscore and capitalising one letter), so I'm fine with a change being submitted to increase compat ever so slightly. (As long as it doesn't break anyone else, hopefully.)
It shouldn't break any builds, as _Static_assert
is a keyword from C99 on. (C23 will introduce static_assert
as a keyword, but without removing the existing one.)
The worst it could do is break somebody trying to include the header in a C++ context (no _Static_assert there, only static_assert), but that'd be dumb here, you have std::unordered_map
in C++ (and hashmap.h isn't included in any other headers).
Oh, if it's becoming a keyword, then nothing needs to be done. At that point gcc would handle it internally, and such upgraded systems would work fine with it. Closing.
Changing static_assert to _Static_assert fixes the build.