summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2023-04-11 23:24:47 +0300
committerRan Benita <ran@unusedvar.com>2023-04-11 23:29:25 +0300
commitbd79a960f596574e9c2ea59347f9afac469ef532 (patch)
tree77a5c458c1d2ce7d07a404a69f7575caad5196ed /test
parent13d4b7f6417795b9ec634a766d0bf6afbf82c946 (diff)
downloadlibxkbcommon-bd79a960f596574e9c2ea59347f9afac469ef532.tar.gz
libxkbcommon-bd79a960f596574e9c2ea59347f9afac469ef532.tar.bz2
libxkbcommon-bd79a960f596574e9c2ea59347f9afac469ef532.zip
Possible fix for non-MSVC windows compilers
`_MSC_VER` is specific to MSVC, but there can be other compilers targeting windows. Hopefully they do define `_WIN32`, so let's use that. Refs: https://github.com/xkbcommon/libxkbcommon/issues/305 Signed-off-by: Ran Benita <ran@unusedvar.com>
Diffstat (limited to 'test')
-rw-r--r--test/common.c6
-rw-r--r--test/test.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/test/common.c b/test/common.c
index 1d5a99d..cb911e8 100644
--- a/test/common.c
+++ b/test/common.c
@@ -37,7 +37,7 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef _MSC_VER
+#ifdef _WIN32
#include <io.h>
#include <windows.h>
#else
@@ -171,7 +171,7 @@ test_makedir(const char *parent, const char *path)
dirname = asprintf_safe("%s/%s", parent, path);
assert(dirname);
-#ifdef _MSC_VER
+#ifdef _WIN32
err = _mkdir(dirname);
#else
err = mkdir(dirname, 0777);
@@ -184,7 +184,7 @@ test_makedir(const char *parent, const char *path)
char *
test_maketempdir(const char *template)
{
-#ifdef _MSC_VER
+#ifdef _WIN32
const char *basetmp = getenv("TMP");
if (basetmp == NULL) {
basetmp = getenv("TEMP");
diff --git a/test/test.h b/test/test.h
index ba06deb..afeec78 100644
--- a/test/test.h
+++ b/test/test.h
@@ -88,7 +88,7 @@ test_compile_rules(struct xkb_context *context, const char *rules,
const char *options);
-#ifdef _MSC_VER
+#ifdef _WIN32
#define setenv(varname, value, overwrite) _putenv_s((varname), (value))
#define unsetenv(varname) _putenv_s(varname, "")
#endif