summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/zix/attributes.h2
-rw-r--r--include/zix/sem.h2
-rw-r--r--meson.build33
-rw-r--r--meson/suppressions/meson.build7
-rw-r--r--src/win32/filesystem_win32.c2
5 files changed, 41 insertions, 5 deletions
diff --git a/include/zix/attributes.h b/include/zix/attributes.h
index dc367a1..518e5fb 100644
--- a/include/zix/attributes.h
+++ b/include/zix/attributes.h
@@ -70,7 +70,7 @@
// Unused parameter macro to suppresses warnings and make it impossible to use
#if defined(__cplusplus)
# define ZIX_UNUSED(name)
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) || defined(__clang__)
# define ZIX_UNUSED(name) name##_unused __attribute__((__unused__))
#elif defined(_MSC_VER)
# define ZIX_UNUSED(name) __pragma(warning(suppress : 4100)) name
diff --git a/include/zix/sem.h b/include/zix/sem.h
index 206e4e9..eeecfb1 100644
--- a/include/zix/sem.h
+++ b/include/zix/sem.h
@@ -129,7 +129,7 @@ struct ZixSemImpl {
#elif defined(_WIN32)
struct ZixSemImpl {
- HANDLE sem;
+ HANDLE ZIX_NONNULL sem;
};
#else /* !defined(__APPLE__) && !defined(_WIN32) */
diff --git a/meson.build b/meson.build
index 0fecc7b..55e460f 100644
--- a/meson.build
+++ b/meson.build
@@ -32,6 +32,15 @@ if get_option('strict') and not meson.is_subproject()
endif
subdir('meson/suppressions')
+if host_machine.system() == 'windows'
+ # Restrict Windows API usage to Vista and earlier
+ if cc.get_id() == 'msvc'
+ add_project_arguments('/D_WIN32_WINNT=0x0600', language: ['c', 'cpp'])
+ else
+ add_project_arguments('-D_WIN32_WINNT=0x0600', language: ['c', 'cpp'])
+ endif
+endif
+
##########################
# Platform Configuration #
##########################
@@ -384,6 +393,16 @@ if not get_option('tests').disabled()
endif
endif
+ # Set warning suppression flags specific to tests
+ test_suppressions = []
+ if cc.get_id() in ['clang', 'emscripten']
+ if host_machine.system() == 'windows'
+ test_suppressions += [
+ '-Wno-format-nonliteral',
+ ]
+ endif
+ endif
+
common_test_sources = files('test/failing_allocator.c')
foreach test : sequential_tests
@@ -394,7 +413,7 @@ if not get_option('tests').disabled()
executable(
'test_@0@'.format(test),
sources,
- c_args: c_suppressions + program_c_args,
+ c_args: c_suppressions + program_c_args + test_suppressions,
dependencies: [zix_dep],
include_directories: include_dirs,
link_args: program_link_args,
@@ -455,6 +474,12 @@ if not get_option('tests').disabled()
]
endif
+ if host_machine.system() == 'windows'
+ header_suppressions += [
+ '-Wno-nonportable-system-include-path',
+ ]
+ endif
+
elif cc.get_id() == 'gcc'
header_suppressions += [
'-Wno-padded',
@@ -504,6 +529,12 @@ if not get_option('tests').disabled()
]
endif
+ if host_machine.system() == 'windows'
+ cpp_test_args += [
+ '-Wno-nonportable-system-include-path',
+ ]
+ endif
+
elif cpp.get_id() == 'gcc'
cpp_test_args = [
'-Wall',
diff --git a/meson/suppressions/meson.build b/meson/suppressions/meson.build
index 2f07e61..d4abd30 100644
--- a/meson/suppressions/meson.build
+++ b/meson/suppressions/meson.build
@@ -24,6 +24,13 @@ if is_variable('cc')
'-Wno-padded',
]
+ if host_machine.system() == 'windows'
+ c_suppressions += [
+ '-Wno-deprecated-declarations',
+ '-Wno-nonportable-system-include-path',
+ ]
+ endif
+
elif cc.get_id() == 'gcc'
c_suppressions += [
'-Wno-bad-function-cast',
diff --git a/src/win32/filesystem_win32.c b/src/win32/filesystem_win32.c
index aa19a07..5c787c9 100644
--- a/src/win32/filesystem_win32.c
+++ b/src/win32/filesystem_win32.c
@@ -1,8 +1,6 @@
// Copyright 2007-2022 David Robillard <d@drobilla.net>
// SPDX-License-Identifier: ISC
-#define _WIN32_WINNT 0x0600 // Vista
-
#include "zix/bump_allocator.h"
#include "zix/filesystem.h"