Merge --enable-debug and --enable-debug-logging. Introduce --enable-sparse.

edge.strict_endians
Yura Pakhuchiy 2007-08-22 21:29:19 +03:00
parent 391929cff3
commit c0b691ca17
6 changed files with 23 additions and 22 deletions

View File

@ -86,6 +86,11 @@ AC_ARG_ENABLE(debug,
enable_debug=no
)
AC_ARG_ENABLE(sparse,
AS_HELP_STRING(--enable-sparse,enable sparse code checking), ,
enable_sparse=no
)
# AH_TEMPLATE is needed here because we want to have a template in config.h
# regardless of whether the option is given or not.
AH_TEMPLATE([NO_NTFS_DEVICE_DEFAULT_IO_OPS],
@ -140,17 +145,6 @@ if test "$enable_test" = "yes"; then
CFLAGS="${CFLAGS} -DNTFS_TEST"
fi
AH_TEMPLATE([NTFS_DISABLE_DEBUG_LOGGING],
[Define this if you want to compile out the debug log messages.
This will reduce the size of the binaries.])
AC_ARG_ENABLE(debug-logging,
AS_HELP_STRING(--enable-debug-logging,Add debug logging to the code),,
enable_debug_logging=no
)
if test "$enable_debug_logging" == "no"; then
AC_DEFINE(NTFS_DISABLE_DEBUG_LOGGING)
fi
# Use GNU extensions if available.
AC_GNU_SOURCE
@ -330,7 +324,13 @@ fi
# Add debugging switches if --enable-debug was specified.
if test "$enable_debug" = "yes"; then
CFLAGS="$CFLAGS -ggdb3 -DDEBUG"
CFLAGS="$CFLAGS -ggdb3 -DDEBUG -O0"
fi
# Set cgcc as compiler and add sparse flags if --enable-sparse was specified.
if test "$enable_sparse" = "yes"; then
CC="cgcc"
CFLAGS="$CFLAGS -Wbitwise -Wno-transparent-union"
fi
AC_SUBST(CFLAGS)

View File

@ -30,7 +30,7 @@
struct _runlist_element;
#ifdef NTFS_DISABLE_DEBUG_LOGGING
#ifndef DEBUG
static __inline__ void ntfs_debug_runlist_dump(const struct _runlist_element *rl __attribute__((unused))) {}
#else
extern void ntfs_debug_runlist_dump(const struct _runlist_element *rl);

View File

@ -85,7 +85,7 @@ int ntfs_log_redirect(const char *function, const char *file, int line,
#define NTFS_LOG_FLAG_COLOUR ((u32)1 << 5) /* Colour highlight some messages */
/* Macros to simplify logging. One for each level defined above.
* Note, if NTFS_DISABLE_DEBUG_LOGGING is defined, then ntfs_log_debug/trace have no effect.
* Note, if DEBUG is not defined, then ntfs_log_debug/trace have no effect.
*/
#define ntfs_log_critical(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_CRITICAL,NULL,FORMAT,##ARGS)
#define ntfs_log_error(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_ERROR,NULL,FORMAT,##ARGS)
@ -96,16 +96,17 @@ int ntfs_log_redirect(const char *function, const char *file, int line,
#define ntfs_log_verbose(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_VERBOSE,NULL,FORMAT,##ARGS)
#define ntfs_log_warning(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_WARNING,NULL,FORMAT,##ARGS)
/* By default debug and trace messages are compiled into the program,
/*
* By default debug and trace messages are compiled into the program,
* but not displayed.
*/
#ifdef NTFS_DISABLE_DEBUG_LOGGING
#ifndef DEBUG
#define ntfs_log_debug(FORMAT, ARGS...)do {} while (0)
#define ntfs_log_trace(FORMAT, ARGS...)do {} while (0)
#else
#else /* !DEBUG */
#define ntfs_log_debug(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_DEBUG,NULL,FORMAT,##ARGS)
#define ntfs_log_trace(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_TRACE,NULL,FORMAT,##ARGS)
#endif /* NTFS_DISABLE_DEBUG_LOGGING */
#endif /* DEBUG */
#endif /* _LOGGING_H_ */

View File

@ -32,7 +32,7 @@
#include "debug.h"
#include "logging.h"
#ifndef NTFS_DISABLE_DEBUG_LOGGING
#ifdef DEBUG
/**
* ntfs_debug_runlist_dump - Dump a runlist.
* @rl:

View File

@ -465,7 +465,7 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni)
"pass_end 0x%llx, data_pos 0x%llx.\n", pass,
(long long)pass_start, (long long)pass_end,
(long long)data_pos);
#ifndef NTFS_DISABLE_DEBUG_LOGGING
#ifdef DEBUG
byte = NULL;
b = 0;
#endif

View File

@ -410,7 +410,7 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev,
ntfs_volume *vol;
NTFS_BOOT_SECTOR *bs;
int eo;
#ifndef NTFS_DISABLE_DEBUG_LOGGING
#ifdef DEBUG
const char *OK = "OK\n";
const char *FAILED = "FAILED\n";
BOOL debug = 1;
@ -778,7 +778,7 @@ out:
ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, ntfs_mount_flags flags)
{
s64 l;
#ifndef NTFS_DISABLE_DEBUG_LOGGING
#ifdef DEBUG
const char *OK = "OK\n";
const char *FAILED = "FAILED\n";
#endif