2 libparted - a library for manipulating disk partitions
3 Copyright (C) 1998-2000, 2002, 2007, 2009-2011 Free Software Foundation,
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef PED_DEBUG_H_INCLUDED
21 #define PED_DEBUG_H_INCLUDED
27 typedef void (PedDebugHandler) ( const int level, const char* file, int line,
28 const char* function, const char* msg );
30 extern void ped_debug_set_handler (PedDebugHandler* handler);
31 extern void ped_debug ( const int level, const char* file, int line,
32 const char* function, const char* msg, ... );
34 extern void __attribute__((__noreturn__))
35 ped_assert ( const char* cond_text,
36 const char* file, int line, const char* function );
38 #if defined __GNUC__ && !defined __JSFTRACE__
40 #define PED_DEBUG(level, ...) \
41 ped_debug ( level, __FILE__, __LINE__, __PRETTY_FUNCTION__, \
44 #define PED_ASSERT(cond) \
51 __PRETTY_FUNCTION__ ); \
57 /* function because variadic macros are C99 */
58 static void PED_DEBUG (int level, ...)
62 va_start (va_args, level);
63 ped_debug ( level, "unknown file", 0, "unknown function", va_args );
67 #define PED_ASSERT(cond) \
82 #define PED_ASSERT(cond) do {} while (0)
83 #define PED_DEBUG(level, ...) do {} while (0)
88 #endif /* PED_DEBUG_H_INCLUDED */