Add missing header guards

Change-Id: I515313289c0a4af0f675131760ad4ccd0c6e6149
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
Jędrzej Nowacki 2014-01-17 13:49:41 +01:00 committed by The Qt Project
parent 4dfc27728e
commit 71d265f592
39 changed files with 162 additions and 10 deletions

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef ASSIGN_NAMESPACE_H
#define ASSIGN_NAMESPACE_H
namespace A
{
namespace Nested
@ -50,3 +53,4 @@ namespace A
namespace Mine = Qt;
namespace Theirs = A::Nested::Space;
#endif // ASSIGN_NAMESPACE_H

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef BACKSLASH_NEWLINES_H
#define BACKSLASH_NEWLINES_H
#include <QObject>
const int blackslashNewlinesDummy = 0
@ -61,3 +64,4 @@ public slots:
#undef value
#endif // BACKSLASH_NEWLINES_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef C_COMMENTS_H
#define C_COMMENTS_H
#include <qobject.h>
/* test support for multi-line comments in preprocessor statements */
@ -53,3 +56,4 @@ public:
};
#endif
#endif // C_COMMENTS_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef CSTYLE_ENUMS_H
#define CSTYLE_ENUMS_H
#include <QObject>
class CStyleEnums
@ -48,3 +51,4 @@ public:
typedef enum { Foo, Bar } Baz;
};
#endif // CSTYLE_ENUMS_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef CXX11_ENUMS_H
#define CXX11_ENUMS_H
#include <QtCore/QObject>
#if defined(Q_COMPILER_CLASS_ENUM) || defined(Q_MOC_RUN)
@ -64,3 +67,4 @@ public:
enum TypedEnum { B0, B1 , B2, B3 };
};
#endif
#endif // CXX11_ENUMS_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef DIR_IN_INCLUDE_PATH_H
#define DIR_IN_INCLUDE_PATH_H
#include <Plugin>
class DirInIncludePath : public QObject, public MyInterface
@ -45,3 +48,4 @@ class DirInIncludePath : public QObject, public MyInterface
Q_OBJECT
Q_INTERFACES(MyInterface)
};
#endif // DIR_IN_INCLUDE_PATH_H

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef DOLLARS_H
#define DOLLARS_H
/* both GCC and clang allow $ in identifiers
* So moc should not throw a parse error if it parses a file that contains such identifiers
*/
@ -68,3 +71,4 @@ namespace $NS {
};
}
#endif // DOLLARS_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef ERROR_ON_WRONG_NOTIFY_H
#define ERROR_ON_WRONG_NOTIFY_H
#include <QObject>
class ClassWithWrongNOTIFY : public QObject
@ -51,3 +54,4 @@ public:
int foo() { return m_foo; }
};
#endif // ERROR_ON_WRONG_NOTIFY_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef ESCAPES_IN_STRING_LITERALS_H
#define ESCAPES_IN_STRING_LITERALS_H
#include <QObject>
class StringLiterals: public QObject
@ -47,3 +50,4 @@ class StringLiterals: public QObject
Q_CLASSINFO("Test2", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\123")
Q_CLASSINFO("Test3", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nb")
};
#endif // ESCAPES_IN_STRING_LITERALS_H

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef EXTRAQUALIFICATION_H
#define EXTRAQUALIFICATION_H
#include <QObject>
class Test : public QObject
@ -55,3 +58,4 @@ public slots:
public:
Q_SLOT void Test::anotherOne() {}
};
#endif // EXTRAQUALIFICATION_H

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef FORGOTTEN_QINTERFACE_H
#define FORGOTTEN_QINTERFACE_H
#include <QObject>
struct MyInterface
@ -53,3 +56,4 @@ class Test : public QObject, public MyInterface
{
Q_OBJECT
};
#endif // FORGOTTEN_QINTERFACE_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef FORWARD_DECLARED_PARAM_H
#define FORWARD_DECLARED_PARAM_H
#include <qobject.h>
#include <qmetatype.h>
@ -74,3 +77,4 @@ signals:
void signalQSet(const QSet<QString> &);
void signalQSet(const QSet<FullyDefined> &);
};
#endif // FORWARD_DECLARED_PARAM_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef FUNCTION_WITH_ATTRIBUTES_H
#define FUNCTION_WITH_ATTRIBUTES_H
#include <qobject.h>
// test support for gcc attributes with functions
@ -62,3 +65,4 @@ public slots:
DEPRECATED2 void test2() {}
};
#endif // FUNCTION_WITH_ATTRIBUTES_H

