diff options
Diffstat (limited to 'src/tools/tracepointgen/tracepointgen.h')
-rw-r--r-- | src/tools/tracepointgen/tracepointgen.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/tools/tracepointgen/tracepointgen.h b/src/tools/tracepointgen/tracepointgen.h new file mode 100644 index 0000000000..6aed3dc574 --- /dev/null +++ b/src/tools/tracepointgen/tracepointgen.h @@ -0,0 +1,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 |