tracegen: Add common prologue
Add common prologue and add error message when tracing is used in a module that doesn't have Q_TRACEPOINT enabled, but tracing is enabled. Change-Id: I64ca074942f6e89b4f5b5e3b6048b2b713c06df8 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> (cherry picked from commit 257b3161c5c5e46cd040371da77cb6a06987cf50) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
a49b768a70
commit
3c06bf1432
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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";
|
||||
|
Loading…
x
Reference in New Issue
Block a user