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