qt4-moc: Add more Boost include guards to moc's definition list.

In preparation for updating Boost to 1.60, add include guards from more Boost
headers to the list of macros that moc automatically defines when processing
files. As explained in r408911, Qt4's moc cannot parse some constructs used by
a few Boost headers, so we define their include guards to make moc skip them.

This is a cleaner approach that allows us to largely revert r408472, r408473,
r408474, r408475, r408502, r408773 and r408419, which added several patches to
many ports to work around this moc bug.

PR:		199601
PR:		208322
This commit is contained in:
Raphael Kubo da Costa 2016-03-24 10:31:07 +00:00
parent baac3115e0
commit 47bf224484
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=411765
25 changed files with 5 additions and 325 deletions

View file

@ -1,15 +0,0 @@
--- src/core/mergedproxymodel.h.orig 2014-04-23 10:16:44 UTC
+++ src/core/mergedproxymodel.h
@@ -25,10 +25,12 @@
using std::placeholders::_1;
using std::placeholders::_2;
+#ifndef Q_MOC_RUN
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/hashed_index.hpp>
+#endif
using boost::multi_index::multi_index_container;
using boost::multi_index::indexed_by;

View file

@ -1,14 +0,0 @@
--- src/library/groupbydialog.h.orig 2014-04-23 10:16:44 UTC
+++ src/library/groupbydialog.h
@@ -25,9 +25,11 @@
using std::placeholders::_1;
using std::placeholders::_2;
+#ifndef Q_MOC_RUN
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>
+#endif
#include "librarymodel.h"

View file

@ -1,14 +0,0 @@
--- src/colormap.h.orig 2015-03-05 16:25:10 UTC
+++ src/colormap.h
@@ -5,9 +5,11 @@
#include <list>
#include "linalg.h"
+#ifndef Q_MOC_RUN
#include <boost/shared_ptr.hpp>
#include <boost/filesystem.hpp>
#include <boost/property_tree/ptree.hpp>
+#endif
namespace fs = boost::filesystem;

View file

