diff options
author | David Robillard <d@drobilla.net> | 2022-06-28 16:42:32 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-06-28 18:52:23 -0400 |
commit | 5e71a7d6b81f12c224cc06eacb6fee8e96b2ac8c (patch) | |
tree | 4d110e87040a0db8c9624c394a3d8d2e3b3cba04 | |
parent | acb8ea62ac287efcfb50f20cd419b70f6c5a15a9 (diff) | |
download | zix-5e71a7d6b81f12c224cc06eacb6fee8e96b2ac8c.tar.gz zix-5e71a7d6b81f12c224cc06eacb6fee8e96b2ac8c.tar.bz2 zix-5e71a7d6b81f12c224cc06eacb6fee8e96b2ac8c.zip |
Fix build as C with MSVC
-rw-r--r-- | include/zix/attributes.h | 2 | ||||
-rw-r--r-- | meson.build | 5 | ||||
-rw-r--r-- | meson/suppressions/meson.build | 1 | ||||
-rw-r--r-- | test/btree_test.c | 2 |
4 files changed, 4 insertions, 6 deletions
diff --git a/include/zix/attributes.h b/include/zix/attributes.h index 3499a7d..3824ce6 100644 --- a/include/zix/attributes.h +++ b/include/zix/attributes.h @@ -57,6 +57,8 @@ # define ZIX_UNUSED(name) #elif defined(__GNUC__) # define ZIX_UNUSED(name) name##_unused __attribute__((__unused__)) +#elif defined(_MSC_VER) +# define ZIX_UNUSED(name) __pragma(warning(suppress:4100)) name #else # define ZIX_UNUSED(name) name #endif diff --git a/meson.build b/meson.build index 92525e8..5b54107 100644 --- a/meson.build +++ b/meson.build @@ -66,11 +66,6 @@ int main(void) { void* mem; posix_memalign(&mem, 8, 8); }''' name: 'posix_memalign').to_int()) endif -# Build as C++ on MSVC -if cc.get_id() == 'msvc' - add_project_arguments(['/TP'], language: ['c']) -endif - ########### # Library # ########### diff --git a/meson/suppressions/meson.build b/meson/suppressions/meson.build index e5d5cf3..a85cd26 100644 --- a/meson/suppressions/meson.build +++ b/meson/suppressions/meson.build @@ -44,6 +44,7 @@ if is_variable('cc') elif cc.get_id() == 'msvc' c_suppressions += [ + '/wd4114', # same type qualifier used more than once '/wd4191', # unsafe function conversion '/wd4200', # zero-sized array in struct/union '/wd4365', # signed/unsigned mismatch diff --git a/test/btree_test.c b/test/btree_test.c index fb6b769..150a29d 100644 --- a/test/btree_test.c +++ b/test/btree_test.c @@ -220,7 +220,7 @@ test_remove_cases(void) static const uintptr_t s1 = 2u; static const uintptr_t s2 = 255u; - static const size_t n_insertions = s1 * s2 * 1000u; + const size_t n_insertions = s1 * s2 * 1000u; ZixBTree* const t = zix_btree_new(NULL, int_cmp, NULL); |