Graphviz 12.0.1~dev.20240715.2254
Loading...
Searching...
No Matches
exit.h
Go to the documentation of this file.
1
3#pragma once
4
5#include <stdio.h>
6#include <stdlib.h>
7
8#ifdef __cplusplus
9#include <iostream>
10
11extern "C" {
12#endif
13
14#ifdef __GNUC__
15// FIXME: use _Noreturn for all compilers when we move to C11
16#define NORETURN __attribute__((noreturn))
17#elif defined(_MSC_VER)
18#define NORETURN __declspec(noreturn)
19#else
20#define NORETURN /* nothing */
21#endif
22
23static inline NORETURN void graphviz_exit(int status) {
24#ifdef _WIN32
25 // workaround for https://gitlab.com/graphviz/graphviz/-/issues/2178
26 fflush(stdout);
27 fflush(stderr);
28#ifdef __cplusplus
29 std::cout.flush();
30 std::cerr.flush();
31#endif
32#endif
33 exit(status);
34}
35
36#undef NORETURN
37
38#ifdef __cplusplus
39}
40#endif
static NORETURN void graphviz_exit(int status)
Definition exit.h:23
#define NORETURN
Definition exit.h:20