From 9086f2a059cf9cfd82808a679fb5c3cd19b4a050 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 14 Nov 2015 16:19:07 +0000 Subject: [PATCH] [INCLUDE/REACTOS] Move the debug macros from mmebuddy.h to mmebuddy_debug.h. [SNDBLST][MMENT4][MMEBUDDY] Use mmebuddy_debug.h where needed. [WDMAUD.DRV] Enable PCH again and use mmebuddy_debug.h where needed. svn path=/trunk/; revision=69888 --- reactos/dll/win32/sndblst/sndblst.c | 1 + reactos/dll/win32/wdmaud.drv/CMakeLists.txt | 3 +- reactos/dll/win32/wdmaud.drv/legacy.c | 4 +- reactos/dll/win32/wdmaud.drv/mixer.c | 3 +- reactos/dll/win32/wdmaud.drv/mmixer.c | 3 +- reactos/dll/win32/wdmaud.drv/wdmaud.c | 3 +- reactos/include/reactos/libs/sound/mmebuddy.h | 63 ----------------- .../reactos/libs/sound/mmebuddy_debug.h | 67 +++++++++++++++++++ reactos/lib/drivers/sound/mmebuddy/precomp.h | 1 + reactos/lib/drivers/sound/mment4/control.c | 2 + reactos/lib/drivers/sound/mment4/detect.c | 1 + reactos/lib/drivers/sound/mment4/registry.c | 2 + 12 files changed, 84 insertions(+), 69 deletions(-) create mode 100644 reactos/include/reactos/libs/sound/mmebuddy_debug.h diff --git a/reactos/dll/win32/sndblst/sndblst.c b/reactos/dll/win32/sndblst/sndblst.c index 6161e1a080a..40ea7d1b669 100644 --- a/reactos/dll/win32/sndblst/sndblst.c +++ b/reactos/dll/win32/sndblst/sndblst.c @@ -26,6 +26,7 @@ #include #include #include +#include //#include /* TODO: Give individual device names if someone has > 1 card */ diff --git a/reactos/dll/win32/wdmaud.drv/CMakeLists.txt b/reactos/dll/win32/wdmaud.drv/CMakeLists.txt index ef8039b2510..0da282b7f71 100644 --- a/reactos/dll/win32/wdmaud.drv/CMakeLists.txt +++ b/reactos/dll/win32/wdmaud.drv/CMakeLists.txt @@ -28,6 +28,5 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang") endif() add_importlibs(wdmaud.drv user32 winmm advapi32 msvcrt setupapi ksuser kernel32 ntdll) -# FIXME: Address mmebuddy.h reliance on NDEBUG -#add_pch(wdmaud.drv wdmaud.h SOURCE) +add_pch(wdmaud.drv wdmaud.h SOURCE) add_cd_file(TARGET wdmaud.drv DESTINATION reactos/system32 FOR all) diff --git a/reactos/dll/win32/wdmaud.drv/legacy.c b/reactos/dll/win32/wdmaud.drv/legacy.c index c731837ecaa..00c9507341d 100644 --- a/reactos/dll/win32/wdmaud.drv/legacy.c +++ b/reactos/dll/win32/wdmaud.drv/legacy.c @@ -13,9 +13,11 @@ * */ -#define NDEBUG #include "wdmaud.h" + +#define NDEBUG #include +#include #define KERNEL_DEVICE_NAME L"\\\\.\\wdmaud" diff --git a/reactos/dll/win32/wdmaud.drv/mixer.c b/reactos/dll/win32/wdmaud.drv/mixer.c index 7ee6ca245b1..0f00ccc96e5 100644 --- a/reactos/dll/win32/wdmaud.drv/mixer.c +++ b/reactos/dll/win32/wdmaud.drv/mixer.c @@ -7,13 +7,14 @@ * PROGRAMMERS: Johannes Anderwald */ -#define NDEBUG #include "wdmaud.h" #include #include +#define NDEBUG #include +#include extern HANDLE KernelHandle; diff --git a/reactos/dll/win32/wdmaud.drv/mmixer.c b/reactos/dll/win32/wdmaud.drv/mmixer.c index f77ef1986f2..a025a0ef2f8 100644 --- a/reactos/dll/win32/wdmaud.drv/mmixer.c +++ b/reactos/dll/win32/wdmaud.drv/mmixer.c @@ -7,14 +7,15 @@ * PROGRAMMERS: Johannes Anderwald */ -#define NDEBUG #include "wdmaud.h" #include #include #include +#define NDEBUG #include +#include typedef struct { diff --git a/reactos/dll/win32/wdmaud.drv/wdmaud.c b/reactos/dll/win32/wdmaud.drv/wdmaud.c index 0494cc6235a..dfd8ea0361e 100644 --- a/reactos/dll/win32/wdmaud.drv/wdmaud.c +++ b/reactos/dll/win32/wdmaud.drv/wdmaud.c @@ -12,10 +12,11 @@ * */ -#define NDEBUG #include "wdmaud.h" +#define NDEBUG #include +#include #ifndef USE_MMIXER_LIB #define FUNC_NAME(x) x##ByLegacy diff --git a/reactos/include/reactos/libs/sound/mmebuddy.h b/reactos/include/reactos/libs/sound/mmebuddy.h index cbbb7fd46fd..d124e8bbc1d 100644 --- a/reactos/include/reactos/libs/sound/mmebuddy.h +++ b/reactos/include/reactos/libs/sound/mmebuddy.h @@ -20,69 +20,6 @@ #ifndef ROS_AUDIO_MMEBUDDY_H #define ROS_AUDIO_MMEBUDDY_H -/* - Hacky debug macro -*/ - -#define POPUP(...) \ - { \ - WCHAR dbg_popup_msg[1024], dbg_popup_title[256]; \ - wsprintf(dbg_popup_title, L"%hS(%d)", __FILE__, __LINE__); \ - wsprintf(dbg_popup_msg, __VA_ARGS__); \ - MessageBox(0, dbg_popup_msg, dbg_popup_title, MB_OK | MB_TASKMODAL); \ - } - -#ifndef NDEBUG - #define SND_ERR(...) \ - { \ - WCHAR dbg_popup_msg[1024]; \ - wsprintf(dbg_popup_msg, __VA_ARGS__); \ - OutputDebugString(dbg_popup_msg); \ - } - #define SND_WARN(...) \ - { \ - WCHAR dbg_popup_msg[1024]; \ - wsprintf(dbg_popup_msg, __VA_ARGS__); \ - OutputDebugString(dbg_popup_msg); \ - } - #define SND_TRACE(...) \ - { \ - WCHAR dbg_popup_msg[1024]; \ - wsprintf(dbg_popup_msg, __VA_ARGS__); \ - OutputDebugString(dbg_popup_msg); \ - } - - #define SND_ASSERT(condition) \ - { \ - if ( ! ( condition ) ) \ - { \ - SND_ERR(L"ASSERT FAILED: %hS File %hS Line %u\n", #condition, __FILE__, __LINE__); \ - POPUP(L"ASSERT FAILED: %hS\n", #condition); \ - ExitProcess(1); \ - } \ - } - - #define DUMP_WAVEHDR_QUEUE(sound_device_instance) \ - { \ - PWAVEHDR CurrDumpHdr = sound_device_instance->HeadWaveHeader; \ - SND_TRACE(L"-- Current wave header list --\n"); \ - while ( CurrDumpHdr ) \ - { \ - SND_TRACE(L"%x | %d bytes | flags: %x\n", CurrDumpHdr, \ - CurrDumpHdr->dwBufferLength, \ - CurrDumpHdr->dwFlags); \ - CurrDumpHdr = CurrDumpHdr->lpNext; \ - } \ - } - -#else - #define SND_ERR(...) do {} while ( 0 ) - #define SND_WARN(...) do {} while ( 0 ) - #define SND_TRACE(...) do {} while ( 0 ) - #define SND_ASSERT(condition) do {(void)(condition);} while ( 0 ) - #define DUMP_WAVEHDR_QUEUE(condition) do {} while ( 0 ) -#endif - /* Some memory allocation helper macros */ diff --git a/reactos/include/reactos/libs/sound/mmebuddy_debug.h b/reactos/include/reactos/libs/sound/mmebuddy_debug.h new file mode 100644 index 00000000000..1a18d5b58bf --- /dev/null +++ b/reactos/include/reactos/libs/sound/mmebuddy_debug.h @@ -0,0 +1,67 @@ +#ifndef ROS_AUDIO_MMEBUDDY_DEBUG_H +#define ROS_AUDIO_MMEBUDDY_DEBUG_H + +/* + Hacky debug macro +*/ + +#define POPUP(...) \ + { \ + WCHAR dbg_popup_msg[1024], dbg_popup_title[256]; \ + wsprintf(dbg_popup_title, L"%hS(%d)", __FILE__, __LINE__); \ + wsprintf(dbg_popup_msg, __VA_ARGS__); \ + MessageBox(0, dbg_popup_msg, dbg_popup_title, MB_OK | MB_TASKMODAL); \ + } + +#ifndef NDEBUG + #define SND_ERR(...) \ + { \ + WCHAR dbg_popup_msg[1024]; \ + wsprintf(dbg_popup_msg, __VA_ARGS__); \ + OutputDebugString(dbg_popup_msg); \ + } + #define SND_WARN(...) \ + { \ + WCHAR dbg_popup_msg[1024]; \ + wsprintf(dbg_popup_msg, __VA_ARGS__); \ + OutputDebugString(dbg_popup_msg); \ + } + #define SND_TRACE(...) \ + { \ + WCHAR dbg_popup_msg[1024]; \ + wsprintf(dbg_popup_msg, __VA_ARGS__); \ + OutputDebugString(dbg_popup_msg); \ + } + + #define SND_ASSERT(condition) \ + { \ + if ( ! ( condition ) ) \ + { \ + SND_ERR(L"ASSERT FAILED: %hS File %hS Line %u\n", #condition, __FILE__, __LINE__); \ + POPUP(L"ASSERT FAILED: %hS\n", #condition); \ + ExitProcess(1); \ + } \ + } + + #define DUMP_WAVEHDR_QUEUE(sound_device_instance) \ + { \ + PWAVEHDR CurrDumpHdr = sound_device_instance->HeadWaveHeader; \ + SND_TRACE(L"-- Current wave header list --\n"); \ + while ( CurrDumpHdr ) \ + { \ + SND_TRACE(L"%x | %d bytes | flags: %x\n", CurrDumpHdr, \ + CurrDumpHdr->dwBufferLength, \ + CurrDumpHdr->dwFlags); \ + CurrDumpHdr = CurrDumpHdr->lpNext; \ + } \ + } + +#else + #define SND_ERR(...) do {} while ( 0 ) + #define SND_WARN(...) do {} while ( 0 ) + #define SND_TRACE(...) do {} while ( 0 ) + #define SND_ASSERT(condition) do {(void)(condition);} while ( 0 ) + #define DUMP_WAVEHDR_QUEUE(condition) do {} while ( 0 ) +#endif + +#endif /* ROS_AUDIO_MMEBUDDY_DEBUG_H */ diff --git a/reactos/lib/drivers/sound/mmebuddy/precomp.h b/reactos/lib/drivers/sound/mmebuddy/precomp.h index 71bde99edf3..66fff2b36bf 100644 --- a/reactos/lib/drivers/sound/mmebuddy/precomp.h +++ b/reactos/lib/drivers/sound/mmebuddy/precomp.h @@ -6,5 +6,6 @@ #include #include #include +#include #endif /* _MMEBUDDY_PCH_ */ diff --git a/reactos/lib/drivers/sound/mment4/control.c b/reactos/lib/drivers/sound/mment4/control.c index d454bea89b5..4dd1b6a97e6 100644 --- a/reactos/lib/drivers/sound/mment4/control.c +++ b/reactos/lib/drivers/sound/mment4/control.c @@ -13,6 +13,8 @@ #include #include +#include + /* Convenience routine for getting the path of a device and opening it. */ diff --git a/reactos/lib/drivers/sound/mment4/detect.c b/reactos/lib/drivers/sound/mment4/detect.c index 2daa8b4e7ff..1395f1bae40 100644 --- a/reactos/lib/drivers/sound/mment4/detect.c +++ b/reactos/lib/drivers/sound/mment4/detect.c @@ -14,6 +14,7 @@ #include "precomp.h" #include +#include /* This is the "nice" way to discover audio devices in NT4 - go into the diff --git a/reactos/lib/drivers/sound/mment4/registry.c b/reactos/lib/drivers/sound/mment4/registry.c index aa6dbeac678..9a6c175a9ff 100644 --- a/reactos/lib/drivers/sound/mment4/registry.c +++ b/reactos/lib/drivers/sound/mment4/registry.c @@ -10,6 +10,8 @@ #include "precomp.h" +#include + /* Open the parameters key of a sound driver. NT4 only.