Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented compatibility to MinGW-w64 #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)

project (winflexbison)

if(NOT MSVC)
message( FATAL_ERROR "Visual Studio Build supported only" )
endif()

add_definitions(-D_CRT_SECURE_NO_WARNINGS)

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
Expand Down
2 changes: 2 additions & 0 deletions common/m4/lib/clean-temp.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ extern int cleanup_temp_dir_contents (struct temp_dir *dir);
Return 0 upon success, or -1 if there was some problem. */
extern int cleanup_temp_dir (struct temp_dir *dir);

#ifndef __MINGW32__
typedef int mode_t;
#endif

/* Open a temporary file in a temporary directory.
Registers the resulting file descriptor to be closed. */
Expand Down
17 changes: 15 additions & 2 deletions common/misc/gethrxtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
/* Written by Paul Eggert. */

#include <config.h>
#ifdef __MINGW32__
#include <Windows.h>
#include <stdint.h>
#endif

#define GETHRXTIME_INLINE _GL_EXTERN_INLINE
#include "gethrxtime.h"
Expand Down Expand Up @@ -63,9 +67,18 @@ gethrxtime (void)
clock that might jump backwards, since it's the best we can do. */
{
struct timespec ts;
//gettime(&ts);
timespec_get(&ts, TIME_UTC);
#ifndef __MINGW32__
//gettime(&ts);
timespec_get(&ts, TIME_UTC);
return xtime_make (ts.tv_sec, ts.tv_nsec);
#else
uint64_t t;
GetSystemTimeAsFileTime((LPFILETIME)&t);
enum {
hundredsOfNanosecondsInASecond = 10000000
};
return xtime_make (t / hundredsOfNanosecondsInASecond, t % hundredsOfNanosecondsInASecond);
#endif
}
# endif
# endif
Expand Down