Commit bcf0fdd3 authored by Max Kellermann's avatar Max Kellermann

meson.build: define NOUSER on Windows for lighter windows.h

A few exceptions are needed for sources which include COM header (directly or indirectly). This fixes lots of shadow warnings, see https://github.com/MusicPlayerDaemon/MPD/issues/1150
parent a8f05a7e
...@@ -156,6 +156,10 @@ if is_windows ...@@ -156,6 +156,10 @@ if is_windows
# disable more Windows APIs which are not used by MPD # disable more Windows APIs which are not used by MPD
'-DNOGDI', '-DNOBITMAP', '-DNOCOMM', '-DNOGDI', '-DNOBITMAP', '-DNOCOMM',
'-DNOUSER',
# reduce COM header bloat
'-DCOM_NO_WINDOWS_H',
# disable Internet Explorer specific APIs # disable Internet Explorer specific APIs
'-D_WIN32_IE=0', '-D_WIN32_IE=0',
......
...@@ -17,6 +17,11 @@ ...@@ -17,6 +17,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#ifdef _WIN32
// COM needs the "MSG" typedef, and shlwapi.h includes COM headers
#undef NOUSER
#endif
#include "Glob.hxx" #include "Glob.hxx"
#ifdef _WIN32 #ifdef _WIN32
......
...@@ -17,6 +17,10 @@ ...@@ -17,6 +17,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#ifdef _WIN32
#undef NOUSER // COM needs the "MSG" typedef, and shlobj.h includes COM headers
#endif
#include "StandardDirectory.hxx" #include "StandardDirectory.hxx"
#include "FileSystem.hxx" #include "FileSystem.hxx"
#include "XDG.hxx" #include "XDG.hxx"
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#undef NOUSER // COM needs the "MSG" typedef
#include "output/plugins/wasapi/ForMixer.hxx" #include "output/plugins/wasapi/ForMixer.hxx"
#include "output/plugins/wasapi/AudioClient.hxx" #include "output/plugins/wasapi/AudioClient.hxx"
#include "output/plugins/wasapi/Device.hxx" #include "output/plugins/wasapi/Device.hxx"
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#undef NOUSER // COM needs the "MSG" typedef
#include "WasapiOutputPlugin.hxx" #include "WasapiOutputPlugin.hxx"
#include "ForMixer.hxx" #include "ForMixer.hxx"
#include "AudioClient.hxx" #include "AudioClient.hxx"
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "HResult.hxx" #include "HResult.hxx"
#include <combaseapi.h> #include <combaseapi.h>
#include <objbase.h> // for COINIT_APARTMENTTHREADED
// RAII for Microsoft Component Object Model(COM) // RAII for Microsoft Component Object Model(COM)
// https://docs.microsoft.com/en-us/windows/win32/api/_com/ // https://docs.microsoft.com/en-us/windows/win32/api/_com/
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#undef NOUSER // COM needs the "MSG" typedef
#include "ComWorker.hxx" #include "ComWorker.hxx"
#include "Com.hxx" #include "Com.hxx"
#include "thread/Name.hxx" #include "thread/Name.hxx"
......
...@@ -17,6 +17,11 @@ ...@@ -17,6 +17,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#ifdef _WIN32
// COM needs the "MSG" typedef, and audiopolicy.h includes COM headers
#undef NOUSER
#endif
#include "HResult.hxx" #include "HResult.hxx"
#include "system/Error.hxx" #include "system/Error.hxx"
...@@ -25,6 +30,7 @@ ...@@ -25,6 +30,7 @@
#include <cstdio> #include <cstdio>
#include <memory> #include <memory>
#include <combaseapi.h> // needed by audiopolicy.h if COM_NO_WINDOWS_H is defined
#include <audiopolicy.h> #include <audiopolicy.h>
std::string_view std::string_view
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#ifndef MPD_WIN32_PROPVARIANT_HXX #ifndef MPD_WIN32_PROPVARIANT_HXX
#define MPD_WIN32_PROPVARIANT_HXX #define MPD_WIN32_PROPVARIANT_HXX
#include <combaseapi.h> // needed by propidl.h if COM_NO_WINDOWS_H is defined
#include <propidl.h> #include <propidl.h>
class AllocatedString; class AllocatedString;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment