system.h: Include <cstdlib> as well as <stdlib.h>.
authorOleg Endo <oleg.endo@t-online.de>
Thu, 20 Jun 2013 19:22:02 +0000 (19:22 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 20 Jun 2013 19:22:02 +0000 (15:22 -0400)
* system.h: Include <cstdlib> as well as <stdlib.h>.

Co-Authored-By: Jason Merrill <jason@redhat.com>
From-SVN: r200265

gcc/ChangeLog
gcc/system.h

index 40a36c0df5a199932d276a5db2980f71b0276ec1..e3484bd5a4ee2585e5af64029c3c6a0bd7de08fd 100644 (file)
@@ -1,3 +1,8 @@
+2013-06-20  Oleg Endo <oleg.endo@t-online.de>
+           Jason Merrill  <jason@redhat.com>
+
+       * system.h: Include <cstdlib> as well as <stdlib.h>.
+
 2013-06-20  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/57655
index 41cd565538aecb039afea67a1f959df96cfa0c5b..f10ba4a0e8171e0a9e26adf009b1858ec20dd958 100644 (file)
@@ -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