Fix Mingw versus XGetopt (again)

re: https://github.com/Unidata/netcdf-c/pull/2003#issuecomment-847637871

Turns out that mingw defines both _WIN32 and also defines getopt.
This means that this test:
````
#ifdef _WIN32
#include "XGetopt.h"
#endif
````
fails on this error:
````
../include/XGetopt.h:38:24: error: conflicting types for 'getopt'
````

Fix is to replace
````
#ifdef _WIN32
with
#if defined(_WIN32) && !defined(__MINGW32__)
````
This commit is contained in:
Dennis Heimbigner 2021-05-26 14:27:27 -06:00
parent 427166f02d
commit d3f6c126b6
16 changed files with 20 additions and 16 deletions

View File

@ -4,7 +4,7 @@
name: Run netCDF Tests
on: [pull_request]
on: [pull_request,push]
jobs:

View File

@ -15,7 +15,7 @@
#include <getopt.h>
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#define snprintf _snprintf
#endif

View File

@ -13,7 +13,7 @@
#include <getopt.h>
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#define snprintf _snprintf
#endif

View File

@ -8,7 +8,8 @@ Research/Unidata. See \ref copyright file for more info. */
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#define snprintf _snprintf
#endif

View File

@ -73,7 +73,7 @@ THIS SOFTWARE.
#include <unistd.h> /* read() getopt() */
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include <io.h>
#include "XGetopt.h"
#define snprintf _snprintf

View File

@ -31,7 +31,7 @@
#include "oc.h"
#include "ocx.h"
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#endif

View File

@ -12,7 +12,7 @@
#include <getopt.h>
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#endif

View File

@ -15,7 +15,7 @@
#include <getopt.h>
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#define snprintf _snprintf
#endif

View File

@ -15,7 +15,7 @@
#include <getopt.h>
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#endif

View File

@ -10,7 +10,7 @@
#include <getopt.h>
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#endif

View File

@ -13,7 +13,8 @@
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#endif

View File

@ -21,7 +21,7 @@
#include <getopt.h>
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#endif

View File

@ -14,7 +14,7 @@
#include <getopt.h>
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#endif

View File

@ -11,7 +11,7 @@ x * Copyright 2018, University Corporation for Atmospheric Research
#include <getopt.h>
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#endif

View File

@ -13,7 +13,8 @@
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#endif

View File

@ -13,7 +13,8 @@
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#endif