Skip to content

mingw: Fix compilation issues #597

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

Merged
merged 1 commit into from
May 11, 2014
Merged
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
14 changes: 12 additions & 2 deletions unix/modtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,19 @@ void msec_sleep_tv(struct timeval *tv) {
#define sleep_select select
#endif

#if CLOCKS_PER_SEC == 1000000 // POSIX
// mingw32 defines CLOCKS_PER_SEC as ((clock_t)<somevalue>) but preprocessor does not handle casts
#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
#define MP_REMOVE_BRACKETSA(x)
#define MP_REMOVE_BRACKETSB(x) MP_REMOVE_BRACKETSA x
#define MP_REMOVE_BRACKETSC(x) MP_REMOVE_BRACKETSB x
#define MP_CLOCKS_PER_SEC MP_REMOVE_BRACKETSC(CLOCKS_PER_SEC)
#else
#define MP_CLOCKS_PER_SEC CLOCKS_PER_SEC
#endif

#if defined(MP_CLOCKS_PER_SEC) && (MP_CLOCKS_PER_SEC == 1000000) // POSIX
#define CLOCK_DIV 1000.0
#elif CLOCKS_PER_SEC == 1000 // WIN32
#elif defined(MP_CLOCKS_PER_SEC) && (MP_CLOCKS_PER_SEC == 1000) // WIN32
#define CLOCK_DIV 1.0
#else
#error Unsupported clock() implementation
Expand Down
2 changes: 1 addition & 1 deletion windows/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include <stdlib.h>
#include <stdio.h>
#include <Windows.h>
#include <windows.h>

HANDLE hSleepEvent = NULL;

Expand Down
2 changes: 1 addition & 1 deletion windows/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* THE SOFTWARE.
*/

#include <Windows.h>
#include <windows.h>

extern HANDLE hSleepEvent;

Expand Down