1 /* sane - Scanner Access Now Easy.
2 
3    Copyright (C) 2001 by Henning Meier-Geinitz
4 
5    This file is part of the SANE package.
6 
7    SANE is free software; you can redistribute it and/or modify it under
8    the terms of the GNU General Public License as published by the Free
9    Software Foundation; either version 2 of the License, or (at your
10    option) any later version.
11 
12    SANE is distributed in the hope that it will be useful, but WITHOUT
13    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15    for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with sane; see the file COPYING.
19    If not, see <https://www.gnu.org/licenses/>.
20 
21    As a special exception, the authors of SANE give permission for
22    additional uses of the libraries contained in this release of SANE.
23 
24    The exception is that, if you link a SANE library with other files
25    to produce an executable, this does not by itself cause the
26    resulting executable to be covered by the GNU General Public
27    License.  Your use of that executable is in no way restricted on
28    account of linking the SANE library code into it.
29 
30    This exception does not, however, invalidate any other reasons why
31    the executable file might be covered by the GNU General Public
32    License.
33 
34    If you submit changes to SANE to the maintainers to be included in
35    a subsequent release, you agree by submitting the changes that
36    those changes may be distributed with this exception intact.
37 
38    If you write modifications of your own for SANE, it is your choice
39    whether to permit this exception to apply to your modifications.
40    If you do not wish that, delete this exception notice.
41 
42    Choose suitable implementation of assert.
43 */
44 
45 #ifndef lassert_h
46 #define lassert_h
47 
48 /* The idea is from the gcc header file assert.h. */
49 
50 #if defined __GNUC__ && defined _AIX
51 /* The implementation of assert of gcc on AIX is in libgcc.a. This
52    doesn't work with shared libraries. So let's make our own assert(). */
53 #define assert(arg)  \
54  ((void) ((arg) ? 0 : lassert (arg, __FILE__, __LINE__)))
55 #define lassert(arg, file, lineno)  \
56   (printf ("%s:%u: failed assertion\n", file, lineno),  \
57    abort (), 0)
58 #else
59 # include <assert.h>
60 #endif
61 
62 #endif /* lassert_h */
63