diff options
-rw-r--r-- | .clang-tidy | 3 | ||||
-rw-r--r-- | bindings/cpp/include/.clang-tidy | 2 | ||||
-rw-r--r-- | doc/c/api/meson.build | 6 | ||||
-rw-r--r-- | doc/c/meson.build | 6 | ||||
-rw-r--r-- | doc/c/xml/meson.build | 4 | ||||
-rw-r--r-- | doc/cpp/api/meson.build | 2 | ||||
-rw-r--r-- | doc/cpp/meson.build | 6 | ||||
-rw-r--r-- | doc/cpp/xml/meson.build | 4 | ||||
-rw-r--r-- | doc/meson.build | 18 | ||||
-rw-r--r-- | examples/.clang-tidy | 5 | ||||
-rw-r--r-- | examples/cube_view.h | 2 | ||||
-rw-r--r-- | examples/sybok.hpp | 8 | ||||
-rw-r--r-- | meson/suppressions/meson.build | 3 | ||||
-rw-r--r-- | meson_options.txt | 4 | ||||
-rw-r--r-- | src/.clang-tidy | 4 | ||||
-rw-r--r-- | src/mac.m | 16 | ||||
-rw-r--r-- | test/.clang-tidy | 4 | ||||
-rw-r--r-- | test/test_gl_free_unrealized.c | 14 | ||||
-rw-r--r-- | test/test_timer.c | 2 |
19 files changed, 65 insertions, 48 deletions
diff --git a/.clang-tidy b/.clang-tidy index 7f81150..9af40ce 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,4 +1,4 @@ -# Copyright 2020-2022 David Robillard <d@drobilla.net> +# Copyright 2020-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC Checks: > @@ -11,6 +11,7 @@ Checks: > -clang-diagnostic-unused-macros, -llvmlibc-*, -misc-include-cleaner, + -readability-avoid-nested-conditional-operator, -readability-identifier-length, CheckOptions: - key: hicpp-uppercase-literal-suffix.NewSuffixes diff --git a/bindings/cpp/include/.clang-tidy b/bindings/cpp/include/.clang-tidy index b7cee8e..f31247a 100644 --- a/bindings/cpp/include/.clang-tidy +++ b/bindings/cpp/include/.clang-tidy @@ -1,4 +1,4 @@ -# Copyright 2020-2022 David Robillard <d@drobilla.net> +# Copyright 2020-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC Checks: > diff --git a/doc/c/api/meson.build b/doc/c/api/meson.build index 6b21aae..846dc94 100644 --- a/doc/c/api/meson.build +++ b/doc/c/api/meson.build @@ -1,9 +1,9 @@ -# Copyright 2021 David Robillard <d@drobilla.net> +# Copyright 2021-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC c_pugl_rst = custom_target( - 'C API ReST Documentation', - command: [sphinxygen, '-f', '@INPUT0@', 'doc/c/api'], + 'c_pugl.rst', + command: [sphinxygen, '-f', '@INPUT0@', '@OUTDIR@'], input: [c_index_xml] + c_rst_files, output: 'pugl.rst', ) diff --git a/doc/c/meson.build b/doc/c/meson.build index 1401aa3..ba14ca9 100644 --- a/doc/c/meson.build +++ b/doc/c/meson.build @@ -1,4 +1,4 @@ -# Copyright 2021-2022 David Robillard <d@drobilla.net> +# Copyright 2021-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC config = configuration_data() @@ -43,7 +43,7 @@ subdir('xml') subdir('api') docs = custom_target( - 'singlehtml', + 'c_singlehtml', build_by_default: true, command: [ sphinx_build, @@ -61,7 +61,7 @@ docs = custom_target( ) docs = custom_target( - 'html', + 'c_html', build_by_default: true, command: [ sphinx_build, diff --git a/doc/c/xml/meson.build b/doc/c/xml/meson.build index 8b5e0e2..3e371dc 100644 --- a/doc/c/xml/meson.build +++ b/doc/c/xml/meson.build @@ -1,4 +1,4 @@ -# Copyright 2021 David Robillard <d@drobilla.net> +# Copyright 2021-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC config = configuration_data() @@ -12,7 +12,7 @@ c_doxyfile = configure_file( ) c_index_xml = custom_target( - 'c-index.xml', + 'c_index.xml', command: [doxygen, '@INPUT0@'], input: [c_doxyfile] + c_headers, output: 'index.xml', diff --git a/doc/cpp/api/meson.build b/doc/cpp/api/meson.build index 9b2f7e6..7f05f42 100644 --- a/doc/cpp/api/meson.build +++ b/doc/cpp/api/meson.build @@ -2,7 +2,7 @@ # SPDX-License-Identifier: 0BSD OR ISC cpp_pugl_rst = custom_target( - 'C++ API ReST Documentation', + 'cpp_pugl.rst', command: [sphinxygen, '-l', 'cpp', '-f', '@INPUT@', '@OUTDIR@'], input: cpp_index_xml, output: 'pugl.rst', diff --git a/doc/cpp/meson.build b/doc/cpp/meson.build index ca6bc5b..723510b 100644 --- a/doc/cpp/meson.build +++ b/doc/cpp/meson.build @@ -1,4 +1,4 @@ -# Copyright 2021 David Robillard <d@drobilla.net> +# Copyright 2021-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC config = configuration_data() @@ -30,7 +30,7 @@ subdir('xml') subdir('api') docs = custom_target( - 'singlehtml', + 'cpp_singlehtml', build_by_default: true, command: [ sphinx_build, @@ -48,7 +48,7 @@ docs = custom_target( ) docs = custom_target( - 'html', + 'cpp_html', command: [ sphinx_build, '-M', 'html', diff --git a/doc/cpp/xml/meson.build b/doc/cpp/xml/meson.build index 72bb8ee..083a6cc 100644 --- a/doc/cpp/xml/meson.build +++ b/doc/cpp/xml/meson.build @@ -1,4 +1,4 @@ -# Copyright 2021 David Robillard <d@drobilla.net> +# Copyright 2021-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC config = configuration_data() @@ -12,7 +12,7 @@ cpp_doxyfile = configure_file( ) cpp_index_xml = custom_target( - 'cpp-index.xml', + 'cpp_index.xml', command: [doxygen, '@INPUT0@'], input: [cpp_doxyfile] + c_headers + cpp_headers, output: 'index.xml', diff --git a/doc/meson.build b/doc/meson.build index e7a1763..6368f8a 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -1,19 +1,25 @@ -# Copyright 2021 David Robillard <d@drobilla.net> +# Copyright 2021-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC docdir = get_option('datadir') / 'doc' +# Find required external programs doxygen = find_program('doxygen', required: get_option('docs')) -sphinxygen = find_program('sphinxygen', required: false) sphinx_build = find_program('sphinx-build', required: get_option('docs')) -if not sphinxygen.found() - subproject('sphinxygen') - sphinxygen = find_program('sphinxygen', required: get_option('docs')) +# Find sphinxygen or fall back to subproject +if doxygen.found() and sphinx_build.found() + sphinxygen = find_program('sphinxygen', required: false) + if not sphinxygen.found() + subproject('sphinxygen') + sphinxygen = find_program('sphinxygen', required: get_option('docs')) + endif +else + sphinxygen = disabler() endif +# Build documentation if all required tools are found build_docs = doxygen.found() and sphinxygen.found() and sphinx_build.found() - if build_docs subdir('_static') subdir('c') diff --git a/examples/.clang-tidy b/examples/.clang-tidy index 7dde8bb..cba7eda 100644 --- a/examples/.clang-tidy +++ b/examples/.clang-tidy @@ -1,4 +1,4 @@ -# Copyright 2020-2023 David Robillard <d@drobilla.net> +# Copyright 2020-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC Checks: > @@ -8,6 +8,7 @@ Checks: > -android-cloexec-fopen, -bugprone-easily-swappable-parameters, -bugprone-macro-parentheses, + -bugprone-multi-level-implicit-pointer-conversion, -bugprone-reserved-identifier, -bugprone-suspicious-string-compare, -cert-dcl37-c, @@ -34,9 +35,11 @@ Checks: > -llvm-header-guard, -misc-misplaced-const, -modernize-use-trailing-return-type, + -performance-enum-size, -performance-no-int-to-ptr, -readability-function-cognitive-complexity, -readability-implicit-bool-conversion, + -readability-redundant-member-init, CheckOptions: - key: cppcoreguidelines-avoid-do-while.IgnoreMacros value: true diff --git a/examples/cube_view.h b/examples/cube_view.h index 399f625..6941870 100644 --- a/examples/cube_view.h +++ b/examples/cube_view.h @@ -4,7 +4,7 @@ #ifndef EXAMPLES_CUBE_VIEW_H #define EXAMPLES_CUBE_VIEW_H -#define GL_SILENCE_DEPRECATION 1 // NOLINT(modernize-macro-to-enum) +#define GL_SILENCE_DEPRECATION 1 // NOLINT(*-macro-to-enum) #include "demo_utils.h" diff --git a/examples/sybok.hpp b/examples/sybok.hpp index 49abdf0..db0cdd5 100644 --- a/examples/sybok.hpp +++ b/examples/sybok.hpp @@ -1751,10 +1751,10 @@ public: private: template<class T> - static inline VkResult wrapResult(const VkResult r, - const typename T::Handle handle, - typename T::Deleter&& deleter, - T& result) noexcept + static VkResult wrapResult(const VkResult r, + const typename T::Handle handle, + typename T::Deleter&& deleter, + T& result) noexcept { if (r) { return r; diff --git a/meson/suppressions/meson.build b/meson/suppressions/meson.build index 270e64e..df94bcf 100644 --- a/meson/suppressions/meson.build +++ b/meson/suppressions/meson.build @@ -1,4 +1,4 @@ -# Copyright 2020-2023 David Robillard <d@drobilla.net> +# Copyright 2020-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC # Project-specific warning suppressions @@ -121,6 +121,7 @@ if is_variable('cpp') '-Wno-inline', '-Wno-padded', '-Wno-sign-conversion', + '-Wno-switch-default', '-Wno-unsafe-buffer-usage', ] diff --git a/meson_options.txt b/meson_options.txt index faab87a..9e699a8 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,4 @@ -# Copyright 2021-2023 David Robillard <d@drobilla.net> +# Copyright 2021-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC option('cairo', type: 'feature', @@ -7,7 +7,7 @@ option('cairo', type: 'feature', option('examples', type: 'feature', yield: true, description: 'Build example programs') -option('docs', type: 'feature', +option('docs', type: 'feature', yield: true, description: 'Build documentation') option('docs_cpp', type: 'boolean', value: false, diff --git a/src/.clang-tidy b/src/.clang-tidy index d57b1a8..6d51f06 100644 --- a/src/.clang-tidy +++ b/src/.clang-tidy @@ -1,8 +1,10 @@ -# Copyright 2020-2022 David Robillard <d@drobilla.net> +# Copyright 2020-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC Checks: > -bugprone-easily-swappable-parameters, + -bugprone-multi-level-implicit-pointer-conversion, + -clang-analyzer-optin.core.EnumCastOutOfRange, -hicpp-multiway-paths-covered, -hicpp-signed-bitwise, -llvm-header-guard, @@ -630,10 +630,16 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type) - (void)scrollWheel:(NSEvent*)event { - const NSPoint wloc = [self eventLocation:event]; - const NSPoint rloc = [NSEvent mouseLocation]; - const double dx = -[event scrollingDeltaX]; - const double dy = [event scrollingDeltaY]; + const NSPoint wloc = [self eventLocation:event]; + const NSPoint rloc = [NSEvent mouseLocation]; + + double dx = -[event scrollingDeltaX]; + double dy = [event scrollingDeltaY]; + if (![event hasPreciseScrollingDeltas]) { + dx *= 10.0; + dy *= 10.0; + } + const PuglScrollDirection dir = ((dx == 0.0 && dy > 0.0) ? PUGL_SCROLL_UP @@ -653,7 +659,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type) rloc.x, [[NSScreen mainScreen] frame].size.height - rloc.y, getModifiers(event), - [event hasPreciseScrollingDeltas] ? PUGL_SCROLL_SMOOTH : dir, + dir, dx, dy, }; diff --git a/test/.clang-tidy b/test/.clang-tidy index 8ecb90f..c88c7b3 100644 --- a/test/.clang-tidy +++ b/test/.clang-tidy @@ -1,10 +1,12 @@ -# Copyright 2020-2023 David Robillard <d@drobilla.net> +# Copyright 2020-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC Checks: > + -bugprone-multi-level-implicit-pointer-conversion, -bugprone-suspicious-include, -cert-err33-c, -cert-err34-c, + -clang-analyzer-optin.core.EnumCastOutOfRange, -google-runtime-references, -hicpp-multiway-paths-covered, -hicpp-signed-bitwise, diff --git a/test/test_gl_free_unrealized.c b/test/test_gl_free_unrealized.c index 82fc18b..ba0d895 100644 --- a/test/test_gl_free_unrealized.c +++ b/test/test_gl_free_unrealized.c @@ -1,4 +1,4 @@ -// Copyright 2022 David Robillard <d@drobilla.net> +// Copyright 2022-2024 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC /* @@ -9,8 +9,6 @@ #undef NDEBUG -#include "test_utils.h" - #include "pugl/gl.h" #include "pugl/pugl.h" @@ -18,16 +16,14 @@ #include <stddef.h> typedef struct { - PuglWorld* world; - PuglView* view; - PuglTestOptions opts; + PuglWorld* world; + PuglView* view; } PuglTest; int -main(int argc, char** argv) +main(void) { - PuglTest test = { - puglNewWorld(PUGL_PROGRAM, 0), NULL, puglParseTestOptions(&argc, &argv)}; + PuglTest test = {puglNewWorld(PUGL_PROGRAM, 0), NULL}; // Set up view test.view = puglNewView(test.world); diff --git a/test/test_timer.c b/test/test_timer.c index 1c9f281..405a5c2 100644 --- a/test/test_timer.c +++ b/test/test_timer.c @@ -19,7 +19,7 @@ #include <stdint.h> #include <stdio.h> -#define NUM_TIMERS 4U // NOLINT(modernize-macro-to-enum) +#define NUM_TIMERS 4U // NOLINT(*-macro-to-enum) #ifdef __APPLE__ static const double timeout = 1 / 60.0; |