@ -1,14 +0,0 @@
--- src/scintillaeditor.h.orig 2015-03-05 20:25:13 UTC
+++ src/scintillaeditor.h
@@ -11,9 +11,11 @@
#include "scadlexer.h"
#include "parsersettings.h"
+#ifndef Q_MOC_RUN
#include <boost/shared_ptr.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
+#endif
class EditorColorScheme
{

View file

@ -10,7 +10,7 @@ What we do to work around the issue is define some Boost include guards so that
they end up being skipped by moc when it is preprocessing a file.
--- src/tools/moc/main.cpp.orig 2015-05-07 14:14:44 UTC
+++ src/tools/moc/main.cpp
@@ -190,6 +190,13 @@ int runMoc(int _argc, char **_argv)
@@ -190,6 +190,17 @@ int runMoc(int _argc, char **_argv)
// Workaround a bug while parsing the boost/type_traits/has_operator.hpp header. See QTBUG-22829
pp.macros["BOOST_TT_HAS_OPERATOR_HPP_INCLUDED"];
@ -21,6 +21,10 @@ they end up being skipped by moc when it is preprocessing a file.
+ //
+ // For Boost >= 1.55.
+ pp.macros["BOOST_LEXICAL_CAST_INCLUDED"];
+ // For Boost >= 1.60.
+ pp.macros["BOOST_NEXT_PRIOR_HPP_INCLUDED"];
+ pp.macros["BOOST_TYPE_TRAITS_HPP"];
+ pp.macros["BOOST_TT_HAS_PRE_INCREMENT_HPP_INCLUDED"];
QByteArray filename;
QByteArray output;

View file

@ -1,12 +0,0 @@
--- include/aqsis/tex/buffers/channellist.h.orig 2012-08-24 12:26:50 UTC
+++ include/aqsis/tex/buffers/channellist.h
@@ -43,7 +43,9 @@
#include <iosfwd>
#include <vector>
+#ifndef Q_MOC_RUN
#include <boost/format.hpp>
+#endif
#include <aqsis/tex/buffers/channelinfo.h>
#include <aqsis/tex/texexception.h>

View file

@ -1,14 +0,0 @@
--- include/aqsis/tex/buffers/mixedimagebuffer.h.orig 2012-08-24 12:26:50 UTC
+++ include/aqsis/tex/buffers/mixedimagebuffer.h
@@ -45,9 +45,11 @@
#include <string>
#include <vector>
+#ifndef Q_MOC_RUN
#include <boost/shared_array.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
+#endif
#include <aqsis/math/math.h>
#include <aqsis/tex/buffers/channellist.h>

View file

@ -1,12 +0,0 @@
--- include/aqsis/util/socket.h.orig 2012-08-24 12:26:50 UTC
+++ include/aqsis/util/socket.h
@@ -32,7 +32,9 @@
#include <sstream>
+#ifndef Q_MOC_RUN
#include <boost/utility.hpp>
+#endif
#ifdef AQSIS_SYSTEM_WIN32
# include <winsock2.h>

View file

@ -1,16 +0,0 @@
--- tools/piqsl/displayserverimage.cpp.orig 2012-08-24 12:26:50 UTC
+++ tools/piqsl/displayserverimage.cpp
@@ -39,11 +39,13 @@
#include <map>
#include <algorithm>
+#ifndef Q_MOC_RUN
#include <boost/archive/iterators/base64_from_binary.hpp>
#include <boost/archive/iterators/transform_width.hpp>
#include <boost/archive/iterators/insert_linebreaks.hpp>
#include <boost/format.hpp>
#include <boost/filesystem.hpp>
+#endif
#include "displayserverimage.h"

View file

@ -1,15 +0,0 @@
--- tools/piqsl/image.h.orig 2012-08-24 12:26:50 UTC
+++ tools/piqsl/image.h
@@ -46,10 +46,12 @@
#include <QtCore/QObject>
#include <QtGui/QImage>
+#ifndef Q_MOC_RUN
#include <boost/shared_ptr.hpp>
#include <boost/shared_array.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/thread/mutex.hpp>
+#endif
#include "tinyxml.h"

View file

@ -1,18 +0,0 @@
--- libfunction/useful.h.orig 2013-01-26 12:49:04 UTC
+++ libfunction/useful.h
@@ -40,6 +40,7 @@
#include <sstream>
#include <vector>
+#ifndef Q_MOC_RUN
#include <boost/array.hpp>
#include <boost/ptr_container/ptr_map.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
@@ -49,6 +50,7 @@
#include <boost/tuple/tuple.hpp>
#include <boost/utility.hpp>
#include <boost/version.hpp>
+#endif
//! Convenience typedef.
typedef unsigned int uint;

View file

@ -1,16 +0,0 @@
--- src/QGlib/connect.cpp.orig 2013-10-14 08:44:40 UTC
+++ src/QGlib/connect.cpp
@@ -20,10 +20,13 @@
#include <glib-object.h>
#include <QtCore/QHash>
#include <QtCore/QMutex>
+
+#ifndef Q_MOC_RUN
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/member.hpp>
+#endif
namespace QGlib {
namespace Private {

View file

@ -1,14 +0,0 @@
--- src/QGlib/connect.h.orig 2013-10-14 08:44:40 UTC
+++ src/QGlib/connect.h
@@ -25,8 +25,11 @@
#include <QtCore/QSharedPointer>
#include <QtCore/QFlags>
#include <QtCore/QHash>
+
+#ifndef Q_MOC_RUN
#include <boost/type_traits.hpp>
#include <boost/utility/enable_if.hpp>
+#endif
namespace QGlib {

View file

@ -1,12 +0,0 @@
--- src/QGlib/connectimpl.h.orig 2013-10-14 08:44:40 UTC
+++ src/QGlib/connectimpl.h
@@ -26,7 +26,9 @@
# include "refpointer.h"
# include <QtCore/QList>
# include <stdexcept>
+#ifndef Q_MOC_RUN
# include <boost/type_traits.hpp>
+#endif
namespace QGlib {

View file

@ -1,13 +0,0 @@
--- src/QGlib/refpointer.h.orig 2013-10-14 08:44:40 UTC
+++ src/QGlib/refpointer.h
@@ -23,8 +23,10 @@
#include "type.h"
#include "wrap.h"
#include <cstddef>
+#ifndef Q_MOC_RUN
#include <boost/type_traits.hpp>
#include <boost/utility/enable_if.hpp>
+#endif
#include <QtCore/QHash>
namespace QGlib {

View file

@ -1,12 +0,0 @@
--- src/QGlib/type.h.orig 2013-10-14 08:44:40 UTC
+++ src/QGlib/type.h
@@ -21,7 +21,9 @@
#include "global.h"
#include <QtCore/QList>
+#ifndef Q_MOC_RUN
#include <boost/mpl/if.hpp>
+#endif
/*
* This is a re-definition of GType inside the QGlib::Private namespace.

View file

@ -1,13 +0,0 @@
--- src/QGlib/value.h.orig 2013-10-14 08:44:40 UTC
+++ src/QGlib/value.h
@@ -23,8 +23,10 @@
#include "type.h"
#include "refpointer.h"
#include "error.h"
+#ifndef Q_MOC_RUN
#include <boost/mpl/if.hpp>
#include <boost/type_traits.hpp>
+#endif
#include <stdexcept>
#include <QtCore/QString>
#include <QtCore/QDebug>

View file

@ -1,12 +0,0 @@
--- src/allocators.h.orig 2014-12-18 14:47:02 UTC
+++ src/allocators.h
@@ -7,7 +7,9 @@
#include <string.h>
#include <string>
+#ifndef Q_MOC_RUN
#include <boost/thread/mutex.hpp>
+#endif
#include <map>
#include <openssl/crypto.h> // for OPENSSL_cleanse()

View file

@ -1,12 +0,0 @@
--- src/qt/guiutil.h.orig 2014-12-18 14:47:02 UTC
+++ src/qt/guiutil.h
@@ -5,7 +5,9 @@
#include <QObject>
#include <QMessageBox>
+#ifndef Q_MOC_RUN
#include <boost/filesystem.hpp>
+#endif
class SendCoinsRecipient;

View file

@ -1,16 +0,0 @@
--- src/util.h.orig 2014-12-18 14:47:02 UTC
+++ src/util.h
@@ -15,11 +15,13 @@
#include <vector>
#include <string>
+#ifndef Q_MOC_RUN
#include <boost/version.hpp>
#include <boost/thread.hpp>
#include <boost/interprocess/sync/interprocess_recursive_mutex.hpp>
#include <boost/date_time/gregorian/gregorian_types.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
+#endif
#include <openssl/sha.h>
#include <openssl/ripemd.h>

View file

@ -1,12 +0,0 @@
--- libavogadro/src/pythonengine_p.h.orig 2013-12-06 15:50:04 UTC
+++ libavogadro/src/pythonengine_p.h
@@ -27,7 +27,9 @@
#include <avogadro/global.h>
#include <avogadro/engine.h>
+#ifndef Q_MOC_RUN
#include <boost/python.hpp>
+#endif
namespace Avogadro {

View file

@ -1,12 +0,0 @@
--- libavogadro/src/pythonextension_p.h.orig 2013-12-06 15:50:04 UTC
+++ libavogadro/src/pythonextension_p.h
@@ -29,7 +29,9 @@
#include <avogadro/extension.h>
#include <avogadro/primitive.h>
#include <avogadro/glwidget.h>
+#ifndef Q_MOC_RUN
#include <boost/python.hpp>
+#endif
#include <QWidget>
#include <QList>

View file

@ -1,12 +0,0 @@
--- libavogadro/src/pythoninterpreter.h.orig 2013-12-06 15:50:04 UTC
+++ libavogadro/src/pythoninterpreter.h
@@ -26,7 +26,9 @@
#define PYTHONINTERPRETER_H
#include <avogadro/global.h>
+#ifndef Q_MOC_RUN
#include <boost/python.hpp>
+#endif
#include <avogadro/primitive.h>
#include <QString>

View file

@ -1,12 +0,0 @@
--- libavogadro/src/pythonscript.h.orig 2013-12-06 15:50:04 UTC
+++ libavogadro/src/pythonscript.h
@@ -27,7 +27,9 @@
#define PYTHONSCRIPT_H
#include <avogadro/global.h>
+#ifndef Q_MOC_RUN
#include <boost/python.hpp>
+#endif
#include "pythonerror.h"

View file

@ -1,12 +0,0 @@
--- libavogadro/src/pythontool_p.h.orig 2013-12-06 15:50:04 UTC
+++ libavogadro/src/pythontool_p.h
@@ -27,7 +27,9 @@
#include <avogadro/global.h>
#include <avogadro/tool.h>
+#ifndef Q_MOC_RUN
#include <boost/python.hpp>
+#endif
#include <QObject>
#include <QAction>