diff options
author | David Robillard <d@drobilla.net> | 2023-02-04 22:13:00 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-02-04 22:13:00 -0500 |
commit | bcb46050ea9c966e575b0bb333af176995b40b2e (patch) | |
tree | 922fb7a68513ee99efaf23838a4713d74798b34e | |
parent | 58418e5be2a491faa44d6d1c8d57052b1444814a (diff) | |
download | sratom-bcb46050ea9c966e575b0bb333af176995b40b2e.tar.gz sratom-bcb46050ea9c966e575b0bb333af176995b40b2e.tar.bz2 sratom-bcb46050ea9c966e575b0bb333af176995b40b2e.zip |
Fix clang and clang-tidy warnings on Windows
-rw-r--r-- | meson.build | 23 | ||||
-rw-r--r-- | meson/suppressions/meson.build | 7 | ||||
-rw-r--r-- | src/sratom.c | 6 | ||||
-rw-r--r-- | test/headers/.clang-tidy | 3 | ||||
-rw-r--r-- | test/test_sratom.c | 2 |
5 files changed, 34 insertions, 7 deletions
diff --git a/meson.build b/meson.build index d1d5baa..635a86c 100644 --- a/meson.build +++ b/meson.build @@ -36,9 +36,26 @@ subdir('meson/suppressions') m_dep = cc.find_library('m', required: false) -serd_dep = dependency('serd-0', fallback: 'serd', version: '>= 0.30.10') -sord_dep = dependency('sord-0', fallback: 'sord', version: '>= 0.16.10') -lv2_dep = dependency('lv2', fallback: 'lv2', version: '>= 1.18.4') +serd_dep = dependency( + 'serd-0', + fallback: 'serd', + include_type: 'system', + version: '>= 0.30.10', +) + +sord_dep = dependency( + 'sord-0', + fallback: 'sord', + include_type: 'system', + version: '>= 0.16.10', +) + +lv2_dep = dependency( + 'lv2', + fallback: 'lv2', + include_type: 'system', + version: '>= 1.18.4', +) ########################## # Platform Configuration # diff --git a/meson/suppressions/meson.build b/meson/suppressions/meson.build index afbfbef..470c761 100644 --- a/meson/suppressions/meson.build +++ b/meson/suppressions/meson.build @@ -32,6 +32,13 @@ if is_variable('cc') '-Wno-sign-conversion', ] + if host_machine.system() == 'windows' + c_suppressions += [ + '-Wno-deprecated-declarations', + '-Wno-format-nonliteral', + ] + endif + elif cc.get_id() == 'gcc' c_suppressions += [ '-Wno-cast-align', diff --git a/src/sratom.c b/src/sratom.c index 2222dd4..7e472a1 100644 --- a/src/sratom.c +++ b/src/sratom.c @@ -321,11 +321,11 @@ sratom_write(Sratom* sratom, new_node = true; datatype = serd_node_from_string(SERD_URI, USTR(LV2_MIDI__MidiEvent)); - const size_t len = size * 2UL; + const size_t len = (size_t)size * 2U; uint8_t* const str = (uint8_t*)calloc(len + 1, 1); for (uint32_t i = 0; i < size; ++i) { - snprintf((char*)str + (2UL * i), - len - (2UL * i) + 1UL, + snprintf((char*)str + ((size_t)2 * i), + len - ((size_t)2 * i) + 1U, "%02X", (unsigned)*((const uint8_t*)body + i)); } diff --git a/test/headers/.clang-tidy b/test/headers/.clang-tidy index 9457bcf..8c0843e 100644 --- a/test/headers/.clang-tidy +++ b/test/headers/.clang-tidy @@ -5,6 +5,9 @@ Checks: > *, -altera-*, -llvmlibc-*, + -modernize-macro-to-enum, + -performance-no-int-to-ptr, + -readability-identifier-length, WarningsAsErrors: '*' HeaderFilterRegex: '.*/sratom/[^/]+.h' FormatStyle: file diff --git a/test/test_sratom.c b/test/test_sratom.c index 3fa2db6..ba59737 100644 --- a/test/test_sratom.c +++ b/test/test_sratom.c @@ -73,7 +73,7 @@ SRATOM_LOG_FUNC(1, 2) static int test_fail(const char* fmt, ...) { - va_list args; + va_list args; // NOLINT(cppcoreguidelines-init-variables) va_start(args, fmt); fprintf(stderr, "error: "); vfprintf(stderr, fmt, args); |