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 <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Gerald Combs 2017-12-08 10:44:44 -08:00 committed by Anders Broman
parent 3d673da88c
commit d0d1eaadf0
2 changed files with 13 additions and 2 deletions

View File

@ -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 <ws_diag_control.h>
#endif /* __CONFIG_H__ */

View File

@ -7,10 +7,10 @@
* SPDX-License-Identifier: GPL-2.0+
*/
#include "ui/recent.h"
#include <ui/qt/utils/data_printer.h>
#include <ui/recent.h>
#include <stdint.h>
#include <QApplication>