1/* 2 * debug.h - Debugging output functions. Part of the Linux-NTFS project. 3 * 4 * Copyright (c) 2002-2004 Anton Altaparmakov 5 * 6 * This program/include file is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as published 8 * by the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program/include file is distributed in the hope that it will be 12 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program (in the main directory of the Linux-NTFS 18 * distribution in the file COPYING); if not, write to the Free Software 19 * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 */ 21 22#ifndef _NTFS_DEBUG_H 23#define _NTFS_DEBUG_H 24 25#ifdef HAVE_CONFIG_H 26#include "config.h" 27#endif 28 29#include "logging.h" 30 31struct _runlist_element; 32 33#ifndef DEBUG 34static __inline__ void ntfs_debug_runlist_dump(const struct _runlist_element *rl __attribute__((unused))) {} 35#define NTFS_ON_DEBUG(x) 36#else 37extern void ntfs_debug_runlist_dump(const struct _runlist_element *rl); 38#define NTFS_ON_DEBUG(x) (x) 39#endif 40 41#if defined(__GNUC__) 42 43#define NTFS_BUG(msg) \ 44{ \ 45 int ___i; \ 46 ntfs_log_critical("Bug in %s(): %s\n", __FUNCTION__, msg); \ 47 ntfs_log_debug("Forcing segmentation fault!"); \ 48 ___i = ((int*)NULL)[1]; \ 49} 50 51#else /* not __GNUC__ */ 52 53#define NTFS_BUG(msg) \ 54{ \ 55 int ___i; \ 56 ntfs_log_critical("Bug in %s(): %s\n", "unknown", msg); \ 57 ntfs_log_debug("Forcing segmentation fault!"); \ 58 ___i = ((int*)NULL)[1]; \ 59} 60 61#endif /* __GNUC__ */ 62 63#endif /* defined _NTFS_DEBUG_H */ 64