1*86d7f5d3SJohn Marino /* GMP assertion failure handler.
2*86d7f5d3SJohn Marino
3*86d7f5d3SJohn Marino THE FUNCTIONS IN THIS FILE ARE FOR INTERNAL USE ONLY. THEY'RE ALMOST
4*86d7f5d3SJohn Marino CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
5*86d7f5d3SJohn Marino FUTURE GNU MP RELEASES.
6*86d7f5d3SJohn Marino
7*86d7f5d3SJohn Marino Copyright 2000, 2001 Free Software Foundation, Inc.
8*86d7f5d3SJohn Marino
9*86d7f5d3SJohn Marino This file is part of the GNU MP Library.
10*86d7f5d3SJohn Marino
11*86d7f5d3SJohn Marino The GNU MP Library is free software; you can redistribute it and/or modify
12*86d7f5d3SJohn Marino it under the terms of the GNU Lesser General Public License as published by
13*86d7f5d3SJohn Marino the Free Software Foundation; either version 3 of the License, or (at your
14*86d7f5d3SJohn Marino option) any later version.
15*86d7f5d3SJohn Marino
16*86d7f5d3SJohn Marino The GNU MP Library is distributed in the hope that it will be useful, but
17*86d7f5d3SJohn Marino WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18*86d7f5d3SJohn Marino or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
19*86d7f5d3SJohn Marino License for more details.
20*86d7f5d3SJohn Marino
21*86d7f5d3SJohn Marino You should have received a copy of the GNU Lesser General Public License
22*86d7f5d3SJohn Marino along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
23*86d7f5d3SJohn Marino
24*86d7f5d3SJohn Marino #include <stdio.h>
25*86d7f5d3SJohn Marino #include <stdlib.h>
26*86d7f5d3SJohn Marino #include "gmp.h"
27*86d7f5d3SJohn Marino #include "gmp-impl.h"
28*86d7f5d3SJohn Marino
29*86d7f5d3SJohn Marino
30*86d7f5d3SJohn Marino void
__gmp_assert_header(const char * filename,int linenum)31*86d7f5d3SJohn Marino __gmp_assert_header (const char *filename, int linenum)
32*86d7f5d3SJohn Marino {
33*86d7f5d3SJohn Marino if (filename != NULL && filename[0] != '\0')
34*86d7f5d3SJohn Marino {
35*86d7f5d3SJohn Marino fprintf (stderr, "%s:", filename);
36*86d7f5d3SJohn Marino if (linenum != -1)
37*86d7f5d3SJohn Marino fprintf (stderr, "%d: ", linenum);
38*86d7f5d3SJohn Marino }
39*86d7f5d3SJohn Marino }
40*86d7f5d3SJohn Marino
41*86d7f5d3SJohn Marino void
__gmp_assert_fail(const char * filename,int linenum,const char * expr)42*86d7f5d3SJohn Marino __gmp_assert_fail (const char *filename, int linenum,
43*86d7f5d3SJohn Marino const char *expr)
44*86d7f5d3SJohn Marino {
45*86d7f5d3SJohn Marino __gmp_assert_header (filename, linenum);
46*86d7f5d3SJohn Marino fprintf (stderr, "GNU MP assertion failed: %s\n", expr);
47*86d7f5d3SJohn Marino abort();
48*86d7f5d3SJohn Marino }
49