<div class="gmail_quote">On Wed, Nov 17, 2010 at 11:33 AM, dalej <span dir="ltr"><<a href="mailto:dalej@apple.com">dalej@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
On Nov 17, 2010, at 10:39 AM, dalej wrote:<br>
>>>> clang-i386-darwin10 running the gcc testsuite developed 5 new failures (there are others, claimed by Rafael but not fixed) in the range 119343-119345 (build 1625).  That's Chandler and John; all the patches look unrelated to the failures to me, but obviously one of them isn't.<br>

<br>
John analyzed this as:<br>
<br>
>>> gcc.apple/default-x86_64-sse3.c has:<br>
>>> #include <pmmintrin.h><br>
<br>
...which eventually includes <mm_malloc.h>, a gcc-supplied header....<br>
<br>
>>> gcc's mm_malloc.h has:<br>
>>> #include <stdlib.h><br>
>>><br>
>>> After r119343, Clang's mm_malloc.h has:<br>
>>> #include <stddef.h><br>
>>><br>
>>> The test case contains a (spurious) call to exit().  Cue clang warning about exit() not being declared and dejagnu complaining about extra "errors".<br>
<br>
I said:<br>
<br>
> there's no reason <pmmintrin.h> should declare exit.  Test is broken, I'll fix.<br>
<br>
<br>
but on further consideration I'm not so sure.  gcc's *mmintrin.h files have been (indirectly) including <stdlib.h> forever, at least since 2004, and use of those headers is widespread in X86 code.  Removing <stdlib.h> breaks these 5 tests, and may well break user code.   I don't think these headers are covered by any standard, but I'm not seeing a good reason to break compatibility with gcc in this way.  Chandler, why did you do this?  Other opinions?</blockquote>
<div><br></div><div>Sorry this broke stuff. =/</div><div><br></div><div>My motivation for the change was quite simple: this is a builtin header file, and as such a minimal set of system header includes is preferable. None is even more preferable as it provides for the use of the header in a freestanding context. When I've discussed this header in the past, the sentiment from Chris and others was that there was a general trend in both GCC and Clang to reduce the number of system headers included by builtin headers.</div>
<div><br></div><div>I'd vote for continuing the trend. This isn't the first time it has happened (GCC dropped errno.h from mm_malloc.h not too long ago) and I can't imagine it will be the last. It's hard to argue that we should match GCC on this front when in fact, GCC is a moving target here, and moving in the same direction if at a different speed.</div>
<div><br></div><div>I also cannot come up with a principled reason why any code should expect an *mmintrin.h header to provide the definitions within stdlib.h. 'exit()' in particular just doesn't make sense. I think finding this bad code and fixing it is the correct approach.</div>
</div>