Dear Ron,
Am Freitag, den 17.03.2017, 22:51 +0000 schrieb ron minnich:
On Fri, Mar 17, 2017 at 3:32 PM Paul Menzel wrote:
I think there is no objection to move to C11, if somebody rewrites the code using GNU11 extensions.
Paul, the discussion I read made it clear that there were lots of objections to moving away from GNU11 extensions, viz.
There are many GNU extensions which are simply necessary to write sane, readable and performant code (e.g. to implement non-double-evaluating MIN()/MAX() macros, to cleanly control linking into particular sections, to get performant code generated for IO accessor functions, etc.). The C standard by itself is simply insufficient to support all systems programming use cases, and if we forbade GNU extensions we'd have to rewrite significant parts of coreboot in pure assembly and add weird, hardly readable workarounds for many code patterns. "
Now, I don't actually agree with all this, but the decision was made to go with GNU11, not C11.
You quoted Julius’ reply [1]. Later he also replied [2].
Yes, just to be clear (this has split into so many different threads that I'm no longer sure what the latest decision is?), I only (prematurely) objected to forbidding GNU extensions. Otherwise, I'm totally in favor of switching to C11 and not aware of any difference between the versions that would cause a problem for us.
So I still believe, that the “move away from GNU11 discussion” didn’t come to a conclusion, as that wasn’t the topic of the thread. So no decision was made. At least not announced publicly.
Thanks,
Paul
[1] https://www.coreboot.org/pipermail/coreboot/2016-November/082576.html [2] https://www.coreboot.org/pipermail/coreboot/2016-December/082588.html
On Fri, Mar 17, 2017 at 4:14 PM Paul Menzel via coreboot < coreboot@coreboot.org> wrote:
So I still believe, that the “move away from GNU11 discussion” didn’t come to a conclusion, as that wasn’t the topic of the thread. So no decision was made. At least not announced publicly.
OK, got it, thanks for clearing me up. I was pretty confused myself!
ron
You quoted Julius’ reply [1]. Later he also replied [2].
Yes, just to be clear (this has split into so many different threads that I'm no longer sure what the latest decision is?), I only (prematurely) objected to forbidding GNU extensions. Otherwise, I'm totally in favor of switching to C11 and not aware of any difference between the versions that would cause a problem for us.
Just to clarify what I meant, "switching to C11" was in the context of "away from C89" here. When I wrote C11 I essentially meant -std=gnu11 there. I would still very much oppose enforcing a strict ISO C11 standard without any GNU extensions (for the reasons stated, and I'm sure I could come up with more when thinking about it enough). I just think that the C11 standard has way too many holes of things that you just can't solve well if you abide super strictly to the rules as specified, especially for low-level systems software like coreboot. Happy to join the discussion if you guys feel otherwise, of course.
Also (though I think someone already mentioned this?), just wanna point out that as far as I know clang already perfectly supports all of the GCC GNU extensions and special behavior we're using. So I think enforcing strict ISO C would only really make sense if we were also planning to support a specific compiler beyond GCC and clang, and that should probably be part of the discussion (i.e. which one and what benefits that would give us to outweigh all the reasons against it).