-/* Copyright (C) 2005-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2023 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
- This file is part of the GNU OpenMP Library (libgomp).
+ This file is part of the GNU Offloading and Multi Processing Library
+ (libgomp).
Libgomp is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
#include <stdlib.h>
-static void
+#undef gomp_vdebug
+void
+gomp_vdebug (int kind __attribute__ ((unused)), const char *msg, va_list list)
+{
+ if (gomp_debug_var)
+ vfprintf (stderr, msg, list);
+}
+
+#undef gomp_debug
+void
+gomp_debug (int kind, const char *msg, ...)
+{
+ va_list list;
+
+ va_start (list, msg);
+ gomp_vdebug (kind, msg, list);
+ va_end (list);
+}
+
+void
gomp_verror (const char *fmt, va_list list)
{
fputs ("\nlibgomp: ", stderr);
va_end (list);
}
+void
+gomp_vfatal (const char *fmt, va_list list)
+{
+ gomp_verror (fmt, list);
+ exit (EXIT_FAILURE);
+}
+
void
gomp_fatal (const char *fmt, ...)
{
va_list list;
va_start (list, fmt);
- gomp_verror (fmt, list);
+ gomp_vfatal (fmt, list);
va_end (list);
+}
- exit (EXIT_FAILURE);
+void
+GOMP_warning (const char *msg, size_t msglen)
+{
+ if (msg && msglen == (size_t) -1)
+ gomp_error ("error directive encountered: %s", msg);
+ else if (msg)
+ {
+ fputs ("\nlibgomp: error directive encountered: ", stderr);
+ fwrite (msg, 1, msglen, stderr);
+ fputc ('\n', stderr);
+ }
+ else
+ gomp_error ("error directive encountered");
+}
+
+void
+GOMP_error (const char *msg, size_t msglen)
+{
+ if (msg && msglen == (size_t) -1)
+ gomp_fatal ("fatal error: error directive encountered: %s", msg);
+ else if (msg)
+ {
+ fputs ("\nlibgomp: fatal error: error directive encountered: ", stderr);
+ fwrite (msg, 1, msglen, stderr);
+ fputc ('\n', stderr);
+ exit (EXIT_FAILURE);
+ }
+ else
+ gomp_fatal ("fatal error: error directive encountered");
}