blob: db36be48a43e4fda0f2906fc76eb1a466a203fd2 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Nathan Scott7b718762005-11-02 14:58:39 +11002 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
Nathan Scott7b718762005-11-02 14:58:39 +11005 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 * published by the Free Software Foundation.
8 *
Nathan Scott7b718762005-11-02 14:58:39 +11009 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 *
Nathan Scott7b718762005-11-02 14:58:39 +110014 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Linus Torvalds1da177e2005-04-16 15:20:36 -070017 */
18#ifndef __XFS_SUPPORT_DEBUG_H__
19#define __XFS_SUPPORT_DEBUG_H__
20
21#include <stdarg.h>
22
Nathan Scott3762ec62006-01-12 10:29:53 +110023extern void assfail(char *expr, char *f, int l);
24
Nathan Scott3762ec62006-01-12 10:29:53 +110025#define ASSERT_ALWAYS(expr) \
Christoph Hellwigee5c8022007-08-16 15:38:08 +100026 (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
Nathan Scott3762ec62006-01-12 10:29:53 +110027
28#ifndef DEBUG
Christoph Hellwigee5c8022007-08-16 15:38:08 +100029#define ASSERT(expr) ((void)0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070030
31#ifndef STATIC
David Chinner7989cb82007-02-10 18:34:56 +110032# define STATIC static noinline
Linus Torvalds1da177e2005-04-16 15:20:36 -070033#endif
34
David Chinner7989cb82007-02-10 18:34:56 +110035#else /* DEBUG */
36
Christoph Hellwigee5c8022007-08-16 15:38:08 +100037#define ASSERT(expr) \
38 (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
David Chinner7989cb82007-02-10 18:34:56 +110039
40#ifndef STATIC
41# define STATIC noinline
42#endif
43
David Chinner7989cb82007-02-10 18:34:56 +110044#endif /* DEBUG */
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#endif /* __XFS_SUPPORT_DEBUG_H__ */