[PATCH] Turn off Qt including the C++ Standard Library headers

Thiago Macieira thiago at macieira.org
Thu Oct 3 13:34:50 UTC 2013


We don't use any of the Standard Library features or classes in
Subsurface, except for three uses of std::sort, for which I added the
necessary #include.

It's always a good idea to include directly the headers you want,
without relying on indirect inclusion

On my machine, the build time dropped from 16.96s to 13.38s or a 12%
improvement.

Signed-off-by: Thiago Macieira <thiago at macieira.org>
---
 Makefile              | 2 +-
 qt-ui/diveplanner.cpp | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 5258d3d..1e193eb 100644
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@ XSLTFILES = xslt/*.xslt xslt/*.xsl
 
 EXTRA_FLAGS =  $(QTCXXFLAGS) $(GTKCFLAGS) $(GLIB2CFLAGS) $(XML2CFLAGS) \
 	       $(LIBDIVECOMPUTERCFLAGS) \
-	       $(LIBSOUPCFLAGS) $(GCONF2CFLAGS) -I.
+	       $(LIBSOUPCFLAGS) $(GCONF2CFLAGS) -I. -DQT_NO_STL
 
 HEADERS = \
 	qt-ui/divelistview.h \
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 9178639..d183b4a 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -23,6 +23,8 @@
 #include <QTableView>
 #include <QColor>
 
+#include <algorithm>
+
 #define TIME_INITIAL_MAX 30
 
 #define MAX_DEPTH M_OR_FT(150, 450)
-- 
1.7.11.7



More information about the subsurface mailing list