summaryrefslogtreecommitdiffstats
path: root/src/tools/tracegen/panic.cpp
blob: fa4e6b3ee3176f9293b57c0df3e7581c8b2ceb96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Rafael Roquetto <rafael.roquetto@kdab.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "panic.h"

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

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

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

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

    fputc('\n', stderr);

    exit(EXIT_FAILURE);
}