View File

@ -38,7 +38,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef INTERFACE_FROM-FRAMEWORK_H
#ifndef INTERFACE_FROM_FRAMEWORK_H
#define INTERFACE_FROM_FRAMEWORK_H
#include <Test/testinterface.h>

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef MACRO_ON_CMDLINE_H
#define MACRO_ON_CMDLINE_H
#if FOO
class Test : public QObject
@ -48,3 +51,4 @@ public:
};
#endif
#endif // MACRO_ON_CMDLINE_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef NAMESPACED_FLAGS_H
#define NAMESPACED_FLAGS_H
#include <QObject>
namespace Foo {
@ -78,3 +81,4 @@ namespace Foo {
}
Q_DECLARE_OPERATORS_FOR_FLAGS( Foo::Bar::Flags )
#endif // NAMESPACED_FLAGS_H

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef NO_KEYWORDS_H
#define NO_KEYWORDS_H
#define QT_NO_KEYWORDS
#undef signals
#undef slots
@ -85,3 +88,4 @@ private:
#define emit
#undef QT_NO_KEYWORDS
#endif // NO_KEYWORDS_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef OLDSTYLE_CASTS_H
#define OLDSTYLE_CASTS_H
#include <QtCore/qobject.h>
class Foo: public QObject
@ -54,3 +57,4 @@ public slots:
inline void slot(int, QObject * const) {}
};
#endif // OLDSTYLE_CASTS_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef PARSE_BOOST_H
#define PARSE_BOOST_H
#include <boost/aligned_storage.hpp>
#include <boost/any.hpp>
#include <boost/array.hpp>
@ -124,3 +127,4 @@
#include <boost/version.hpp>
#include <boost/visit_each.hpp>
#include <boost/weak_ptr.hpp>
#endif // PARSE_BOOST_H

View File

