Use variable argument macros when compiling with gcc.
This commit is contained in:
parent
28fd558077
commit
864dc5981c
|
@ -64,7 +64,7 @@ static inline void release( void *ptr )
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
const char *debugstr_an( const char *src, int n )
|
const char *wine_dbgstr_an( const char *src, int n )
|
||||||
{
|
{
|
||||||
char *dst, *res;
|
char *dst, *res;
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ const char *debugstr_an( const char *src, int n )
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
const char *debugstr_wn( const WCHAR *src, int n )
|
const char *wine_dbgstr_wn( const WCHAR *src, int n )
|
||||||
{
|
{
|
||||||
char *dst, *res;
|
char *dst, *res;
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ const char *debugstr_wn( const WCHAR *src, int n )
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
const char *debugstr_guid( const GUID *id )
|
const char *wine_dbgstr_guid( const GUID *id )
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
|
@ -212,27 +212,23 @@ int wine_dbg_printf(const char *format, ...)
|
||||||
va_list valist;
|
va_list valist;
|
||||||
|
|
||||||
va_start(valist, format);
|
va_start(valist, format);
|
||||||
ret = wine_dbg_vprintf( format, valist);
|
ret = wine_dbg_vprintf( format, valist );
|
||||||
va_end(valist);
|
va_end(valist);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __wine_dbg_header_err( const char *dbg_channel, const char *func )
|
int wine_dbg_log(enum __DEBUG_CLASS cls, const char *channel,
|
||||||
|
const char *function, const char *format, ... )
|
||||||
{
|
{
|
||||||
return wine_dbg_printf( "err:%s:%s ", dbg_channel + 1, func );
|
static const char *classes[__DBCL_COUNT] = { "fixme", "err", "warn", "trace" };
|
||||||
}
|
va_list valist;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
int __wine_dbg_header_fixme( const char *dbg_channel, const char *func )
|
va_start(valist, format);
|
||||||
{
|
if (cls < __DBCL_COUNT)
|
||||||
return wine_dbg_printf( "fixme:%s:%s ", dbg_channel + 1, func );
|
ret = wine_dbg_printf( "%s:%s:%s ", classes[cls], channel + 1, function );
|
||||||
}
|
if (format)
|
||||||
|
ret += wine_dbg_vprintf( format, valist );
|
||||||
int __wine_dbg_header_warn( const char *dbg_channel, const char *func )
|
va_end(valist);
|
||||||
{
|
return ret;
|
||||||
return wine_dbg_printf( "warn:%s:%s ", dbg_channel + 1, func );
|
|
||||||
}
|
|
||||||
|
|
||||||
int __wine_dbg_header_trace( const char *dbg_channel, const char *func )
|
|
||||||
{
|
|
||||||
return wine_dbg_printf( "trace:%s:%s ", dbg_channel + 1, func );
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1017,12 +1017,12 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
|
||||||
@ cdecl __wine_finally_handler(ptr ptr ptr ptr) __wine_finally_handler
|
@ cdecl __wine_finally_handler(ptr ptr ptr ptr) __wine_finally_handler
|
||||||
|
|
||||||
# Debugging interface
|
# Debugging interface
|
||||||
@ cdecl __wine_dbg_header_err(ptr str) __wine_dbg_header_err
|
@ cdecl wine_dbgstr_an(str long) wine_dbgstr_an
|
||||||
@ cdecl __wine_dbg_header_fixme(ptr str) __wine_dbg_header_fixme
|
@ cdecl wine_dbgstr_wn(str long) wine_dbgstr_wn
|
||||||
@ cdecl __wine_dbg_header_warn(ptr str) __wine_dbg_header_warn
|
@ cdecl wine_dbgstr_guid(ptr) wine_dbgstr_guid
|
||||||
@ cdecl __wine_dbg_header_trace(ptr str) __wine_dbg_header_trace
|
|
||||||
@ cdecl wine_dbg_vprintf(str ptr) wine_dbg_vprintf
|
@ cdecl wine_dbg_vprintf(str ptr) wine_dbg_vprintf
|
||||||
@ varargs wine_dbg_printf(str) wine_dbg_printf
|
@ varargs wine_dbg_printf(str) wine_dbg_printf
|
||||||
|
@ varargs wine_dbg_log(long str str str) wine_dbg_log
|
||||||
|
|
||||||
# Command-line
|
# Command-line
|
||||||
@ cdecl __wine_get_main_args(ptr) __wine_get_main_args
|
@ cdecl __wine_get_main_args(ptr) __wine_get_main_args
|
||||||
|
|
|
@ -296,7 +296,7 @@ void FILE_SetDosError(void)
|
||||||
SetLastError( ERROR_BAD_FORMAT );
|
SetLastError( ERROR_BAD_FORMAT );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WARN( strerror(save_errno) );
|
WARN( "unknown file error: %s", strerror(save_errno) );
|
||||||
SetLastError( ERROR_GEN_FAILURE );
|
SetLastError( ERROR_GEN_FAILURE );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,77 +15,88 @@ struct _GUID;
|
||||||
enum __DEBUG_CLASS { __DBCL_FIXME, __DBCL_ERR, __DBCL_WARN, __DBCL_TRACE, __DBCL_COUNT };
|
enum __DEBUG_CLASS { __DBCL_FIXME, __DBCL_ERR, __DBCL_WARN, __DBCL_TRACE, __DBCL_COUNT };
|
||||||
|
|
||||||
#ifndef NO_TRACE_MSGS
|
#ifndef NO_TRACE_MSGS
|
||||||
# define __GET_DEBUGGING_trace(dbch) ((dbch)[0] & (1 << __DBCL_TRACE))
|
# define __GET_DEBUGGING_TRACE(dbch) ((dbch)[0] & (1 << __DBCL_TRACE))
|
||||||
#else
|
#else
|
||||||
# define __GET_DEBUGGING_trace(dbch) 0
|
# define __GET_DEBUGGING_TRACE(dbch) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NO_DEBUG_MSGS
|
#ifndef NO_DEBUG_MSGS
|
||||||
# define __GET_DEBUGGING_warn(dbch) ((dbch)[0] & (1 << __DBCL_WARN))
|
# define __GET_DEBUGGING_WARN(dbch) ((dbch)[0] & (1 << __DBCL_WARN))
|
||||||
# define __GET_DEBUGGING_fixme(dbch) ((dbch)[0] & (1 << __DBCL_FIXME))
|
# define __GET_DEBUGGING_FIXME(dbch) ((dbch)[0] & (1 << __DBCL_FIXME))
|
||||||
#else
|
#else
|
||||||
# define __GET_DEBUGGING_warn(dbch) 0
|
# define __GET_DEBUGGING_WARN(dbch) 0
|
||||||
# define __GET_DEBUGGING_fixme(dbch) 0
|
# define __GET_DEBUGGING_FIXME(dbch) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* define error macro regardless of what is configured */
|
/* define error macro regardless of what is configured */
|
||||||
#define __GET_DEBUGGING_err(dbch) ((dbch)[0] & (1 << __DBCL_ERR))
|
#define __GET_DEBUGGING_ERR(dbch) ((dbch)[0] & (1 << __DBCL_ERR))
|
||||||
|
|
||||||
#define __GET_DEBUGGING(dbcl,dbch) __GET_DEBUGGING_##dbcl(dbch)
|
#define __GET_DEBUGGING(dbcl,dbch) __GET_DEBUGGING##dbcl(dbch)
|
||||||
#define __SET_DEBUGGING(dbcl,dbch,on) \
|
#define __SET_DEBUGGING(dbcl,dbch,on) \
|
||||||
((on) ? ((dbch)[0] |= 1 << (dbcl)) : ((dbch)[0] &= ~(1 << (dbcl))))
|
((on) ? ((dbch)[0] |= 1 << (dbcl)) : ((dbch)[0] &= ~(1 << (dbcl))))
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define __FUNCTION__ ""
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define __DPRINTF(dbcl,dbch) \
|
#define __DPRINTF(dbcl,dbch) \
|
||||||
(!__GET_DEBUGGING(dbcl,(dbch)) || (__wine_dbg_header_##dbcl((dbch),__FUNCTION__),0)) ? \
|
do { if(__GET_DEBUGGING(dbcl,(dbch))) { \
|
||||||
|
const char * const __dbch = (dbch); \
|
||||||
|
const enum __DEBUG_CLASS __dbcl = __DBCL##dbcl; \
|
||||||
|
__WINE_DBG_LOG
|
||||||
|
|
||||||
|
#define __WINE_DBG_LOG(args...) \
|
||||||
|
wine_dbg_log( __dbcl, __dbch, __FUNCTION__, args); } } while(0)
|
||||||
|
|
||||||
|
#define __PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)));
|
||||||
|
|
||||||
|
#else /* __GNUC__ */
|
||||||
|
|
||||||
|
#define __DPRINTF(dbcl,dbch) \
|
||||||
|
(!__GET_DEBUGGING(dbcl,(dbch)) || \
|
||||||
|
(wine_dbg_log(__DBCL##dbcl,(dbch),__FILE__,"%d: ",__LINE__),0)) ? \
|
||||||
(void)0 : (void)wine_dbg_printf
|
(void)0 : (void)wine_dbg_printf
|
||||||
|
|
||||||
extern int __wine_dbg_header_err( const char *dbg_channel, const char *func );
|
#define __PRINTF_ATTR(fmt, args)
|
||||||
extern int __wine_dbg_header_warn( const char *dbg_channel, const char *func );
|
|
||||||
extern int __wine_dbg_header_fixme( const char *dbg_channel, const char *func );
|
#endif /* __GNUC__ */
|
||||||
extern int __wine_dbg_header_trace( const char *dbg_channel, const char *func );
|
|
||||||
|
|
||||||
/* Exported definitions and macros */
|
/* Exported definitions and macros */
|
||||||
|
|
||||||
/* These function return a printable version of a string, including
|
/* These function return a printable version of a string, including
|
||||||
quotes. The string will be valid for some time, but not indefinitely
|
quotes. The string will be valid for some time, but not indefinitely
|
||||||
as strings are re-used. */
|
as strings are re-used. */
|
||||||
extern const char *debugstr_an (const char * s, int n);
|
extern const char *wine_dbgstr_an( const char * s, int n );
|
||||||
extern const char *debugstr_wn (const WCHAR *s, int n);
|
extern const char *wine_dbgstr_wn( const WCHAR *s, int n );
|
||||||
extern const char *debugstr_guid( const struct _GUID *id );
|
extern const char *wine_dbgstr_guid( const struct _GUID *id );
|
||||||
|
|
||||||
extern int wine_dbg_vprintf( const char *format, va_list args );
|
extern int wine_dbg_vprintf( const char *format, va_list args ) __PRINTF_ATTR(1,0);
|
||||||
|
extern int wine_dbg_printf( const char *format, ... ) __PRINTF_ATTR(1,2);
|
||||||
|
extern int wine_dbg_log( enum __DEBUG_CLASS cls, const char *ch,
|
||||||
|
const char *func, const char *format, ... ) __PRINTF_ATTR(4,5);
|
||||||
|
|
||||||
inline static const char *debugstr_a( const char *s ) { return debugstr_an( s, 80 ); }
|
inline static const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); }
|
||||||
inline static const char *debugstr_w( const WCHAR *s ) { return debugstr_wn( s, 80 ); }
|
inline static const char *debugstr_wn( const WCHAR *s, int n ) { return wine_dbgstr_wn( s, n ); }
|
||||||
inline static const char *debugres_a( const char *s ) { return debugstr_an( s, 80 ); }
|
inline static const char *debugstr_guid( const struct _GUID *id ) { return wine_dbgstr_guid(id); }
|
||||||
inline static const char *debugres_w( const WCHAR *s ) { return debugstr_wn( s, 80 ); }
|
inline static const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, 80 ); }
|
||||||
|
inline static const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, 80 ); }
|
||||||
|
inline static const char *debugres_a( const char *s ) { return wine_dbgstr_an( s, 80 ); }
|
||||||
|
inline static const char *debugres_w( const WCHAR *s ) { return wine_dbgstr_wn( s, 80 ); }
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#define TRACE __DPRINTF(_TRACE,__wine_dbch___default)
|
||||||
extern int wine_dbg_printf(const char *format, ...) __attribute__((format (printf,1,2)));
|
#define TRACE_(ch) __DPRINTF(_TRACE,__wine_dbch_##ch)
|
||||||
#else
|
#define TRACE_ON(ch) __GET_DEBUGGING(_TRACE,__wine_dbch_##ch)
|
||||||
extern int wine_dbg_printf(const char *format, ...);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TRACE __DPRINTF(trace,__wine_dbch___default)
|
#define WARN __DPRINTF(_WARN,__wine_dbch___default)
|
||||||
#define TRACE_(ch) __DPRINTF(trace,__wine_dbch_##ch)
|
#define WARN_(ch) __DPRINTF(_WARN,__wine_dbch_##ch)
|
||||||
#define TRACE_ON(ch) __GET_DEBUGGING(trace,__wine_dbch_##ch)
|
#define WARN_ON(ch) __GET_DEBUGGING(_WARN,__wine_dbch_##ch)
|
||||||
|
|
||||||
#define WARN __DPRINTF(warn,__wine_dbch___default)
|
#define FIXME __DPRINTF(_FIXME,__wine_dbch___default)
|
||||||
#define WARN_(ch) __DPRINTF(warn,__wine_dbch_##ch)
|
#define FIXME_(ch) __DPRINTF(_FIXME,__wine_dbch_##ch)
|
||||||
#define WARN_ON(ch) __GET_DEBUGGING(warn,__wine_dbch_##ch)
|
#define FIXME_ON(ch) __GET_DEBUGGING(_FIXME,__wine_dbch_##ch)
|
||||||
|
|
||||||
#define FIXME __DPRINTF(fixme,__wine_dbch___default)
|
|
||||||
#define FIXME_(ch) __DPRINTF(fixme,__wine_dbch_##ch)
|
|
||||||
#define FIXME_ON(ch) __GET_DEBUGGING(fixme,__wine_dbch_##ch)
|
|
||||||
|
|
||||||
#undef ERR /* Solaris got an 'ERR' define in <sys/reg.h> */
|
#undef ERR /* Solaris got an 'ERR' define in <sys/reg.h> */
|
||||||
#define ERR __DPRINTF(err,__wine_dbch___default)
|
#define ERR __DPRINTF(_ERR,__wine_dbch___default)
|
||||||
#define ERR_(ch) __DPRINTF(err,__wine_dbch_##ch)
|
#define ERR_(ch) __DPRINTF(_ERR,__wine_dbch_##ch)
|
||||||
#define ERR_ON(ch) __GET_DEBUGGING(err,__wine_dbch_##ch)
|
#define ERR_ON(ch) __GET_DEBUGGING(_ERR,__wine_dbch_##ch)
|
||||||
|
|
||||||
#define DECLARE_DEBUG_CHANNEL(ch) \
|
#define DECLARE_DEBUG_CHANNEL(ch) \
|
||||||
extern char __wine_dbch_##ch[];
|
extern char __wine_dbch_##ch[];
|
||||||
|
|
Loading…
Reference in New Issue