From: Pali Rohár Date: Sun, 26 Dec 2021 17:19:41 +0000 (+0100) Subject: pciutils: Do not include compat/getopt.h on MinGW32 >= 3.0 X-Git-Tag: v3.8.0~68 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=4658bfad1878c47e2cb6a42ec5dbd9b0ad6739dd;p=pciutils.git pciutils: Do not include compat/getopt.h on MinGW32 >= 3.0 MinGW32 since version 3.0 declares getopt() function prototype in header file. --- diff --git a/pciutils.h b/pciutils.h index 3c5fac6..17e02c9 100644 --- a/pciutils.h +++ b/pciutils.h @@ -9,7 +9,20 @@ #include "lib/pci.h" #include "lib/sysdep.h" -#ifdef PCI_OS_WINDOWS +/* + * gcc predefines macro __MINGW32__ for all MinGW targets. + * Including some MinGW header (e.g. windef.h) defines additional + * macro __MINGW32_MAJOR_VERSION (available for all MinGW targets). + */ +#if defined(PCI_OS_WINDOWS) && defined(__MINGW32__) +#include +#endif + +/* + * On Windows only MinGW 3.0 and higher versions provides + * header file. Older MinGW versions and MSVC do not have it. + */ +#if defined(PCI_OS_WINDOWS) && !(defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 3) #include "compat/getopt.h" #else #include