An previous commit added the same function to cgraph/exit.h, but that
library is not supposed to be used when STANDALONE is defined.
Towards https://gitlab.com/graphviz/graphviz/-/issues/2178.
extern unsigned char Verbose;
#endif
+#ifdef __GNUC__
+// FIXME: use _Noreturn for all compilers when we move to C11
+#define NORETURN __attribute__((noreturn))
+#elif defined(_MSC_VER)
+#define NORETURN __declspec(noreturn)
+#else
+#define NORETURN /* nothing */
+#endif
+
+static inline NORETURN void graphviz_exit(int status) {
+#ifdef __MINGW32__
+ // workaround for https://gitlab.com/graphviz/graphviz/-/issues/2178
+ fflush(stdout);
+ fflush(stderr);
+#endif
+ exit(status);
+}
+
+#undef NORETURN
+
#else /* STANDALONE */
#define CALLOC gcalloc
#define MALLOC gmalloc