@ -39,4 +39,8 @@
**
****************************************************************************/
#ifndef PP_DOLLAR_SIGNS_H
#define PP_DOLLAR_SIGNS_H
$$ = parser->createFoo()
#endif // PP_DOLLAR_SIGNS_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef PURE_VIRTUAL_SIGNALS_H
#define PURE_VIRTUAL_SIGNALS_H
#include <QObject>
class PureVirtualSignalsTest : public QObject
@ -58,3 +61,4 @@ signals:
void mySignal();
void mySignal2(int foo);
};
#endif // PURE_VIRTUAL_SIGNALS_H

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef QINVOKABLE_H
#define QINVOKABLE_H
#include <QObject>
class InvokableBeforeReturnType : public QObject
@ -55,3 +58,4 @@ public:
Q_INVOKABLE inline void foo() {}
Q_INVOKABLE virtual void bar() {}
};
#endif // QINVOKABLE_H

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef QPRIVATESLOTS_H
#define QPRIVATESLOTS_H
#include <QObject>
struct TestQPrivateSlots_Private
@ -58,3 +61,4 @@ private:
TestQPrivateSlots_Private *d;
};
#endif // QPRIVATESLOTS_H

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef QTBUG_35657_GADGET_H
#define QTBUG_35657_GADGET_H
#include <QObject>
namespace QTBUG_35657 {
@ -49,3 +52,5 @@ namespace QTBUG_35657 {
enum SomeEnum { SomeEnumValue = 0 };
};
}
#endif // QTBUG_35657_GADGET_H

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef RELATED_METAOBJECTS_IN_GADGET_H
#define RELATED_METAOBJECTS_IN_GADGET_H
#include <QObject>
#include "qtbug-35657-gadget.h"
@ -52,3 +55,5 @@ namespace QTBUG_35657 {
A::SomeEnum blah() const { return A::SomeEnumValue; }
};
}
#endif // RELATED_METAOBJECTS_IN_GADGET_H

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef RELATED_METAOBJECTS_IN_NAMESPACES_H
#define RELATED_METAOBJECTS_IN_NAMESPACES_H
#include <QObject>
namespace QTBUG_2151 {
@ -58,3 +61,5 @@ namespace QTBUG_2151 {
A::SomeEnum blah() const { return A::SomeEnumValue; }
};
}
#endif // RELATED_METAOBJECTS_IN_NAMESPACES_H

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef SINGLE_QUOTE_DIGIT_SEPARATOR_N3781_H
#define SINGLE_QUOTE_DIGIT_SEPARATOR_N3781_H
#include <QObject>
class KDAB : public QObject
@ -56,3 +59,4 @@ public:
};
Q_ENUMS(Salaries)
};
#endif // SINGLE_QUOTE_DIGIT_SEPARATOR_N3781_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef SINGLE_FUNCTION_KEYWORD_H
#define SINGLE_FUNCTION_KEYWORD_H
#include <QObject>
class SingleFunctionKeywordBeforeReturnType : public QObject
@ -73,3 +76,4 @@ public:
inline Q_SLOT void mySlot() { emit mySignal(); }
};
#endif // SINGLE_FUNCTION_KEYWORD_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef SLOTS_WITH_VOID_TEMPLATE_H
#define SLOTS_WITH_VOID_TEMPLATE_H
#include <QObject>
template <typename T>
@ -59,3 +62,4 @@ signals:
void myVoidSignal();
void myVoidSignal2(void);
};
#endif // SLOTS_WITH_VOID_TEMPLATE_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef TASK192552_H
#define TASK192552_H
/*
<:: is not valid C++, but we want moc to treat it as < :: since this
is usually the intention
@ -53,3 +56,4 @@ public:
QList<::QObject*> m_objects;
#endif
};
#endif // TASK192552_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef TASK234909_H
#define TASK234909_H
#include <qobject.h>
namespace NS_A {
@ -71,3 +74,4 @@ namespace NS_Main {
}
}
#endif // TASK234909_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef TASK87883_H
#define TASK87883_H
/*
The bug is triggered only if there is a multiline comment after an #include
statement that in the following line contains a single quote but lacks a finishing
@ -55,3 +58,4 @@ public:
inline Task87883() {}
};
#endif // TASK87883_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef TEMPLATE_GTGT_H
#define TEMPLATE_GTGT_H
template<class TYPE, size_t COUNT>
class myTemplate :
QString,
@ -58,3 +61,4 @@ public:
{
}
};
#endif // TEMPLATE_GTGT_H

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef TRIGRAPHS_H
#define TRIGRAPHS_H
#include <QObject>
namespace AAA {
@ -61,3 +64,4 @@ namespace BBB {
};
}
#endif // TRIGRAPHS_H

View File

@ -692,8 +692,8 @@ void tst_Moc::warnOnExtraSignalSlotQualifiaction()
QVERIFY(!mocOut.isEmpty());
QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
QCOMPARE(mocWarning, header +
QString(":53: Warning: Function declaration Test::badFunctionDeclaration contains extra qualification. Ignoring as signal or slot.\n") +
header + QString(":56: Warning: parsemaybe: Function declaration Test::anotherOne contains extra qualification. Ignoring as signal or slot.\n"));
QString(":56: Warning: Function declaration Test::badFunctionDeclaration contains extra qualification. Ignoring as signal or slot.\n") +
header + QString(":59: Warning: parsemaybe: Function declaration Test::anotherOne contains extra qualification. Ignoring as signal or slot.\n"));
#else
QSKIP("Only tested on linux/gcc");
#endif
@ -971,7 +971,7 @@ void tst_Moc::warnOnMultipleInheritance()
QVERIFY(!mocOut.isEmpty());
QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
QCOMPARE(mocWarning, header +
QString(":53: Warning: Class Bar inherits from two QObject subclasses QWindow and Foo. This is not supported!\n"));
QString(":56: Warning: Class Bar inherits from two QObject subclasses QWindow and Foo. This is not supported!\n"));
#else
QSKIP("Only tested on linux/gcc");
#endif
@ -1034,7 +1034,7 @@ void tst_Moc::forgottenQInterface()
QVERIFY(!mocOut.isEmpty());
QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
QCOMPARE(mocWarning, header +
QString(":55: Warning: Class Test implements the interface MyInterface but does not list it in Q_INTERFACES. qobject_cast to MyInterface will not work!\n"));
QString(":58: Warning: Class Test implements the interface MyInterface but does not list it in Q_INTERFACES. qobject_cast to MyInterface will not work!\n"));
#else
QSKIP("Only tested on linux/gcc");
#endif
@ -1350,7 +1350,7 @@ void tst_Moc::warnOnPropertyWithoutREAD()
QVERIFY(!mocOut.isEmpty());
QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
QCOMPARE(mocWarning, header +
QString(":46: Warning: Property declaration foo has no READ accessor function or associated MEMBER variable. The property will be invalid.\n"));
QString(":49: Warning: Property declaration foo has no READ accessor function or associated MEMBER variable. The property will be invalid.\n"));
#else
QSKIP("Only tested on linux/gcc");
#endif
@ -1460,8 +1460,8 @@ void tst_Moc::warnOnVirtualSignal()
QByteArray mocOut = proc.readAllStandardOutput();
QVERIFY(!mocOut.isEmpty());
QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
QCOMPARE(mocWarning, header + QString(":48: Warning: Signals cannot be declared virtual\n") +
header + QString(":50: Warning: Signals cannot be declared virtual\n"));
QCOMPARE(mocWarning, header + QString(":51: Warning: Signals cannot be declared virtual\n") +
header + QString(":53: Warning: Signals cannot be declared virtual\n"));
#else
QSKIP("Only tested on linux/gcc");
#endif
@ -1575,7 +1575,7 @@ void tst_Moc::notifyError()
QVERIFY(mocOut.isEmpty());
QString mocError = QString::fromLocal8Bit(proc.readAllStandardError());
QCOMPARE(mocError, header +
QString(":52: Error: NOTIFY signal 'fooChanged' of property 'foo' does not exist in class ClassWithWrongNOTIFY.\n"));
QString(":55: Error: NOTIFY signal 'fooChanged' of property 'foo' does not exist in class ClassWithWrongNOTIFY.\n"));
#else
QSKIP("Only tested on linux/gcc");
#endif

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef UNTERMINATED_FUNCTION_MACRO_H
#define UNTERMINATED_FUNCTION_MACRO_H
class Dummy : public QObject {
Q_OBJECT
}
@ -49,3 +52,4 @@ static void foo() {
MACRO(foo
}
#endif // UNTERMINATED_FUNCTION_MACRO_H

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef USING_NAMESPACES_H
#define USING_NAMESPACES_H
namespace Foo {}
namespace Bar
{
@ -54,3 +57,4 @@ using namespace Foo;
using namespace Bar::Huh;
using namespace ::Top;
#endif // USING_NAMESPACES_H

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef WARN_ON_MULTIPLE_QOBJECT_SUBCLASSES_H
#define WARN_ON_MULTIPLE_QOBJECT_SUBCLASSES_H
#include <QtGui>
class Foo : public QObject
@ -53,3 +56,4 @@ class Bar : public QWindow, public Foo
};
#endif // WARN_ON_MULTIPLE_QOBJECT_SUBCLASSES_H

View File

@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef WARN_ON_PROPERTY_WITHOUT_READ_H
#define WARN_ON_PROPERTY_WITHOUT_READ_H
#include <QObject>
class ClassWithPropertyWithoutREAD : public QObject
@ -46,3 +49,4 @@ class ClassWithPropertyWithoutREAD : public QObject
Q_PROPERTY(int foo)
Q_PROPERTY(int bar READ bar)
};
#endif // WARN_ON_PROPERTY_WITHOUT_READ_H