From d0d1eaadf0c92e37b6ed2883583f71b7b9ec3a7e Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Fri, 8 Dec 2017 10:44:44 -0800 Subject: [PATCH] Win32: Add checks for _WIN32_WINNT and NTDDI_VERSION. Check to see if we're the source of truth for _WIN32_WINNT and NTDDI_VERSION in config.h and emit a compiler error if we aren't. Rearrange the #includes in ui/qt/data_printer.cpp so that config.h is included first. This fixes the following: 136>C:\buildbot\wireshark\wireshark-master-64\windows-2016-x64\build\cmbuild\config.h(411): warning C4005: 'NTDDI_VERSION': macro redefinition (compiling source file C:\buildbot\wireshark\wireshark-master-64\windows-2016-x64\build\ui\qt\utils\data_printer.cpp) [C:\buildbot\wireshark\wireshark-master-64\windows-2016-x64\build\cmbuild\ui\qt\qtui.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared\sdkddkver.h(223): note: see previous definition of 'NTDDI_VERSION' (compiling source file C:\buildbot\wireshark\wireshark-master-64\windows-2016-x64\build\ui\qt\utils\data_printer.cpp) 136>C:\buildbot\wireshark\wireshark-master-64\windows-2016-x64\build\cmbuild\config.h(412): warning C4005: '_WIN32_WINNT': macro redefinition (compiling source file C:\buildbot\wireshark\wireshark-master-64\windows-2016-x64\build\ui\qt\utils\data_printer.cpp) [C:\buildbot\wireshark\wireshark-master-64\windows-2016-x64\build\cmbuild\ui\qt\qtui.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared\sdkddkver.h(213): note: see previous definition of '_WIN32_WINNT' (compiling source file C:\buildbot\wireshark\wireshark-master-64\windows-2016-x64\build\ui\qt\utils\data_printer.cpp) Change-Id: I90886cb9450463d768d6529ccd678ca11508cde2 Reviewed-on: https://code.wireshark.org/review/24744 Reviewed-by: Michael Mann Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- cmakeconfig.h.in | 11 +++++++++++ ui/qt/utils/data_printer.cpp | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in index 01810a1ec1..d60c411b6b 100644 --- a/cmakeconfig.h.in +++ b/cmakeconfig.h.in @@ -1,5 +1,8 @@ /* cmakeconfig.h.in */ +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + /* Note: You cannot use earlier #defines in later #cmakedefines (cmake 2.6.2). */ /* Name of package */ @@ -408,7 +411,13 @@ * - The GetWindowsVersion parts of packaging\nsis\wireshark.nsi * - The VersionNT parts of packaging\wix\Prerequisites.wxi */ +# if defined(NTDDI_VERSION) +# error NTDDI_VERSION already defined. +# endif # define NTDDI_VERSION NTDDI_VISTA +# if defined(_WIN32_WINNT) +# error _WIN32_WINNT already defined. +# endif # define _WIN32_WINNT _WIN32_WINNT_VISTA /* WpdPack/INclude/pcap/pcap.h checks for "#if defined(WIN32)" */ @@ -443,3 +452,5 @@ #endif #include + +#endif /* __CONFIG_H__ */ diff --git a/ui/qt/utils/data_printer.cpp b/ui/qt/utils/data_printer.cpp index 9d2d7740fb..e70fc2bd3d 100644 --- a/ui/qt/utils/data_printer.cpp +++ b/ui/qt/utils/data_printer.cpp @@ -7,10 +7,10 @@ * SPDX-License-Identifier: GPL-2.0+ */ -#include "ui/recent.h" - #include +#include + #include #include