[PATCH] [libc++abi] Small #include directive cleanup
Matthew Dempsky
matthew at dempsky.org
Fri Jun 7 21:56:20 PDT 2013
Since cxa_exception.cpp only needs <string> for std::memset, it can
instead include just <cstring>. Also, cxa_demangle.cpp doesn't
actually need <algorithm>.
As a side effect of this cleanup, I'm able to build libc++abi on
OpenBSD using GCC 4.2.1 if I compile against libc++'s header files.
(Otherwise, libc++'s <algorithm> uses C++11 syntax that GCC 4.2.1
can't handle, and <string> includes <algorithm> too. And libstdc++
4.2.1's headers are missing some functionality needed by libc++abi.)
Not sure if that's really interesting since Clang is still needed to
build libc++, but removing unnecessary includes seems worthwhile
either way.
Index: src/cxa_exception.cpp
===================================================================
--- src/cxa_exception.cpp (revision 183600)
+++ src/cxa_exception.cpp (working copy)
@@ -15,7 +15,7 @@
#include <exception> // for std::terminate
#include <cstdlib> // for malloc, free
-#include <string> // for memset
+#include <cstring> // for memset
#include <pthread.h>
#include "cxa_exception.hpp"
Index: src/cxa_demangle.cpp
===================================================================
--- src/cxa_demangle.cpp (revision 183602)
+++ src/cxa_demangle.cpp (working copy)
@@ -14,7 +14,6 @@
#include <ctype.h>
#include <stdio.h>
#include <new>
-#include <algorithm>
#include <assert.h>
#ifdef DEBUGGING
More information about the cfe-commits
mailing list