Hello,

Earlier this the following was committed:

2013-06-20  Oleg Endo  <olege...@gcc.gnu.org>
            Jason Merrill  <ja...@redhat.com>

        * system.h: Include <cstdlib> as well as <stdlib.h>.

... so that things like <algorithm> could be included after including
system.h.
Some days ago I've tried building an SH cross-GCC on OSX 10.9 with the
latest XCode (clang) tools and its libc++ std lib.  Some of the libc++
headers use malloc, realloc etc, which are poisoned in system.h.  In
this particular case the problem is triggered by the inclusion of
<sstream> in sh.c, but there are more headers which show the same
problem (e.g. <ostream>).

Is the malloc, realloc poisoning actually still useful/helpful?  After
all it can be easily circumvented by doing
  "new char[my_size]" ...

A simple fix is to include C++ std headers before including system.h,
which works for .c/.cc files, but might become problematic if things
like <ostream> are included in headers in the future.

Anyway, just wanted to report my findings regarding this issue.

Cheers,
Oleg



Reply via email to