diff options
| -rw-r--r-- | src/tools/tracegen/ctf.cpp | 1 | ||||
| -rw-r--r-- | src/tools/tracegen/etw.cpp | 1 | ||||
| -rw-r--r-- | src/tools/tracegen/helpers.cpp | 9 | ||||
| -rw-r--r-- | src/tools/tracegen/helpers.h | 3 | ||||
| -rw-r--r-- | src/tools/tracegen/lttng.cpp | 1 |
5 files changed, 15 insertions, 0 deletions
diff --git a/src/tools/tracegen/ctf.cpp b/src/tools/tracegen/ctf.cpp index 5a3902dd71..03de8a5f15 100644 --- a/src/tools/tracegen/ctf.cpp +++ b/src/tools/tracegen/ctf.cpp @@ -15,6 +15,7 @@ static void writePrologue(QTextStream &stream, const QString &fileName, const Provider &provider) { + writeCommonPrologue(stream); const QString guard = includeGuard(fileName); // include prefix text or qt headers only once diff --git a/src/tools/tracegen/etw.cpp b/src/tools/tracegen/etw.cpp index 0bf8d0e2d2..0ae58f9dac 100644 --- a/src/tools/tracegen/etw.cpp +++ b/src/tools/tracegen/etw.cpp @@ -104,6 +104,7 @@ static QString createGuid(const QUuid &uuid) static void writePrologue(QTextStream &stream, const QString &fileName, const Provider &provider) { + writeCommonPrologue(stream); QUuid uuid = QUuid::createUuidV5(QUuid(), provider.name.toLocal8Bit()); const QString providerV = providerVar(provider.name); diff --git a/src/tools/tracegen/helpers.cpp b/src/tools/tracegen/helpers.cpp index db0fdb142e..c65c57abe3 100644 --- a/src/tools/tracegen/helpers.cpp +++ b/src/tools/tracegen/helpers.cpp @@ -6,6 +6,15 @@ using namespace Qt::StringLiterals; +void writeCommonPrologue(QTextStream &stream) +{ + stream << R"CPP( +#ifndef Q_TRACEPOINT +#error "Q_TRACEPOINT not set for the module, Q_TRACE not enabled." +#endif +)CPP"; +} + QString typeToTypeName(const QString &name) { QString ret = name; diff --git a/src/tools/tracegen/helpers.h b/src/tools/tracegen/helpers.h index 00a1f99686..45156b4361 100644 --- a/src/tools/tracegen/helpers.h +++ b/src/tools/tracegen/helpers.h @@ -8,6 +8,7 @@ #include <qlist.h> #include <qstring.h> +#include <qtextstream.h> enum ParamType { LTTNG, @@ -20,6 +21,8 @@ QString includeGuard(const QString &filename); QString formatFunctionSignature(const QList<Tracepoint::Argument> &args); QString formatParameterList(const Provider &provider, const QList<Tracepoint::Argument> &args, const QList<Tracepoint::Field> &fields, ParamType type); +void writeCommonPrologue(QTextStream &stream); + template <typename T> static QString aggregateListValues(int value, const QList<T> &list) { diff --git a/src/tools/tracegen/lttng.cpp b/src/tools/tracegen/lttng.cpp index ff94bba3f3..c37e3dd9a8 100644 --- a/src/tools/tracegen/lttng.cpp +++ b/src/tools/tracegen/lttng.cpp @@ -101,6 +101,7 @@ static void writeCtfMacro(QTextStream &stream, const Provider &provider, const T static void writePrologue(QTextStream &stream, const QString &fileName, const Provider &provider) { + writeCommonPrologue(stream); const QString guard = includeGuard(fileName); stream << "#undef TRACEPOINT_PROVIDER\n"; |
