summaryrefslogtreecommitdiff
path: root/gcc/system.h
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-20 19:22:02 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-20 19:22:02 +0000
commitd66013038cc6b1768ed1692da342bc7fa32d45e7 (patch)
treed9f6cf10c4f9df22896b22cf0f3e699758688de2 /gcc/system.h
parentef9d41fcb6be36d542126b39f8ec156fe30c9250 (diff)
downloadgcc-d66013038cc6b1768ed1692da342bc7fa32d45e7.tar.gz
* system.h: Include <cstdlib> as well as <stdlib.h>.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200265 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/system.h')
-rw-r--r--gcc/system.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/system.h b/gcc/system.h
index 41cd565538a..f10ba4a0e81 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -226,6 +226,14 @@ extern int errno;
# include <stdlib.h>
#endif
+/* When compiling C++ we need to include <cstdlib> as well as <stdlib.h> so
+ that it is processed before we poison "malloc"; otherwise, if a source
+ file uses a standard library header that includes <cstdlib>, we will get
+ an error about 'using std::malloc'. */
+#ifdef __cplusplus
+#include <cstdlib>
+#endif
+
/* Undef vec_free from AIX stdlib.h header which conflicts with vec.h. */
#undef vec_free