00001 /* Copyright (C) 2005, 2009 Free Software Foundation, Inc. 00002 Contributed by Richard Henderson <rth@redhat.com>. 00003 00004 This file is part of the GNU OpenMP Library (libgomp). 00005 00006 Libgomp is free software; you can redistribute it and/or modify it 00007 under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 3, or (at your option) 00009 any later version. 00010 00011 Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY 00012 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00013 FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00014 more details. 00015 00016 Under Section 7 of GPL version 3, you are granted additional 00017 permissions described in the GCC Runtime Library Exception, version 00018 3.1, as published by the Free Software Foundation. 00019 00020 You should have received a copy of the GNU General Public License and 00021 a copy of the GCC Runtime Library Exception along with this program; 00022 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00023 <http://www.gnu.org/licenses/>. */ 00024 00025 /* This file contains routines used to signal errors. Most places in the 00026 OpenMP API do not make any provision for failure, so we can't just 00027 defer the decision on reporting the problem to the user; we must do it 00028 ourselves or not at all. */ 00029 /* ??? Is this about what other implementations do? Assume stderr hasn't 00030 been pointed somewhere unsafe? */ 00031 00032 #include "libgomp.h" 00033 #include <stdarg.h> 00034 #include <stdio.h> 00035 #include <stdlib.h> 00036 00037 00038 static void 00039 gomp_verror (const char *fmt, va_list list) 00040 { 00041 fputs ("\nlibgomp: ", stderr); 00042 vfprintf (stderr, fmt, list); 00043 fputc ('\n', stderr); 00044 } 00045 00046 void 00047 gomp_error (const char *fmt, ...) 00048 { 00049 va_list list; 00050 00051 va_start (list, fmt); 00052 gomp_verror (fmt, list); 00053 va_end (list); 00054 } 00055 00056 void 00057 gomp_fatal (const char *fmt, ...) 00058 { 00059 va_list list; 00060 00061 va_start (list, fmt); 00062 gomp_verror (fmt, list); 00063 va_end (list); 00064 00065 exit (EXIT_FAILURE); 00066 }