summaryrefslogtreecommitdiffstats
path: root/src/tools/tracepointgen/tracepointgen.h
blob: 6aed3dc5747de8ea4bd7e9c107fbb5a300029866 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifndef TRACEPOINTGEN_H
#define TRACEPOINTGEN_H

#include <cstdarg>
#include <cstdio>
#include <cstdlib>

#define DEBUG_TRACEPOINTGEN 0

#if DEBUG_TRACEPOINTGEN > 0
    #define DEBUGPRINTF(x) x
    #if (DEBUG_TRACEPOINTGEN > 1)
        #define DEBUGPRINTF2(x) x
    #else
        #define DEBUGPRINTF2(x)
    #endif
#else
    #define DEBUGPRINTF(x)
    #define DEBUGPRINTF2(x)
#endif



inline void panic(const char *fmt, ...)
{
    va_list ap;

    fprintf(stderr, "tracepointgen: fatal: ");

    va_start(ap, fmt);
    vfprintf(stderr, fmt, ap);
    va_end(ap);

    fputc('\n', stderr);

    exit(EXIT_FAILURE);
}

#endif