Don't use Win32 functions on CYGWIN.

This was a workaround for a cygwin bug which was fixed 4 years ago,
and cygwin hasn't supported affected versions for a long time.

2017-03-15  NightStrike  <nightstrike@gmail.com>
	    Janne Blomqvist  <jb@gcc.gnu.org>

	* intrinsics/random.c (getosrandom): Remove check for __CYGWIN__
	preprocessor flag.
	* intrinsics/system_clock.c: Likewise.
	(system_clock_4): Likewise.
	(system_clock_8): Likewise.
	* intrinsics/time_1.h: Don't include windows.h if __CYGWIN__ is
	defined.

Co-Authored-By: Janne Blomqvist <jb@gcc.gnu.org>

From-SVN: r246162
This commit is contained in:
NightStrike 2017-03-15 13:46:35 +00:00 committed by Janne Blomqvist
parent 05f659104f
commit add5b95a4a
4 changed files with 17 additions and 6 deletions

View file

@ -1,3 +1,14 @@
2017-03-15 NightStrike <nightstrike@gmail.com>
Janne Blomqvist <jb@gcc.gnu.org>
* intrinsics/random.c (getosrandom): Remove check for __CYGWIN__
preprocessor flag.
* intrinsics/system_clock.c: Likewise.
(system_clock_4): Likewise.
(system_clock_8): Likewise.
* intrinsics/time_1.h: Don't include windows.h if __CYGWIN__ is
defined.
2017-03-10 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/79956

View file

@ -304,7 +304,7 @@ static int
getosrandom (void *buf, size_t buflen)
{
/* rand_s is available in MinGW-w64 but not plain MinGW. */
#if defined(__MINGW64_VERSION_MAJOR) && !defined(__CYGWIN__)
#if defined(__MINGW64_VERSION_MAJOR)
unsigned int* b = buf;
for (unsigned i = 0; i < buflen / sizeof (unsigned int); i++)
rand_s (&b[i]);

View file

@ -29,7 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "time_1.h"
#if !defined(__MINGW32__) && !defined(__CYGWIN__)
#if !defined(__MINGW32__)
/* POSIX states that CLOCK_REALTIME must be present if clock_gettime
is available, others are optional. */
@ -99,7 +99,7 @@ gf_gettime_mono (time_t * secs, long * fracsecs, long * tck)
#endif
}
#endif /* !__MINGW32 && !__CYGWIN__ */
#endif /* !__MINGW32__ */
extern void
system_clock_4 (GFC_INTEGER_4 *count, GFC_INTEGER_4 *count_rate,
@ -121,7 +121,7 @@ void
system_clock_4 (GFC_INTEGER_4 *count, GFC_INTEGER_4 *count_rate,
GFC_INTEGER_4 *count_max)
{
#if defined(__MINGW32__) || defined(__CYGWIN__)
#if defined(__MINGW32__)
if (count)
{
/* Use GetTickCount here as the resolution and range is
@ -174,7 +174,7 @@ void
system_clock_8 (GFC_INTEGER_8 *count, GFC_INTEGER_8 *count_rate,
GFC_INTEGER_8 *count_max)
{
#if defined(__MINGW32__) || defined(__CYGWIN__)
#if defined(__MINGW32__)
LARGE_INTEGER cnt;
LARGE_INTEGER freq;
bool fail = false;

View file

@ -101,7 +101,7 @@ localtime_r (const time_t * timep, struct tm * result)
CPU_TIME intrinsics. Returns 0 for success or -1 if no
CPU time could be computed. */
#if defined(__MINGW32__) || defined(__CYGWIN__)
#if defined(__MINGW32__)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>