X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fcommon%2Fdebug.h;h=1668ad04f7c46eed440e9355d4aa9be5403b5af5;hb=9d500f9aa4f5fe482e47417ce1190b9193856543;hp=e677903c11b5ff6361b6c32363e0398eb5fe0bd2;hpb=1d51c9a8b92680eb9ee1fabfab628a40f5a4aa8f;p=libfirm diff --git a/ir/common/debug.h b/ir/common/debug.h index e677903c1..1668ad04f 100644 --- a/ir/common/debug.h +++ b/ir/common/debug.h @@ -1,65 +1,52 @@ -/** - * Debug facility. - * @author Michael Beck, Sebastian Hack - * @date 15.12.2004 +/* + * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * + * This file is part of libFirm. + * + * This file may be distributed and/or modified under the terms of the + * GNU General Public License version 2 as published by the Free Software + * Foundation and appearing in the file LICENSE.GPL included in the + * packaging of this file. + * + * Licensees holding valid libFirm Professional Edition licenses may use + * this file in accordance with the libFirm Commercial License. + * Agreement provided with the Software. * - * $Id$ + * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE + * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. */ -#ifndef _FIRM_DEBUG_H -#define _FIRM_DEBUG_H - -#include "firm_config.h" - -#ifdef WITH_LIBCORE - -#define DBG(x) _LC_DBG(x) -#define DB(x) _LC_DB(x) -#include - -/* use the newer debug implementation in libcore */ -typedef lc_dbg_module_t firm_dbg_module_t; - -extern firm_dbg_module_t *firm_dbg_register(const char *name); - -#define firm_dbg_set_mask(module, mask) lc_dbg_set_mask(module, mask) -#define firm_dbg_get_mask(module) lc_dbg_get_mask(module) -#define firm_dbg_set_file(module, file) lc_dbg_set_file(module, file) - -#define LEVEL_DEFAULT LC_LEVEL_DEFAULT -#define LEVEL_1 LC_LEVEL_1 -#define LEVEL_2 LC_LEVEL_2 -#define LEVEL_3 LC_LEVEL_3 -#define LEVEL_4 LC_LEVEL_4 -#define LEVEL_5 LC_LEVEL_5 -#define SET_LEVEL_0 LC_SET_LEVEL_0 -#define SET_LEVEL_1 LC_SET_LEVEL_1 -#define SET_LEVEL_2 LC_SET_LEVEL_2 -#define SET_LEVEL_3 LC_SET_LEVEL_3 -#define SET_LEVEL_4 LC_SET_LEVEL_4 -#define SET_LEVEL_5 LC_SET_LEVEL_5 -#define SET_LEVEL_ALL LC_SET_LEVEL_ALL +/** + * @file + * @brief Debug facility. + * @author Michael Beck, Sebastian Hack + * @date 15.12.2004 + * @version $Id$ + */ +#ifndef FIRM_COMMON_DEBUG_H +#define FIRM_COMMON_DEBUG_H -#else -/* use the builtin debug implementation */ +/* WITH DEBUG OUTPUT */ +#ifdef DEBUG_libfirm #include enum firm_dbg_level_t { - LEVEL_DEFAULT = 0, /**< Prints always. Use with DBG(). */ - LEVEL_1 = 1, - LEVEL_2 = 2, - LEVEL_3 = 4, - LEVEL_4 = 8, - LEVEL_5 = 16, - - SET_LEVEL_0 = 0, /**< use with firm_dbg_set_mask(). */ - SET_LEVEL_1 = 1, - SET_LEVEL_2 = 3, - SET_LEVEL_3 = 7, - SET_LEVEL_4 = 15, - SET_LEVEL_5 = 31, - SET_LEVEL_ALL = SET_LEVEL_5 + LEVEL_DEFAULT = 0, /**< Prints always. Use with DBG(). */ + LEVEL_1 = 1, + LEVEL_2 = 2, + LEVEL_3 = 4, + LEVEL_4 = 8, + LEVEL_5 = 16, + + SET_LEVEL_0 = 0, /**< use with firm_dbg_set_mask(). */ + SET_LEVEL_1 = 1, + SET_LEVEL_2 = 3, + SET_LEVEL_3 = 7, + SET_LEVEL_4 = 15, + SET_LEVEL_5 = 31, + SET_LEVEL_ALL = SET_LEVEL_5 }; typedef struct _firm_dbg_module_t firm_dbg_module_t; @@ -132,8 +119,6 @@ void firm_dbg_set_file(firm_dbg_module_t *module, FILE *file); #define DBG_RETAIL(args) _DBG(args) #define DB_RETAIL(args) _DB(args) -#ifdef DEBUG_libfirm - /** * Issue a debug message. * @param args The arguments. @@ -160,23 +145,27 @@ void firm_dbg_set_file(firm_dbg_module_t *module, FILE *file); #define DBG(args) _DBG(args) #define DB(args) _DB(args) -#else -#define DBG(args) -#define DB(args) -#endif /* DEBUG_libfirm */ - -#endif /* WITH_LIBCORE */ - -#ifdef DEBUG_libfirm - /** create a debug handle in debug mode */ #define FIRM_DBG_REGISTER(handle, name) handle = firm_dbg_register(name) +#define DEBUG_ONLY(code) code +#define RELEASE_ONLY(code) -#else +#else /* ndef DEBUG_libfirm */ + +/* DEBUG OUTPUT IS COMPLETELY DISABLED */ + +#define DBG(x) (void)0 +#define DB(x) (void)0 /** create a debug handle in release mode */ -#define FIRM_DBG_REGISTER(handle, name) +#define FIRM_DBG_REGISTER(handle, name) (void)0 +#define DEBUG_ONLY(code) +#define RELEASE_ONLY(code) code + +#define firm_dbg_set_mask(module, mask) (void)0 +#define firm_dbg_get_mask(module) (void)0 +#define firm_dbg_set_file(module, file) (void)0 #endif /* DEBUG_libfirm */ -#endif /* _FIRM_DEBUG_H */ +#endif