1 | //===-- lib/Common/idioms.cpp ---------------------------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #include "flang/Common/idioms.h" |
10 | #include <cstdarg> |
11 | #include <cstdio> |
12 | #include <cstdlib> |
13 | |
14 | namespace Fortran::common { |
15 | |
16 | [[noreturn]] void die(const char *msg, ...) { |
17 | va_list ap; |
18 | va_start(ap, msg); |
19 | std::fputs(s: "\nfatal internal error: " , stderr); |
20 | std::vfprintf(stderr, format: msg, arg: ap); |
21 | va_end(ap); |
22 | fputc(c: '\n', stderr); |
23 | std::abort(); |
24 | } |
25 | |
26 | } // namespace Fortran::common |
27 | |