diff options
59 files changed, 592 insertions, 560 deletions
diff --git a/.clang-format b/.clang-format index 8ee2675..c40ad9c 100644 --- a/.clang-format +++ b/.clang-format @@ -1,37 +1,38 @@ -# Copyright 2020-2022 David Robillard <d@drobilla.net> +# Copyright 2020-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC --- AlignConsecutiveAssignments: true AlignConsecutiveDeclarations: true -AlignEscapedNewlinesLeft: true +AlignEscapedNewlines: Left +AttributeMacros: + - LV2_DEPRECATED + - LV2_SYMBOL_EXPORT BasedOnStyle: Mozilla BraceWrapping: - AfterNamespace: false AfterClass: true AfterEnum: false AfterExternBlock: false AfterFunction: true + AfterNamespace: false AfterStruct: false SplitEmptyFunction: false SplitEmptyRecord: false BreakBeforeBraces: Custom Cpp11BracedListStyle: true +ForEachMacros: + - LV2_ATOM_OBJECT_BODY_FOREACH + - LV2_ATOM_OBJECT_FOREACH + - LV2_ATOM_SEQUENCE_BODY_FOREACH + - LV2_ATOM_SEQUENCE_FOREACH + - LV2_ATOM_TUPLE_BODY_FOREACH + - LV2_ATOM_TUPLE_FOREACH IndentCaseLabels: false IndentPPDirectives: AfterHash KeepEmptyLinesAtTheStartOfBlocks: false SpacesInContainerLiterals: false StatementMacros: - - LV2_DEPRECATED - LV2_DISABLE_DEPRECATION_WARNINGS - LV2_RESTORE_WARNINGS - - LV2_SYMBOL_EXPORT - _Pragma -ForEachMacros: - - LV2_ATOM_OBJECT_BODY_FOREACH - - LV2_ATOM_OBJECT_FOREACH - - LV2_ATOM_SEQUENCE_BODY_FOREACH - - LV2_ATOM_SEQUENCE_FOREACH - - LV2_ATOM_TUPLE_BODY_FOREACH - - LV2_ATOM_TUPLE_FOREACH ... diff --git a/.clang-tidy b/.clang-tidy index 5dc550b..013eda7 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,8 +1,9 @@ -# Copyright 2020-2022 David Robillard <d@drobilla.net> +# Copyright 2020-2025 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC Checks: > *, + -*-macro-to-enum, -*-magic-numbers, -altera-*, -bugprone-assignment-in-if-condition, @@ -10,8 +11,8 @@ Checks: > -bugprone-macro-parentheses, -clang-diagnostic-unused-function, -clang-diagnostic-unused-macros, - -llvmlibc-restrict-system-libc-headers, - -modernize-macro-to-enum, + -llvmlibc-*, + -misc-include-cleaner, -performance-no-int-to-ptr, -readability-identifier-length, CheckOptions: diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f4f6be7..a67a043 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -138,4 +138,4 @@ pages: paths: - public only: - - master + - main @@ -4,8 +4,9 @@ lv2 (1.18.11) unstable; urgency=medium * Fix pylint warning in test script * Override pkg-config dependency within meson * Remove troublesome lv2_atom_assert_double_fits_in_64_bits + * ui: Add types for Gtk4UI and Qt6UI - -- David Robillard <d@drobilla.net> Thu, 15 Dec 2022 17:15:58 +0000 + -- David Robillard <d@drobilla.net> Thu, 11 Jul 2024 23:58:50 +0000 lv2 (1.18.10) stable; urgency=medium @@ -37,12 +37,12 @@ Other projects may extend LV2, but must place their headers elsewhere. Headers are installed to `includedir` with paths like: - #include "lv2/urid/urid.h" + #include <lv2/urid/urid.h> For backwards compatibility, if the `old_headers` option is set, then headers are also installed to the older URI-based paths: - #include "lv2/lv2plug.in/ns/ext/urid/urid.h" + #include <lv2/lv2plug.in/ns/ext/urid/urid.h> Projects still using this style are encourated to migrate to the shorter style above. diff --git a/doc/c/reference.doxygen.in b/doc/c/reference.doxygen.in index 23e0329..333fe1c 100644 --- a/doc/c/reference.doxygen.in +++ b/doc/c/reference.doxygen.in @@ -805,6 +805,7 @@ INPUT = @LV2_SRCDIR@/doc/c/mainpage.md \ @LV2_SRCDIR@/include/lv2/atom/util.h \ @LV2_SRCDIR@/include/lv2/buf-size/buf-size.h \ @LV2_SRCDIR@/include/lv2/core/lv2.h \ + @LV2_SRCDIR@/include/lv2/core/lv2_util.h \ @LV2_SRCDIR@/include/lv2/data-access/data-access.h \ @LV2_SRCDIR@/include/lv2/dynmanifest/dynmanifest.h \ @LV2_SRCDIR@/include/lv2/event/event-helpers.h \ diff --git a/include/lv2/atom/atom.h b/include/lv2/atom/atom.h index ca607d3..41af21a 100644 --- a/include/lv2/atom/atom.h +++ b/include/lv2/atom/atom.h @@ -68,13 +68,13 @@ extern "C" { @param type The type of the atom, for example LV2_Atom_String. @param atom A variable-sized atom. */ -#define LV2_ATOM_CONTENTS(type, atom) ((void*)((uint8_t*)(atom) + sizeof(type))) +#define LV2_ATOM_CONTENTS(type, atom) ((void*)((type*)(atom) + 1U)) /** Const version of LV2_ATOM_CONTENTS. */ #define LV2_ATOM_CONTENTS_CONST(type, atom) \ - ((const void*)((const uint8_t*)(atom) + sizeof(type))) + ((const void*)((const type*)(atom) + 1U)) /** Return a pointer to the body of an Atom. The "body" of an atom is the diff --git a/include/lv2/atom/forge.h b/include/lv2/atom/forge.h index f894a5a..58b7512 100644 --- a/include/lv2/atom/forge.h +++ b/include/lv2/atom/forge.h @@ -38,10 +38,10 @@ @{ */ -#include "lv2/atom/atom.h" -#include "lv2/atom/util.h" -#include "lv2/core/attributes.h" -#include "lv2/urid/urid.h" +#include <lv2/atom/atom.h> +#include <lv2/atom/util.h> +#include <lv2/core/attributes.h> +#include <lv2/urid/urid.h> #include <assert.h> #include <stdbool.h> @@ -90,24 +90,24 @@ typedef struct { LV2_Atom_Forge_Frame* stack; - LV2_URID Blank LV2_DEPRECATED; - LV2_URID Bool; - LV2_URID Chunk; - LV2_URID Double; - LV2_URID Float; - LV2_URID Int; - LV2_URID Long; - LV2_URID Literal; - LV2_URID Object; - LV2_URID Path; - LV2_URID Property; + LV2_URID Blank LV2_DEPRECATED; + LV2_URID Bool; + LV2_URID Chunk; + LV2_URID Double; + LV2_URID Float; + LV2_URID Int; + LV2_URID Long; + LV2_URID Literal; + LV2_URID Object; + LV2_URID Path; + LV2_URID Property; LV2_URID Resource LV2_DEPRECATED; - LV2_URID Sequence; - LV2_URID String; - LV2_URID Tuple; - LV2_URID URI; - LV2_URID URID; - LV2_URID Vector; + LV2_URID Sequence; + LV2_URID String; + LV2_URID Tuple; + LV2_URID URI; + LV2_URID URID; + LV2_URID Vector; } LV2_Atom_Forge; static inline void @@ -492,7 +492,7 @@ lv2_atom_forge_vector(LV2_Atom_Forge* forge, const void* elems) { const LV2_Atom_Vector a = { - {(uint32_t)sizeof(LV2_Atom_Vector_Body) + n_elems * child_size, + {(uint32_t)sizeof(LV2_Atom_Vector_Body) + (n_elems * child_size), forge->Vector}, {child_size, child_type}}; const LV2_Atom_Forge_Ref out = lv2_atom_forge_write(forge, &a, sizeof(a)); @@ -569,8 +569,7 @@ lv2_atom_forge_object(LV2_Atom_Forge* forge, This function is deprecated and should not be used in new code. Use lv2_atom_forge_object() directly instead. */ -LV2_DEPRECATED -static inline LV2_Atom_Forge_Ref +LV2_DEPRECATED static inline LV2_Atom_Forge_Ref lv2_atom_forge_resource(LV2_Atom_Forge* forge, LV2_Atom_Forge_Frame* frame, LV2_URID id, @@ -588,8 +587,7 @@ lv2_atom_forge_resource(LV2_Atom_Forge* forge, This function is deprecated and should not be used in new code. Use lv2_atom_forge_object() directly instead. */ -LV2_DEPRECATED -static inline LV2_Atom_Forge_Ref +LV2_DEPRECATED static inline LV2_Atom_Forge_Ref lv2_atom_forge_blank(LV2_Atom_Forge* forge, LV2_Atom_Forge_Frame* frame, uint32_t id, diff --git a/include/lv2/atom/util.h b/include/lv2/atom/util.h index b1a1e93..9a3d8a3 100644 --- a/include/lv2/atom/util.h +++ b/include/lv2/atom/util.h @@ -1,4 +1,4 @@ -// Copyright 2008-2015 David Robillard <d@drobilla.net> +// Copyright 2008-2024 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC #ifndef LV2_ATOM_UTIL_H @@ -13,7 +13,7 @@ */ /** - @defgroup util Utilities + @defgroup atom_util Utilities @ingroup atom Utilities for working with atoms. @@ -21,7 +21,7 @@ @{ */ -#include "lv2/atom/atom.h" +#include <lv2/atom/atom.h> #include <stdarg.h> #include <stdbool.h> @@ -61,8 +61,7 @@ lv2_atom_is_null(const LV2_Atom* atom) static inline bool lv2_atom_equals(const LV2_Atom* a, const LV2_Atom* b) { - return (a == b) || ((a->type == b->type) && (a->size == b->size) && - !memcmp(a + 1, b + 1, a->size)); + return (a == b) || !memcmp(a, b, sizeof(LV2_Atom) + a->size); } /** @@ -182,7 +181,7 @@ lv2_atom_sequence_append_event(LV2_Atom_Sequence* seq, static inline LV2_Atom* lv2_atom_tuple_begin(const LV2_Atom_Tuple* tup) { - return (LV2_Atom*)(LV2_ATOM_BODY(tup)); + return (LV2_Atom*)tup + 1U; } /** Return true iff `i` has reached the end of `body`. */ @@ -252,7 +251,7 @@ static inline LV2_Atom_Property_Body* lv2_atom_object_next(const LV2_Atom_Property_Body* i) { const LV2_Atom* const value = - (const LV2_Atom*)((const uint8_t*)i + 2 * sizeof(uint32_t)); + (const LV2_Atom*)((const uint8_t*)i + (2 * sizeof(uint32_t))); return (LV2_Atom_Property_Body*)((const uint8_t*)i + lv2_atom_pad_size( (uint32_t)sizeof(LV2_Atom_Property_Body) + diff --git a/include/lv2/core/lv2.h b/include/lv2/core/lv2.h index b085ac5..e4b90fd 100644 --- a/include/lv2/core/lv2.h +++ b/include/lv2/core/lv2.h @@ -36,6 +36,7 @@ #define LV2_CORE__AnalyserPlugin LV2_CORE_PREFIX "AnalyserPlugin" ///< http://lv2plug.in/ns/lv2core#AnalyserPlugin #define LV2_CORE__AudioPort LV2_CORE_PREFIX "AudioPort" ///< http://lv2plug.in/ns/lv2core#AudioPort #define LV2_CORE__BandpassPlugin LV2_CORE_PREFIX "BandpassPlugin" ///< http://lv2plug.in/ns/lv2core#BandpassPlugin +#define LV2_CORE__BandstopPlugin LV2_CORE_PREFIX "BandstopPlugin" ///< http://lv2plug.in/ns/lv2core#BandstopPlugin #define LV2_CORE__CVPort LV2_CORE_PREFIX "CVPort" ///< http://lv2plug.in/ns/lv2core#CVPort #define LV2_CORE__ChorusPlugin LV2_CORE_PREFIX "ChorusPlugin" ///< http://lv2plug.in/ns/lv2core#ChorusPlugin #define LV2_CORE__CombPlugin LV2_CORE_PREFIX "CombPlugin" ///< http://lv2plug.in/ns/lv2core#CombPlugin @@ -99,6 +100,7 @@ #define LV2_CORE__index LV2_CORE_PREFIX "index" ///< http://lv2plug.in/ns/lv2core#index #define LV2_CORE__integer LV2_CORE_PREFIX "integer" ///< http://lv2plug.in/ns/lv2core#integer #define LV2_CORE__isLive LV2_CORE_PREFIX "isLive" ///< http://lv2plug.in/ns/lv2core#isLive +#define LV2_CORE__isSideChain LV2_CORE_PREFIX "isSideChain" ///< http://lv2plug.in/ns/lv2core#isSideChain #define LV2_CORE__latency LV2_CORE_PREFIX "latency" ///< http://lv2plug.in/ns/lv2core#latency #define LV2_CORE__maximum LV2_CORE_PREFIX "maximum" ///< http://lv2plug.in/ns/lv2core#maximum #define LV2_CORE__microVersion LV2_CORE_PREFIX "microVersion" ///< http://lv2plug.in/ns/lv2core#microVersion @@ -383,8 +385,7 @@ typedef struct LV2_Descriptor { Note that `index` has no meaning, hosts MUST NOT depend on it remaining consistent between loads of the plugin library. */ -LV2_SYMBOL_EXPORT -const LV2_Descriptor* +LV2_SYMBOL_EXPORT const LV2_Descriptor* lv2_descriptor(uint32_t index); /** @@ -449,8 +450,7 @@ typedef struct { be destroyed (using LV2_Lib_Descriptor::cleanup()) until all plugins loaded from that library have been destroyed. */ -LV2_SYMBOL_EXPORT -const LV2_Lib_Descriptor* +LV2_SYMBOL_EXPORT const LV2_Lib_Descriptor* lv2_lib_descriptor(const char* bundle_path, const LV2_Feature* const* features); /** diff --git a/include/lv2/core/lv2_util.h b/include/lv2/core/lv2_util.h index 4e98e07..82c5e1e 100644 --- a/include/lv2/core/lv2_util.h +++ b/include/lv2/core/lv2_util.h @@ -5,12 +5,12 @@ #define LV2_CORE_LV2_UTIL_H /** - @defgroup util Utilities + @defgroup lv2_util Utilities @ingroup lv2core @{ */ -#include "lv2/core/lv2.h" +#include <lv2/core/lv2.h> #include <stdarg.h> #include <stdbool.h> diff --git a/include/lv2/dynmanifest/dynmanifest.h b/include/lv2/dynmanifest/dynmanifest.h index b1a273c..7a6854d 100644 --- a/include/lv2/dynmanifest/dynmanifest.h +++ b/include/lv2/dynmanifest/dynmanifest.h @@ -15,7 +15,7 @@ @{ */ -#include "lv2/core/lv2.h" +#include <lv2/core/lv2.h> #include <stdio.h> @@ -56,8 +56,7 @@ typedef void* LV2_Dyn_Manifest_Handle; evaluate the result of the operation by examining the returned value and MUST NOT try to interpret the value of handle. */ -LV2_SYMBOL_EXPORT -int +LV2_SYMBOL_EXPORT int lv2_dyn_manifest_open(LV2_Dyn_Manifest_Handle* handle, const LV2_Feature* const* features); @@ -84,8 +83,7 @@ lv2_dyn_manifest_open(LV2_Dyn_Manifest_Handle* handle, @return 0 on success, otherwise a non-zero error code. */ -LV2_SYMBOL_EXPORT -int +LV2_SYMBOL_EXPORT int lv2_dyn_manifest_get_subjects(LV2_Dyn_Manifest_Handle handle, FILE* fp); /** @@ -118,8 +116,7 @@ lv2_dyn_manifest_get_subjects(LV2_Dyn_Manifest_Handle handle, FILE* fp); @return 0 on success, otherwise a non-zero error code. */ -LV2_SYMBOL_EXPORT -int +LV2_SYMBOL_EXPORT int lv2_dyn_manifest_get_data(LV2_Dyn_Manifest_Handle handle, FILE* fp, const char* uri); @@ -135,8 +132,7 @@ lv2_dyn_manifest_get_data(LV2_Dyn_Manifest_Handle handle, @param handle Dynamic manifest generator handle. */ -LV2_SYMBOL_EXPORT -void +LV2_SYMBOL_EXPORT void lv2_dyn_manifest_close(LV2_Dyn_Manifest_Handle handle); #ifdef __cplusplus diff --git a/include/lv2/event/event-helpers.h b/include/lv2/event/event-helpers.h index a9eb423..de386ca 100644 --- a/include/lv2/event/event-helpers.h +++ b/include/lv2/event/event-helpers.h @@ -9,8 +9,8 @@ <http://lv2plug.in/ns/ext/event>. */ -#include "lv2/core/attributes.h" -#include "lv2/event/event.h" +#include <lv2/core/attributes.h> +#include <lv2/event/event.h> #include <stdbool.h> #include <stdint.h> @@ -107,7 +107,8 @@ lv2_event_increment(LV2_Event_Iterator* iter) return false; } - LV2_Event* const ev = (LV2_Event*)(iter->buf->data + iter->offset); + const LV2_Event* const ev = + (const LV2_Event*)(iter->buf->data + iter->offset); iter->offset += lv2_event_pad_size((uint16_t)((uint16_t)sizeof(LV2_Event) + ev->size)); diff --git a/include/lv2/event/event.h b/include/lv2/event/event.h index e255291..42ba54f 100644 --- a/include/lv2/event/event.h +++ b/include/lv2/event/event.h @@ -36,7 +36,7 @@ #define LV2_EVENT_AUDIO_STAMP 0 ///< Special timestamp type for audio frames -#include "lv2/core/attributes.h" +#include <lv2/core/attributes.h> #include <stdint.h> @@ -51,8 +51,7 @@ LV2_DISABLE_DEPRECATION_WARNINGS Equal to 2^12 * 5 * 7 * 9 * 11 * 13 * 17, which is evenly divisible by all integers from 1 through 18 inclusive, and powers of 2 up to 2^12. */ -LV2_DEPRECATED -static const uint32_t LV2_EVENT_PPQN = 3136573440U; +LV2_DEPRECATED static const uint32_t LV2_EVENT_PPQN = 3136573440U; /** An LV2 event (header only). @@ -67,8 +66,7 @@ static const uint32_t LV2_EVENT_PPQN = 3136573440U; memcpy(ev_copy, ev, sizeof(LV2_Event) + ev->size); (or equivalent) */ -LV2_DEPRECATED -typedef struct { +LV2_DEPRECATED typedef struct { /** The frames portion of timestamp. The units used here can optionally be set for a port (with the lv2ev:timeUnits property), otherwise this is @@ -127,8 +125,7 @@ typedef struct { | | | | | | | | | | | | | | | | | | | | | | | | | |FRAMES |SUBFRMS|TYP|LEN|DATA..DATA..PAD|FRAMES | ... */ -LV2_DEPRECATED -typedef struct { +LV2_DEPRECATED typedef struct { /** The contents of the event buffer. This may or may not reside in the same block of memory as this header, plugins must not assume either. @@ -210,8 +207,7 @@ typedef struct { /** Opaque pointer to host data. */ -LV2_DEPRECATED -typedef void* LV2_Event_Callback_Data; +LV2_DEPRECATED typedef void* LV2_Event_Callback_Data; /** Non-POD events feature. @@ -221,8 +217,7 @@ typedef void* LV2_Event_Callback_Data; and data pointed to an instance of this struct. Note this feature is not mandatory to support the event extension. */ -LV2_DEPRECATED -typedef struct { +LV2_DEPRECATED typedef struct { /** Opaque pointer to host data. diff --git a/include/lv2/log/log.h b/include/lv2/log/log.h index b460f45..2616ffe 100644 --- a/include/lv2/log/log.h +++ b/include/lv2/log/log.h @@ -29,7 +29,7 @@ // clang-format on -#include "lv2/urid/urid.h" +#include <lv2/urid/urid.h> #include <stdarg.h> diff --git a/include/lv2/log/logger.h b/include/lv2/log/logger.h index 37fe564..83e2132 100644 --- a/include/lv2/log/logger.h +++ b/include/lv2/log/logger.h @@ -15,8 +15,8 @@ @{ */ -#include "lv2/log/log.h" -#include "lv2/urid/urid.h" +#include <lv2/log/log.h> +#include <lv2/urid/urid.h> #include <stdarg.h> #include <stdio.h> diff --git a/include/lv2/options/options.h b/include/lv2/options/options.h index 0169b46..5dea9f3 100644 --- a/include/lv2/options/options.h +++ b/include/lv2/options/options.h @@ -15,8 +15,8 @@ @{ */ -#include "lv2/core/lv2.h" -#include "lv2/urid/urid.h" +#include <lv2/core/lv2.h> +#include <lv2/urid/urid.h> #include <stdint.h> diff --git a/include/lv2/state/state.h b/include/lv2/state/state.h index a44f3cc..c1a357a 100644 --- a/include/lv2/state/state.h +++ b/include/lv2/state/state.h @@ -16,7 +16,7 @@ @{ */ -#include "lv2/core/lv2.h" +#include <lv2/core/lv2.h> #include <stddef.h> #include <stdint.h> diff --git a/include/lv2/ui/ui.h b/include/lv2/ui/ui.h index 4d2fed7..408b570 100644 --- a/include/lv2/ui/ui.h +++ b/include/lv2/ui/ui.h @@ -16,8 +16,8 @@ @{ */ -#include "lv2/core/lv2.h" -#include "lv2/urid/urid.h" +#include <lv2/core/lv2.h> +#include <lv2/urid/urid.h> #include <stdbool.h> #include <stdint.h> @@ -29,11 +29,13 @@ #define LV2_UI__CocoaUI LV2_UI_PREFIX "CocoaUI" ///< http://lv2plug.in/ns/extensions/ui#CocoaUI #define LV2_UI__Gtk3UI LV2_UI_PREFIX "Gtk3UI" ///< http://lv2plug.in/ns/extensions/ui#Gtk3UI +#define LV2_UI__Gtk4UI LV2_UI_PREFIX "Gtk4UI" ///< http://lv2plug.in/ns/extensions/ui#Gtk4UI #define LV2_UI__GtkUI LV2_UI_PREFIX "GtkUI" ///< http://lv2plug.in/ns/extensions/ui#GtkUI #define LV2_UI__PortNotification LV2_UI_PREFIX "PortNotification" ///< http://lv2plug.in/ns/extensions/ui#PortNotification #define LV2_UI__PortProtocol LV2_UI_PREFIX "PortProtocol" ///< http://lv2plug.in/ns/extensions/ui#PortProtocol #define LV2_UI__Qt4UI LV2_UI_PREFIX "Qt4UI" ///< http://lv2plug.in/ns/extensions/ui#Qt4UI #define LV2_UI__Qt5UI LV2_UI_PREFIX "Qt5UI" ///< http://lv2plug.in/ns/extensions/ui#Qt5UI +#define LV2_UI__Qt6UI LV2_UI_PREFIX "Qt6UI" ///< http://lv2plug.in/ns/extensions/ui#Qt6UI #define LV2_UI__UI LV2_UI_PREFIX "UI" ///< http://lv2plug.in/ns/extensions/ui#UI #define LV2_UI__WindowsUI LV2_UI_PREFIX "WindowsUI" ///< http://lv2plug.in/ns/extensions/ui#WindowsUI #define LV2_UI__X11UI LV2_UI_PREFIX "X11UI" ///< http://lv2plug.in/ns/extensions/ui#X11UI @@ -67,7 +69,7 @@ /** The index returned by LV2UI_Port_Map::port_index() for unknown ports. */ -#define LV2UI_INVALID_PORT_INDEX ((uint32_t)-1) +#define LV2UI_INVALID_PORT_INDEX ((uint32_t)(-1)) #ifdef __cplusplus extern "C" { @@ -509,8 +511,7 @@ typedef struct { This is the entry point to a UI library, which works in the same way as lv2_descriptor() but for UIs rather than plugins. */ -LV2_SYMBOL_EXPORT -const LV2UI_Descriptor* +LV2_SYMBOL_EXPORT const LV2UI_Descriptor* lv2ui_descriptor(uint32_t index); /** diff --git a/include/lv2/uri-map/uri-map.h b/include/lv2/uri-map/uri-map.h index dc25a55..90bc9bd 100644 --- a/include/lv2/uri-map/uri-map.h +++ b/include/lv2/uri-map/uri-map.h @@ -30,7 +30,7 @@ // clang-format on -#include "lv2/core/attributes.h" +#include <lv2/core/attributes.h> #include <stdint.h> @@ -43,8 +43,7 @@ LV2_DISABLE_DEPRECATION_WARNINGS /** Opaque pointer to host data. */ -LV2_DEPRECATED -typedef void* LV2_URI_Map_Callback_Data; +LV2_DEPRECATED typedef void* LV2_URI_Map_Callback_Data; /** URI Map Feature. @@ -53,8 +52,7 @@ typedef void* LV2_URI_Map_Callback_Data; plugin's instantiate method with URI "http://lv2plug.in/ns/ext/uri-map" and data pointed to an instance of this struct. */ -LV2_DEPRECATED -typedef struct { +LV2_DEPRECATED typedef struct { /** Opaque pointer to host data. diff --git a/include/lv2/worker/worker.h b/include/lv2/worker/worker.h index 613198b..2cfd052 100644 --- a/include/lv2/worker/worker.h +++ b/include/lv2/worker/worker.h @@ -15,7 +15,7 @@ @{ */ -#include "lv2/core/lv2.h" +#include <lv2/core/lv2.h> #include <stdint.h> diff --git a/lv2/atom.lv2/atom.ttl b/lv2/atom.lv2/atom.ttl index 03d3531..064d274 100644 --- a/lv2/atom.lv2/atom.ttl +++ b/lv2/atom.lv2/atom.ttl @@ -161,7 +161,7 @@ atom:Resource rdfs:subClassOf atom:Object ; rdfs:label "Resource" ; rdfs:comment "A named collection of properties with a URI." ; - owl:deprecated "true"^^xsd:boolean ; + owl:deprecated true ; atom:cType "LV2_Atom_Object" . atom:Blank @@ -169,7 +169,7 @@ atom:Blank rdfs:subClassOf atom:Object ; rdfs:label "Blank" ; rdfs:comment "An anonymous collection of properties without a URI." ; - owl:deprecated "true"^^xsd:boolean ; + owl:deprecated true ; atom:cType "LV2_Atom_Object" . atom:Sound diff --git a/lv2/core.lv2/lv2core.meta.ttl b/lv2/core.lv2/lv2core.meta.ttl index e593d2e..77f2c67 100644 --- a/lv2/core.lv2/lv2core.meta.ttl +++ b/lv2/core.lv2/lv2core.meta.ttl @@ -126,7 +126,7 @@ If the value has no explicit datatype, it is assumed to be a valid XHTML Basic 1.1 fragment suitable for use as the content of the `body` element of a page. XHTML Basic is a W3C Recommendation which defines a simplified subset of XHTML -intended to be reasonable to implement with limited resources, for exampe on +intended to be reasonable to implement with limited resources, for example on embedded devices. See [XHTML Basic, Section 3](http://www.w3.org/TR/xhtml-basic/#s_xhtmlmodules) for a list of valid tags. diff --git a/lv2/core.lv2/lv2core.ttl b/lv2/core.lv2/lv2core.ttl index 669ca2a..c7dcf50 100644 --- a/lv2/core.lv2/lv2core.ttl +++ b/lv2/core.lv2/lv2core.ttl @@ -17,7 +17,7 @@ lv2:Specification owl:Class ; rdfs:subClassOf doap:Project ; rdfs:label "Specification" ; - rdfs:comment "An LV2 specifiation." . + rdfs:comment "An LV2 specification." . lv2:Markdown a rdfs:Datatype ; @@ -374,7 +374,7 @@ lv2:connectionOptional lv2:reportsLatency a lv2:PortProperty ; - owl:deprecated "true"^^xsd:boolean ; + owl:deprecated true ; rdfs:label "reports latency" ; rdfs:comment "Control port value is the plugin latency in frames." . @@ -524,6 +524,13 @@ lv2:BandpassPlugin rdfs:label "Bandpass Filter Plugin" ; rdfs:comment "A filter that attenuates frequencies outside of some band." . +lv2:BandstopPlugin + a rdfs:Class , + owl:Class ; + rdfs:subClassOf lv2:FilterPlugin ; + rdfs:label "Bandstop Filter Plugin" ; + rdfs:comment "A filter that attenuates frequencies inside of some band." . + lv2:HighpassPlugin a rdfs:Class , owl:Class ; diff --git a/lv2/core.lv2/manifest.ttl b/lv2/core.lv2/manifest.ttl index 27793dc..0072346 100644 --- a/lv2/core.lv2/manifest.ttl +++ b/lv2/core.lv2/manifest.ttl @@ -4,8 +4,8 @@ <http://lv2plug.in/ns/lv2core> a lv2:Specification ; - lv2:minorVersion 18 ; - lv2:microVersion 6 ; + lv2:minorVersion 19 ; + lv2:microVersion 0 ; rdfs:seeAlso <lv2core.ttl> . <http://lv2plug.in/ns/lv2> diff --git a/lv2/ui.lv2/manifest.ttl b/lv2/ui.lv2/manifest.ttl index 4f5ed48..a77d6d0 100644 --- a/lv2/ui.lv2/manifest.ttl +++ b/lv2/ui.lv2/manifest.ttl @@ -3,6 +3,6 @@ <http://lv2plug.in/ns/extensions/ui> a lv2:Specification ; - lv2:minorVersion 2 ; - lv2:microVersion 24 ; + lv2:minorVersion 3 ; + lv2:microVersion 0 ; rdfs:seeAlso <ui.ttl> . diff --git a/lv2/ui.lv2/ui.meta.ttl b/lv2/ui.lv2/ui.meta.ttl index ede80ae..393d8d6 100644 --- a/lv2/ui.lv2/ui.meta.ttl +++ b/lv2/ui.lv2/ui.meta.ttl @@ -99,6 +99,16 @@ not be used in the same process. """^^lv2:Markdown . +ui:Gtk4UI + lv2:documentation """ + +The host must guarantee that the Gtk+ 4 library has been initialised and the +Glib main loop is running before the UI is instantiated. Note that this UI +type is not suitable for binary distribution since multiple versions of Gtk can +not be used in the same process. + +"""^^lv2:Markdown . + ui:Qt4UI lv2:documentation """ @@ -119,6 +129,16 @@ used in the same process. """^^lv2:Markdown . +ui:Qt6UI + lv2:documentation """ + +The host must guarantee that the Qt6 library has been initialised and the Qt6 +main loop is running before the UI is instantiated. Note that this UI type is +not suitable for binary distribution since multiple versions of Qt can not be +used in the same process. + +"""^^lv2:Markdown . + ui:X11UI lv2:documentation """ diff --git a/lv2/ui.lv2/ui.ttl b/lv2/ui.lv2/ui.ttl index a59b069..c42992e 100644 --- a/lv2/ui.lv2/ui.ttl +++ b/lv2/ui.lv2/ui.ttl @@ -34,6 +34,13 @@ ui:Gtk3UI rdfs:label "GTK3 UI" ; rdfs:comment "A UI where the widget is a pointer to a Gtk+ 3.0 GtkWidget." . +ui:Gtk4UI + a rdfs:Class , + owl:Class ; + rdfs:subClassOf ui:UI ; + rdfs:label "GTK4 UI" ; + rdfs:comment "A UI where the widget is a pointer to a Gtk+ 4.0 GtkWidget." . + ui:Qt4UI a rdfs:Class , owl:Class ; @@ -48,6 +55,13 @@ ui:Qt5UI rdfs:label "Qt5 UI" ; rdfs:comment "A UI where the widget is a pointer to a Qt5 QWidget." . +ui:Qt6UI + a rdfs:Class , + owl:Class ; + rdfs:subClassOf ui:UI ; + rdfs:label "Qt6 UI" ; + rdfs:comment "A UI where the widget is a pointer to a Qt6 QWidget." . + ui:X11UI a rdfs:Class , owl:Class ; @@ -81,13 +95,13 @@ ui:binary a rdf:Property , owl:ObjectProperty ; owl:sameAs lv2:binary ; - owl:deprecated "true"^^xsd:boolean ; + owl:deprecated true ; rdfs:label "binary" ; rdfs:comment "The shared library that a UI resides in." . ui:makeSONameResident a lv2:Feature ; - owl:deprecated "true"^^xsd:boolean ; + owl:deprecated true ; rdfs:label "make SO name resident" ; rdfs:comment "UI binary must not be unloaded." . @@ -174,7 +188,7 @@ ui:notifyType ui:resize a lv2:Feature , lv2:ExtensionData ; - owl:deprecated "true"^^xsd:boolean ; + owl:deprecated true ; rdfs:label "resize" ; rdfs:comment """A feature that provides control of, and notifications about, a UI's size.""" . diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py index d6e86f8..2226f43 100755 --- a/lv2specgen/lv2specgen.py +++ b/lv2specgen/lv2specgen.py @@ -1327,7 +1327,7 @@ def specgen( template = template.replace("@DESCRIPTION@", docs) now = int(os.environ.get("SOURCE_DATE_EPOCH", time.time())) - build_date = datetime.datetime.utcfromtimestamp(now) + build_date = datetime.datetime.fromtimestamp(now, datetime.timezone.utc) template = template.replace("@DATE@", build_date.strftime("%F")) template = template.replace("@TIME@", build_date.strftime("%F %H:%M UTC")) diff --git a/meson.build b/meson.build index aa9963f..07698de 100644 --- a/meson.build +++ b/meson.build @@ -18,9 +18,9 @@ lv2_docdir = get_option('datadir') / 'doc' / 'lv2' lv2_source_root = meson.current_source_dir() lv2_build_root = meson.current_build_dir() -####################### -# Compilers and Flags # -####################### +############################# +# Compilers and Build Tools # +############################# # Required tools pkg = import('pkgconfig') @@ -34,8 +34,165 @@ if not get_option('tests').disabled() endif endif -# Set global warning flags -subdir('meson/suppressions') +######################## +# Warning Suppressions # +######################## + +warning_level = get_option('warning_level') + +# C +c_suppressions = [] +if cc.get_id() in ['clang', 'emscripten'] + if warning_level == 'everything' + c_suppressions += [ + '-Wno-bad-function-cast', + '-Wno-cast-align', + '-Wno-cast-function-type-strict', + '-Wno-cast-qual', + '-Wno-declaration-after-statement', + '-Wno-documentation-unknown-command', + '-Wno-double-promotion', + '-Wno-float-conversion', + '-Wno-float-equal', + '-Wno-implicit-float-conversion', + '-Wno-padded', + '-Wno-reserved-id-macro', + '-Wno-shorten-64-to-32', + '-Wno-sign-conversion', + '-Wno-switch-default', + '-Wno-switch-enum', + '-Wno-unsafe-buffer-usage', + ] + + if not meson.is_cross_build() + c_suppressions += ['-Wno-poison-system-directories'] + endif + + if host_machine.system() == 'windows' + c_suppressions += ['-Wno-format-nonliteral'] + endif + endif + + if warning_level in ['everything', '3', '2'] + c_suppressions += ['-Wno-unused-parameter'] + endif + +elif cc.get_id() == 'gcc' + if warning_level == 'everything' + c_suppressions += [ + '-Wno-bad-function-cast', + '-Wno-cast-align', + '-Wno-cast-qual', + '-Wno-conversion', + '-Wno-double-promotion', + '-Wno-float-equal', + '-Wno-inline', + '-Wno-padded', + '-Wno-suggest-attribute=const', + '-Wno-suggest-attribute=malloc', + '-Wno-suggest-attribute=pure', + '-Wno-switch-default', + '-Wno-switch-enum', + '-Wno-unsuffixed-float-constants', + '-Wno-unused-const-variable', + ] + + if target_machine.system() == 'windows' + c_suppressions += ['-Wno-suggest-attribute=format'] + endif + endif + + if warning_level in ['everything', '3', '2'] + c_suppressions += ['-Wno-unused-parameter'] + endif + +elif cc.get_id() == 'msvc' + if warning_level == 'everything' + c_suppressions += [ + '/wd4061', # enumerator in switch is not explicitly handled + '/wd4244', # conversion with possible loss of data + '/wd4310', # cast truncates constant value + '/wd4365', # signed/unsigned mismatch + '/wd4464', # relative include path contains ".." + '/wd4514', # unreferenced inline function has been removed + '/wd4514', # unreferenced inline function has been removed + '/wd4706', # assignment within conditional expression + '/wd4710', # function not inlined + '/wd4711', # function selected for automatic inline expansion + '/wd4820', # padding added after construct + '/wd5045', # will insert Spectre mitigation for memory load + ] + endif + + if warning_level in ['everything', '3'] + c_suppressions += [ + '/wd4100', # unreferenced formal parameter + ] + endif + + if warning_level in ['everything', '3', '2'] + c_suppressions += [ + '/wd4267', # conversion from size_t to a smaller type + ] + endif +endif + +c_suppressions = cc.get_supported_arguments(c_suppressions) + +# C++ +if is_variable('cpp') + cpp_suppressions = [] + + if warning_level == 'everything' + if cpp.get_id() in ['clang', 'emscripten'] + cpp_suppressions += [ + '-Wno-c++98-compat', + '-Wno-cast-align', + '-Wno-cast-qual', + '-Wno-documentation-unknown-command', + '-Wno-nullability-extension', + '-Wno-padded', + '-Wno-reserved-id-macro', + '-Wno-unsafe-buffer-usage', + ] + + if not meson.is_cross_build() + cpp_suppressions += ['-Wno-poison-system-directories'] + endif + + if host_machine.system() == 'windows' + cpp_suppressions += ['-Wno-format-nonliteral'] + endif + + elif cpp.get_id() == 'gcc' + cpp_suppressions += [ + '-Wno-cast-align', + '-Wno-cast-qual', + '-Wno-inline', + '-Wno-padded', + '-Wno-unused-const-variable', + '-Wno-useless-cast', + ] + + if target_machine.system() == 'windows' + cpp_suppressions += ['-Wno-suggest-attribute=format'] + endif + + elif cpp.get_id() == 'msvc' + cpp_suppressions += [ + '/wd4514', # unreferenced inline function has been removed + '/wd4706', # assignment within conditional expression + '/wd4710', # function not inlined + '/wd4711', # function selected for automatic inline expansion + '/wd4820', # padding added after data member + '/wd5045', # will insert Spectre mitigation + '/wd5264', # const variable is not used + ] + endif + endif + + cpp_suppressions = cpp.get_supported_arguments(cpp_suppressions) +endif ########################## # LV2 Path Configuration # @@ -59,7 +216,7 @@ endif # Package/Dependency # ###################### -# Generage pkg-config file for external dependants +# Generate pkg-config file for external dependants pkg.generate( description: 'Plugin standard for audio systems', filebase: 'lv2', diff --git a/meson/suppressions/meson.build b/meson/suppressions/meson.build deleted file mode 100644 index 96ff2ab..0000000 --- a/meson/suppressions/meson.build +++ /dev/null @@ -1,167 +0,0 @@ -# Copyright 2020-2023 David Robillard <d@drobilla.net> -# SPDX-License-Identifier: 0BSD OR ISC - -# Project-specific warning suppressions - -warning_level = get_option('warning_level') - -##### -# C # -##### - -if is_variable('cc') - c_suppressions = [] - - if warning_level == 'everything' - if cc.get_id() in ['clang', 'emscripten'] - c_suppressions += [ - '-Wno-bad-function-cast', - '-Wno-cast-align', - '-Wno-cast-function-type-strict', - '-Wno-cast-qual', - '-Wno-declaration-after-statement', - '-Wno-documentation-unknown-command', - '-Wno-double-promotion', - '-Wno-float-conversion', - '-Wno-float-equal', - '-Wno-implicit-float-conversion', - '-Wno-padded', - '-Wno-reserved-id-macro', - '-Wno-shorten-64-to-32', - '-Wno-sign-conversion', - '-Wno-switch-enum', - '-Wno-unsafe-buffer-usage', - ] - - if not meson.is_cross_build() - c_suppressions += [ - '-Wno-poison-system-directories', - ] - endif - - if host_machine.system() == 'windows' - c_suppressions += [ - '-Wno-format-nonliteral', - ] - endif - - elif cc.get_id() == 'gcc' - c_suppressions += [ - '-Wno-bad-function-cast', - '-Wno-cast-align', - '-Wno-cast-qual', - '-Wno-conversion', - '-Wno-double-promotion', - '-Wno-float-equal', - '-Wno-inline', - '-Wno-padded', - '-Wno-suggest-attribute=const', - '-Wno-suggest-attribute=malloc', - '-Wno-suggest-attribute=pure', - '-Wno-switch-default', - '-Wno-switch-enum', - '-Wno-unsuffixed-float-constants', - '-Wno-unused-const-variable', - ] - - if target_machine.system() == 'windows' - c_suppressions += [ - '-Wno-suggest-attribute=format', - ] - endif - - elif cc.get_id() == 'msvc' - c_suppressions += [ - '/wd4061', # enumerator in switch is not explicitly handled - '/wd4244', # conversion with possible loss of data - '/wd4267', # conversion from size_t to a smaller type - '/wd4310', # cast truncates constant value - '/wd4365', # signed/unsigned mismatch - '/wd4464', # relative include path contains ".." - '/wd4514', # unreferenced inline function has been removed - '/wd4514', # unreferenced inline function has been removed - '/wd4706', # assignment within conditional expression - '/wd4710', # function not inlined - '/wd4711', # function selected for automatic inline expansion - '/wd4820', # padding added after construct - '/wd5045', # will insert Spectre mitigation for memory load - ] - endif - endif - - if cc.get_id() in ['clang', 'emscripten'] - c_suppressions += ['-Wno-unused-parameter'] - elif cc.get_id() == 'gcc' - c_suppressions += ['-Wno-unused-parameter'] - elif cc.get_id() == 'msvc' - c_suppressions += [ - '/wd4100', # unreferenced formal parameter - ] - endif - - c_suppressions = cc.get_supported_arguments(c_suppressions) -endif - -####### -# C++ # -####### - -if is_variable('cpp') - cpp_suppressions = [] - - if warning_level == 'everything' - if cpp.get_id() in ['clang', 'emscripten'] - cpp_suppressions += [ - '-Wno-c++98-compat', - '-Wno-cast-align', - '-Wno-cast-qual', - '-Wno-documentation-unknown-command', - '-Wno-nullability-extension', - '-Wno-padded', - '-Wno-reserved-id-macro', - '-Wno-unsafe-buffer-usage', - ] - - if not meson.is_cross_build() - cpp_suppressions += [ - '-Wno-poison-system-directories', - ] - endif - - if host_machine.system() == 'windows' - cpp_suppressions += [ - '-Wno-format-nonliteral', - ] - endif - - elif cpp.get_id() == 'gcc' - cpp_suppressions += [ - '-Wno-cast-align', - '-Wno-cast-qual', - '-Wno-inline', - '-Wno-padded', - '-Wno-unused-const-variable', - '-Wno-useless-cast', - ] - - if target_machine.system() == 'windows' - cpp_suppressions += [ - '-Wno-suggest-attribute=format', - ] - endif - - elif cpp.get_id() == 'msvc' - cpp_suppressions += [ - '/wd4514', # unreferenced inline function has been removed - '/wd4706', # assignment within conditional expression - '/wd4710', # function not inlined - '/wd4711', # function selected for automatic inline expansion - '/wd4820', # padding added after data member - '/wd5045', # will insert Spectre mitigation - '/wd5264', # const variable is not used - ] - endif - endif - - cpp_suppressions = cpp.get_supported_arguments(cpp_suppressions) -endif diff --git a/meson_options.txt b/meson_options.txt index 0a8c145..2661999 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,7 +1,7 @@ # Copyright 2021-2022 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC -option('docs', type: 'feature', value: 'auto', yield: true, +option('docs', type: 'feature', yield: true, description: 'Build documentation') option('lint', type: 'boolean', value: false, yield: true, @@ -16,10 +16,10 @@ option('old_headers', type: 'boolean', value: true, yield: true, option('online_docs', type: 'boolean', value: false, yield: true, description: 'Build documentation for online hosting') -option('plugins', type: 'feature', value: 'auto', yield: true, +option('plugins', type: 'feature', yield: true, description: 'Build example plugins') -option('tests', type: 'feature', value: 'auto', yield: true, +option('tests', type: 'feature', yield: true, description: 'Build tests') option('title', type: 'string', value: 'LV2', diff --git a/plugins/.clang-tidy b/plugins/.clang-tidy index 5fc86ab..44bac70 100644 --- a/plugins/.clang-tidy +++ b/plugins/.clang-tidy @@ -5,6 +5,7 @@ Checks: > -*-narrowing-conversions, -bugprone-assignment-in-if-condition, -bugprone-easily-swappable-parameters, + -bugprone-multi-level-implicit-pointer-conversion, -bugprone-suspicious-realloc-usage, -cert-err33-c, -hicpp-signed-bitwise, diff --git a/plugins/eg-amp.lv2/amp.c b/plugins/eg-amp.lv2/amp.c index 90a5769..c85d6ab 100644 --- a/plugins/eg-amp.lv2/amp.c +++ b/plugins/eg-amp.lv2/amp.c @@ -9,7 +9,7 @@ replacing `http:/` with `lv2` any header in the specification bundle can be included, in this case `lv2.h`. */ -#include "lv2/core/lv2.h" +#include <lv2/core/lv2.h> /** Include standard C headers */ #include <math.h> @@ -105,7 +105,7 @@ activate(LV2_Handle instance) {} /** Define a macro for converting a gain in dB to a coefficient. */ -#define DB_CO(g) ((g) > -90.0f ? powf(10.0f, (g)*0.05f) : 0.0f) +#define DB_CO(g) ((g) > -90.0f ? powf(10.0f, (g) * 0.05f) : 0.0f) /** The `run()` method is the main process function of the plugin. It processes @@ -196,8 +196,7 @@ static const LV2_Descriptor descriptor = {AMP_URI, This method is in the ``discovery'' threading class, so no other functions or methods in this plugin library will be called concurrently with it. */ -LV2_SYMBOL_EXPORT -const LV2_Descriptor* +LV2_SYMBOL_EXPORT const LV2_Descriptor* lv2_descriptor(uint32_t index) { return index == 0 ? &descriptor : NULL; diff --git a/plugins/eg-fifths.lv2/fifths.c b/plugins/eg-fifths.lv2/fifths.c index 9f6a388..22d5f8a 100644 --- a/plugins/eg-fifths.lv2/fifths.c +++ b/plugins/eg-fifths.lv2/fifths.c @@ -1,16 +1,16 @@ // Copyright 2014-2016 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC -#include "./uris.h" +#include "uris.h" -#include "lv2/atom/atom.h" -#include "lv2/atom/util.h" -#include "lv2/core/lv2.h" -#include "lv2/core/lv2_util.h" -#include "lv2/log/log.h" -#include "lv2/log/logger.h" -#include "lv2/midi/midi.h" -#include "lv2/urid/urid.h" +#include <lv2/atom/atom.h> +#include <lv2/atom/util.h> +#include <lv2/core/lv2.h> +#include <lv2/core/lv2_util.h> +#include <lv2/log/log.h> +#include <lv2/log/logger.h> +#include <lv2/midi/midi.h> +#include <lv2/urid/urid.h> #include <stdbool.h> #include <stdint.h> @@ -90,8 +90,8 @@ cleanup(LV2_Handle instance) static void run(LV2_Handle instance, uint32_t sample_count) { - Fifths* self = (Fifths*)instance; - FifthsURIs* uris = &self->uris; + Fifths* self = (Fifths*)instance; + const FifthsURIs* uris = &self->uris; // Struct for a 3 byte MIDI event, used for writing notes typedef struct { @@ -160,8 +160,7 @@ static const LV2_Descriptor descriptor = {EG_FIFTHS_URI, cleanup, extension_data}; -LV2_SYMBOL_EXPORT -const LV2_Descriptor* +LV2_SYMBOL_EXPORT const LV2_Descriptor* lv2_descriptor(uint32_t index) { return index == 0 ? &descriptor : NULL; diff --git a/plugins/eg-fifths.lv2/uris.h b/plugins/eg-fifths.lv2/uris.h index 7cbbd94..f32a6bd 100644 --- a/plugins/eg-fifths.lv2/uris.h +++ b/plugins/eg-fifths.lv2/uris.h @@ -4,10 +4,10 @@ #ifndef FIFTHS_URIS_H #define FIFTHS_URIS_H -#include "lv2/atom/atom.h" -#include "lv2/midi/midi.h" -#include "lv2/patch/patch.h" -#include "lv2/urid/urid.h" +#include <lv2/atom/atom.h> +#include <lv2/midi/midi.h> +#include <lv2/patch/patch.h> +#include <lv2/urid/urid.h> #define EG_FIFTHS_URI "http://lv2plug.in/plugins/eg-fifths" diff --git a/plugins/eg-metro.lv2/metro.c b/plugins/eg-metro.lv2/metro.c index f3fe164..e60a33f 100644 --- a/plugins/eg-metro.lv2/metro.c +++ b/plugins/eg-metro.lv2/metro.c @@ -1,14 +1,14 @@ // Copyright 2012-2016 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC -#include "lv2/atom/atom.h" -#include "lv2/atom/util.h" -#include "lv2/core/lv2.h" -#include "lv2/core/lv2_util.h" -#include "lv2/log/log.h" -#include "lv2/log/logger.h" -#include "lv2/time/time.h" -#include "lv2/urid/urid.h" +#include <lv2/atom/atom.h> +#include <lv2/atom/util.h> +#include <lv2/core/lv2.h> +#include <lv2/core/lv2_util.h> +#include <lv2/log/log.h> +#include <lv2/log/logger.h> +#include <lv2/time/time.h> +#include <lv2/urid/urid.h> #include <math.h> #include <stdbool.h> @@ -199,6 +199,7 @@ play(Metro* self, uint32_t begin, uint32_t end) { float* const output = self->ports.output; const uint32_t frames_per_beat = (uint32_t)(60.0f / self->bpm * self->rate); + const float attack_den = self->attack_len ? (float)self->attack_len : 1.0f; if (self->speed == 0.0f) { memset(output, 0, (end - begin) * sizeof(float)); @@ -209,8 +210,8 @@ play(Metro* self, uint32_t begin, uint32_t end) switch (self->state) { case STATE_ATTACK: // Amplitude increases from 0..1 until attack_len - output[i] = self->wave[self->wave_offset] * (float)self->elapsed_len / - (float)self->attack_len; + output[i] = + self->wave[self->wave_offset] * (float)self->elapsed_len / attack_den; if (self->elapsed_len >= self->attack_len) { self->state = STATE_DECAY; } @@ -331,8 +332,7 @@ static const LV2_Descriptor descriptor = { NULL, // extension_data }; -LV2_SYMBOL_EXPORT -const LV2_Descriptor* +LV2_SYMBOL_EXPORT const LV2_Descriptor* lv2_descriptor(uint32_t index) { return index == 0 ? &descriptor : NULL; diff --git a/plugins/eg-midigate.lv2/midigate.c b/plugins/eg-midigate.lv2/midigate.c index db2fdea..b4861db 100644 --- a/plugins/eg-midigate.lv2/midigate.c +++ b/plugins/eg-midigate.lv2/midigate.c @@ -1,14 +1,14 @@ // Copyright 2013-2016 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC -#include "lv2/atom/atom.h" -#include "lv2/atom/util.h" -#include "lv2/core/lv2.h" -#include "lv2/core/lv2_util.h" -#include "lv2/log/log.h" -#include "lv2/log/logger.h" -#include "lv2/midi/midi.h" -#include "lv2/urid/urid.h" +#include <lv2/atom/atom.h> +#include <lv2/atom/util.h> +#include <lv2/core/lv2.h> +#include <lv2/core/lv2_util.h> +#include <lv2/log/log.h> +#include <lv2/log/logger.h> +#include <lv2/midi/midi.h> +#include <lv2/urid/urid.h> #include <stdbool.h> #include <stdint.h> @@ -213,8 +213,7 @@ static const LV2_Descriptor descriptor = {MIDIGATE_URI, cleanup, extension_data}; -LV2_SYMBOL_EXPORT -const LV2_Descriptor* +LV2_SYMBOL_EXPORT const LV2_Descriptor* lv2_descriptor(uint32_t index) { return index == 0 ? &descriptor : NULL; diff --git a/plugins/eg-params.lv2/params.c b/plugins/eg-params.lv2/params.c index af96fc8..9fbaa46 100644 --- a/plugins/eg-params.lv2/params.c +++ b/plugins/eg-params.lv2/params.c @@ -3,17 +3,17 @@ #include "state_map.h" -#include "lv2/atom/atom.h" -#include "lv2/atom/forge.h" -#include "lv2/atom/util.h" -#include "lv2/core/lv2.h" -#include "lv2/core/lv2_util.h" -#include "lv2/log/log.h" -#include "lv2/log/logger.h" -#include "lv2/midi/midi.h" -#include "lv2/patch/patch.h" -#include "lv2/state/state.h" -#include "lv2/urid/urid.h" +#include <lv2/atom/atom.h> +#include <lv2/atom/forge.h> +#include <lv2/atom/util.h> +#include <lv2/core/lv2.h> +#include <lv2/core/lv2_util.h> +#include <lv2/log/log.h> +#include <lv2/log/logger.h> +#include <lv2/midi/midi.h> +#include <lv2/patch/patch.h> +#include <lv2/state/state.h> +#include <lv2/urid/urid.h> #include <stdbool.h> #include <stdint.h> @@ -320,7 +320,7 @@ save(LV2_Handle instance, LV2_State_Status st = LV2_STATE_SUCCESS; for (unsigned i = 0; i < N_PROPS; ++i) { - StateMapItem* prop = &self->props[i]; + const StateMapItem* prop = &self->props[i]; store_prop(self, map_path, &st, store, handle, prop->urid, prop->value); } @@ -512,8 +512,7 @@ static const LV2_Descriptor descriptor = {EG_PARAMS_URI, cleanup, extension_data}; -LV2_SYMBOL_EXPORT -const LV2_Descriptor* +LV2_SYMBOL_EXPORT const LV2_Descriptor* lv2_descriptor(uint32_t index) { return (index == 0) ? &descriptor : NULL; diff --git a/plugins/eg-params.lv2/state_map.h b/plugins/eg-params.lv2/state_map.h index 2a29e09..c81ea29 100644 --- a/plugins/eg-params.lv2/state_map.h +++ b/plugins/eg-params.lv2/state_map.h @@ -1,8 +1,8 @@ // Copyright 2016 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC -#include "lv2/atom/atom.h" -#include "lv2/urid/urid.h" +#include <lv2/atom/atom.h> +#include <lv2/urid/urid.h> #include <stdarg.h> #include <stdint.h> diff --git a/plugins/eg-sampler.lv2/atom_sink.h b/plugins/eg-sampler.lv2/atom_sink.h index 8966eb2..3319767 100644 --- a/plugins/eg-sampler.lv2/atom_sink.h +++ b/plugins/eg-sampler.lv2/atom_sink.h @@ -1,9 +1,9 @@ // Copyright 2016 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC -#include "lv2/atom/atom.h" -#include "lv2/atom/forge.h" -#include "lv2/atom/util.h" +#include <lv2/atom/atom.h> +#include <lv2/atom/forge.h> +#include <lv2/atom/util.h> #include <stdint.h> #include <string.h> diff --git a/plugins/eg-sampler.lv2/meson.build b/plugins/eg-sampler.lv2/meson.build index 9700df2..fe81918 100644 --- a/plugins/eg-sampler.lv2/meson.build +++ b/plugins/eg-sampler.lv2/meson.build @@ -8,12 +8,14 @@ data_filenames = ['manifest.ttl.in', 'sampler.ttl', 'click.wav'] samplerate_dep = dependency( 'samplerate', + include_type: 'system', required: get_option('plugins'), version: '>= 0.1.0', ) sndfile_dep = dependency( 'sndfile', + include_type: 'system', required: get_option('plugins'), version: '>= 1.0.0', ) diff --git a/plugins/eg-sampler.lv2/peaks.h b/plugins/eg-sampler.lv2/peaks.h index 47d6616..ff91546 100644 --- a/plugins/eg-sampler.lv2/peaks.h +++ b/plugins/eg-sampler.lv2/peaks.h @@ -14,10 +14,10 @@ requested, with reasonably sized incremental updates sent over plugin ports. */ -#include "lv2/atom/atom.h" -#include "lv2/atom/forge.h" -#include "lv2/atom/util.h" -#include "lv2/urid/urid.h" +#include <lv2/atom/atom.h> +#include <lv2/atom/forge.h> +#include <lv2/atom/util.h> +#include <lv2/urid/urid.h> #include <math.h> #include <stdbool.h> diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c index d870a07..6fc04c5 100644 --- a/plugins/eg-sampler.lv2/sampler.c +++ b/plugins/eg-sampler.lv2/sampler.c @@ -7,17 +7,17 @@ #include "peaks.h" #include "uris.h" -#include "lv2/atom/atom.h" -#include "lv2/atom/forge.h" -#include "lv2/atom/util.h" -#include "lv2/core/lv2.h" -#include "lv2/core/lv2_util.h" -#include "lv2/log/log.h" -#include "lv2/log/logger.h" -#include "lv2/midi/midi.h" -#include "lv2/state/state.h" -#include "lv2/urid/urid.h" -#include "lv2/worker/worker.h" +#include <lv2/atom/atom.h> +#include <lv2/atom/forge.h> +#include <lv2/atom/util.h> +#include <lv2/core/lv2.h> +#include <lv2/core/lv2_util.h> +#include <lv2/log/log.h> +#include <lv2/log/logger.h> +#include <lv2/midi/midi.h> +#include <lv2/state/state.h> +#include <lv2/urid/urid.h> +#include <lv2/worker/worker.h> #include <samplerate.h> #include <sndfile.h> @@ -249,9 +249,9 @@ work(LV2_Handle instance, static LV2_Worker_Status work_response(LV2_Handle instance, uint32_t size, const void* data) { - Sampler* self = (Sampler*)instance; - Sample* old_sample = self->sample; - Sample* new_sample = *(Sample* const*)data; + Sampler* self = (Sampler*)instance; + Sample* old_sample = self->sample; + const Sample* new_sample = *(Sample* const*)data; // Install the new sample self->sample = *(Sample* const*)data; @@ -353,7 +353,7 @@ deactivate(LV2_Handle instance) } /** Define a macro for converting a gain in dB to a coefficient. */ -#define DB_CO(g) ((g) > -90.0f ? powf(10.0f, (g)*0.05f) : 0.0f) +#define DB_CO(g) ((g) > -90.0f ? powf(10.0f, (g) * 0.05f) : 0.0f) /** Handle an incoming event in the audio thread. @@ -688,8 +688,7 @@ static const LV2_Descriptor descriptor = {EG_SAMPLER_URI, cleanup, extension_data}; -LV2_SYMBOL_EXPORT -const LV2_Descriptor* +LV2_SYMBOL_EXPORT const LV2_Descriptor* lv2_descriptor(uint32_t index) { return index == 0 ? &descriptor : NULL; diff --git a/plugins/eg-sampler.lv2/sampler_ui.c b/plugins/eg-sampler.lv2/sampler_ui.c index 16a8c71..769dde0 100644 --- a/plugins/eg-sampler.lv2/sampler_ui.c +++ b/plugins/eg-sampler.lv2/sampler_ui.c @@ -4,16 +4,16 @@ #include "peaks.h" #include "uris.h" -#include "lv2/atom/atom.h" -#include "lv2/atom/forge.h" -#include "lv2/atom/util.h" -#include "lv2/core/lv2.h" -#include "lv2/core/lv2_util.h" -#include "lv2/log/log.h" -#include "lv2/log/logger.h" -#include "lv2/midi/midi.h" -#include "lv2/ui/ui.h" -#include "lv2/urid/urid.h" +#include <lv2/atom/atom.h> +#include <lv2/atom/forge.h> +#include <lv2/atom/util.h> +#include <lv2/core/lv2.h> +#include <lv2/core/lv2_util.h> +#include <lv2/log/log.h> +#include <lv2/log/logger.h> +#include <lv2/midi/midi.h> +#include <lv2/ui/ui.h> +#include <lv2/urid/urid.h> #include <cairo.h> #include <gdk/gdk.h> @@ -183,13 +183,13 @@ on_canvas_expose(GtkWidget* widget, GdkEventExpose* event, gpointer data) // Draw line through top peaks for (int i = 0; i < n_peaks; ++i) { const float peak = peaks[i]; - cairo_line_to(cr, i * scale, mid_y + (peak / 2.0f) * size.height); + cairo_line_to(cr, i * scale, mid_y + ((peak / 2.0f) * size.height)); } // Continue through bottom peaks for (int i = n_peaks - 1; i >= 0; --i) { const float peak = peaks[i]; - cairo_line_to(cr, i * scale, mid_y - (peak / 2.0f) * size.height); + cairo_line_to(cr, i * scale, mid_y - ((peak / 2.0f) * size.height)); } // Close shape @@ -421,7 +421,7 @@ ui_hide(LV2UI_Handle handle) static int ui_idle(LV2UI_Handle handle) { - SamplerUI* ui = (SamplerUI*)handle; + const SamplerUI* ui = (const SamplerUI*)handle; if (ui->window) { gtk_main_iteration_do(false); } @@ -451,8 +451,7 @@ static const LV2UI_Descriptor descriptor = {SAMPLER_UI_URI, port_event, extension_data}; -LV2_SYMBOL_EXPORT -const LV2UI_Descriptor* +LV2_SYMBOL_EXPORT const LV2UI_Descriptor* lv2ui_descriptor(uint32_t index) { return index == 0 ? &descriptor : NULL; diff --git a/plugins/eg-sampler.lv2/uris.h b/plugins/eg-sampler.lv2/uris.h index f934390..9922f51 100644 --- a/plugins/eg-sampler.lv2/uris.h +++ b/plugins/eg-sampler.lv2/uris.h @@ -4,13 +4,13 @@ #ifndef SAMPLER_URIS_H #define SAMPLER_URIS_H -#include "lv2/atom/atom.h" -#include "lv2/atom/forge.h" -#include "lv2/atom/util.h" -#include "lv2/midi/midi.h" -#include "lv2/parameters/parameters.h" -#include "lv2/patch/patch.h" -#include "lv2/urid/urid.h" +#include <lv2/atom/atom.h> +#include <lv2/atom/forge.h> +#include <lv2/atom/util.h> +#include <lv2/midi/midi.h> +#include <lv2/parameters/parameters.h> +#include <lv2/patch/patch.h> +#include <lv2/urid/urid.h> #include <stdint.h> #include <stdio.h> @@ -164,7 +164,7 @@ read_set_file(const SamplerURIs* uris, const LV2_Atom_Object* obj) return NULL; } - return (const char*)LV2_ATOM_BODY_CONST(value); + return (const char*)&value[1]; } #endif /* SAMPLER_URIS_H */ diff --git a/plugins/eg-scope.lv2/examploscope.c b/plugins/eg-scope.lv2/examploscope.c index e3bb53b..5cdb610 100644 --- a/plugins/eg-scope.lv2/examploscope.c +++ b/plugins/eg-scope.lv2/examploscope.c @@ -2,17 +2,17 @@ // Copyright 2013 Robin Gareus <robin@gareus.org> // SPDX-License-Identifier: ISC -#include "./uris.h" - -#include "lv2/atom/atom.h" -#include "lv2/atom/forge.h" -#include "lv2/atom/util.h" -#include "lv2/core/lv2.h" -#include "lv2/core/lv2_util.h" -#include "lv2/log/log.h" -#include "lv2/log/logger.h" -#include "lv2/state/state.h" -#include "lv2/urid/urid.h" +#include "uris.h" + +#include <lv2/atom/atom.h> +#include <lv2/atom/forge.h> +#include <lv2/atom/util.h> +#include <lv2/core/lv2.h> +#include <lv2/core/lv2_util.h> +#include <lv2/log/log.h> +#include <lv2/log/logger.h> +#include <lv2/state/state.h> +#include <lv2/urid/urid.h> #include <stdbool.h> #include <stdint.h> @@ -169,11 +169,11 @@ connect_port(LV2_Handle handle, uint32_t port, void* data) http://lv2plug.in/ns/ext/atom#Float[Float]. */ static void -tx_rawaudio(LV2_Atom_Forge* forge, - ScoLV2URIs* uris, - const int32_t channel, - const size_t n_samples, - const float* data) +tx_rawaudio(LV2_Atom_Forge* forge, + const ScoLV2URIs* uris, + const int32_t channel, + const size_t n_samples, + const float* data) { LV2_Atom_Forge_Frame frame; @@ -398,8 +398,7 @@ static const LV2_Descriptor descriptor_stereo = {SCO_URI "#Stereo", cleanup, extension_data}; -LV2_SYMBOL_EXPORT -const LV2_Descriptor* +LV2_SYMBOL_EXPORT const LV2_Descriptor* lv2_descriptor(uint32_t index) { switch (index) { diff --git a/plugins/eg-scope.lv2/examploscope_ui.c b/plugins/eg-scope.lv2/examploscope_ui.c index 1c82d44..50b8f4c 100644 --- a/plugins/eg-scope.lv2/examploscope_ui.c +++ b/plugins/eg-scope.lv2/examploscope_ui.c @@ -1,14 +1,14 @@ // Copyright 2013 Robin Gareus <robin@gareus.org> // SPDX-License-Identifier: ISC -#include "./uris.h" +#include "uris.h" -#include "lv2/atom/atom.h" -#include "lv2/atom/forge.h" -#include "lv2/atom/util.h" -#include "lv2/core/lv2.h" -#include "lv2/ui/ui.h" -#include "lv2/urid/urid.h" +#include <lv2/atom/atom.h> +#include <lv2/atom/forge.h> +#include <lv2/atom/util.h> +#include <lv2/core/lv2.h> +#include <lv2/ui/ui.h> +#include <lv2/urid/urid.h> #include <cairo.h> #include <gdk/gdk.h> @@ -167,7 +167,7 @@ send_ui_enable(LV2UI_Handle handle) static gboolean on_cfg_changed(GtkWidget* widget, gpointer data) { - EgScopeUI* ui = (EgScopeUI*)data; + const EgScopeUI* ui = (const EgScopeUI*)data; if (!ui->updating) { // Only send UI state if the change is from user interaction send_ui_state(data); @@ -206,6 +206,7 @@ on_expose_event(GtkWidget* widget, GdkEventExpose* ev, gpointer data) assert(start < DAWIDTH); assert(end <= DAWIDTH); assert(start < end); + assert(ui->n_channels <= 2U); for (uint32_t c = 0; c < ui->n_channels; ++c) { ScoChan* chn = &ui->chn[c]; @@ -219,10 +220,10 @@ on_expose_event(GtkWidget* widget, GdkEventExpose* ev, gpointer data) * - (DAHEIGHT / 2) * (VAL) * (GAIN) * ) */ - const float chn_y_offset = DAHEIGHT * c + DAHEIGHT * 0.5f - 0.5f; - const float chn_y_scale = DAHEIGHT * 0.5f * gain; + const float chn_y_offset = (DAHEIGHT * c) + (DAHEIGHT * 0.5f) - 0.5f; + const float chn_y_scale = (DAHEIGHT * 0.5f) * gain; -#define CYPOS(VAL) (chn_y_offset - (VAL)*chn_y_scale) +#define CYPOS(VAL) (chn_y_offset - ((VAL) * chn_y_scale)) cairo_save(cr); @@ -292,15 +293,15 @@ on_expose_event(GtkWidget* widget, GdkEventExpose* ev, gpointer data) // Channel separator if (c > 0) { cairo_set_source_rgba(cr, .5, .5, .5, 1.0); - cairo_move_to(cr, 0, DAHEIGHT * c - .5); - cairo_line_to(cr, DAWIDTH, DAHEIGHT * c - .5); + cairo_move_to(cr, 0, (DAHEIGHT * c) - .5); + cairo_line_to(cr, DAWIDTH, (DAHEIGHT * c) - .5); cairo_stroke(cr); } // Zero scale line cairo_set_source_rgba(cr, .3, .3, .7, .5); - cairo_move_to(cr, 0, DAHEIGHT * (c + .5) - .5); - cairo_line_to(cr, DAWIDTH, DAHEIGHT * (c + .5) - .5); + cairo_move_to(cr, 0, (DAHEIGHT * (c + .5)) - .5); + cairo_line_to(cr, DAWIDTH, (DAHEIGHT * (c + .5)) - .5); cairo_stroke(cr); } @@ -327,12 +328,12 @@ on_expose_event(GtkWidget* widget, GdkEventExpose* ev, gpointer data) and https://github.com/x42/sisco.lv2 */ static int -process_channel(EgScopeUI* ui, - ScoChan* chn, - const size_t n_elem, - float const* data, - uint32_t* idx_start, - uint32_t* idx_end) +process_channel(const EgScopeUI* ui, + ScoChan* chn, + const size_t n_elem, + float const* data, + uint32_t* idx_start, + uint32_t* idx_end) { int overflow = 0; *idx_start = chn->idx; @@ -655,8 +656,7 @@ static const LV2UI_Descriptor descriptor = {SCO_URI "#ui", port_event, NULL}; -LV2_SYMBOL_EXPORT -const LV2UI_Descriptor* +LV2_SYMBOL_EXPORT const LV2UI_Descriptor* lv2ui_descriptor(uint32_t index) { return index == 0 ? &descriptor : NULL; diff --git a/plugins/eg-scope.lv2/uris.h b/plugins/eg-scope.lv2/uris.h index e2becae..d9d94be 100644 --- a/plugins/eg-scope.lv2/uris.h +++ b/plugins/eg-scope.lv2/uris.h @@ -4,9 +4,9 @@ #ifndef SCO_URIS_H #define SCO_URIS_H -#include "lv2/atom/atom.h" -#include "lv2/parameters/parameters.h" -#include "lv2/urid/urid.h" +#include <lv2/atom/atom.h> +#include <lv2/parameters/parameters.h> +#include <lv2/urid/urid.h> #define SCO_URI "http://lv2plug.in/plugins/eg-scope" @@ -18,7 +18,7 @@ typedef struct { LV2_URID atom_eventTransfer; LV2_URID param_sampleRate; - /* URIs defined for this plugin. It is best to re-use existing URIs as + /* URIs defined for this plugin. It is best to reuse existing URIs as much as possible, but plugins may need more vocabulary specific to their needs. These are used as types and properties for plugin:UI communication, as well as for saving state. */ diff --git a/test/.clang-tidy b/test/.clang-tidy index f6fe1d6..ef4d61f 100644 --- a/test/.clang-tidy +++ b/test/.clang-tidy @@ -1,9 +1,10 @@ -# Copyright 2020-2022 David Robillard <d@drobilla.net> +# Copyright 2020-2025 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC Checks: > -*-else-after-return, -bugprone-easily-swappable-parameters, + -bugprone-multi-level-implicit-pointer-conversion, -bugprone-suspicious-include, -cert-err33-c, -clang-diagnostic-unused-parameter, diff --git a/test/atom_test_utils.c b/test/atom_test_utils.c index e7d45d0..5c313a5 100644 --- a/test/atom_test_utils.c +++ b/test/atom_test_utils.c @@ -1,12 +1,15 @@ // Copyright 2012-2018 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC -#include "lv2/atom/atom.h" -#include "lv2/atom/forge.h" -#include "lv2/atom/util.h" -#include "lv2/log/log.h" -#include "lv2/urid/urid.h" +#undef NDEBUG +#include <lv2/atom/atom.h> +#include <lv2/atom/forge.h> +#include <lv2/atom/util.h> +#include <lv2/log/log.h> +#include <lv2/urid/urid.h> + +#include <assert.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> @@ -32,8 +35,11 @@ urid_map(LV2_URID_Map_Handle handle, const char* uri) } } - uris = (char**)realloc(uris, ++n_uris * sizeof(char*)); - uris[n_uris - 1] = copy_string(uri); + char** const new_uris = (char**)realloc(uris, (n_uris + 1) * sizeof(char*)); + assert(new_uris); + + uris = new_uris; + uris[n_uris++] = copy_string(uri); return n_uris; } diff --git a/test/cpp/.clang-tidy b/test/cpp/.clang-tidy index 02d730c..1fe1f27 100644 --- a/test/cpp/.clang-tidy +++ b/test/cpp/.clang-tidy @@ -1,4 +1,4 @@ -# Copyright 2020-2022 David Robillard <d@drobilla.net> +# Copyright 2020-2025 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC Checks: > @@ -17,10 +17,11 @@ Checks: > -cppcoreguidelines-pro-type-cstyle-cast, -cppcoreguidelines-pro-type-vararg, -hicpp-no-array-decay, + -hicpp-use-nullptr, -hicpp-vararg, -llvmlibc-callee-namespace, -modernize-use-nullptr, -modernize-use-using, + -performance-enum-size, -readability-implicit-bool-conversion, InheritParentConfig: true - diff --git a/test/cpp/test_build.cpp b/test/cpp/test_build.cpp index c8b2ca0..73868a4 100644 --- a/test/cpp/test_build.cpp +++ b/test/cpp/test_build.cpp @@ -10,36 +10,36 @@ _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") #endif -#include "lv2/atom/atom.h" // IWYU pragma: keep -#include "lv2/atom/forge.h" // IWYU pragma: keep -#include "lv2/atom/util.h" // IWYU pragma: keep -#include "lv2/buf-size/buf-size.h" // IWYU pragma: keep -#include "lv2/core/attributes.h" // IWYU pragma: keep -#include "lv2/core/lv2.h" // IWYU pragma: keep -#include "lv2/core/lv2_util.h" // IWYU pragma: keep -#include "lv2/data-access/data-access.h" // IWYU pragma: keep -#include "lv2/dynmanifest/dynmanifest.h" // IWYU pragma: keep -#include "lv2/event/event-helpers.h" // IWYU pragma: keep -#include "lv2/event/event.h" // IWYU pragma: keep -#include "lv2/instance-access/instance-access.h" // IWYU pragma: keep -#include "lv2/log/log.h" // IWYU pragma: keep -#include "lv2/log/logger.h" // IWYU pragma: keep -#include "lv2/midi/midi.h" // IWYU pragma: keep -#include "lv2/morph/morph.h" // IWYU pragma: keep -#include "lv2/options/options.h" // IWYU pragma: keep -#include "lv2/parameters/parameters.h" // IWYU pragma: keep -#include "lv2/patch/patch.h" // IWYU pragma: keep -#include "lv2/port-groups/port-groups.h" // IWYU pragma: keep -#include "lv2/port-props/port-props.h" // IWYU pragma: keep -#include "lv2/presets/presets.h" // IWYU pragma: keep -#include "lv2/resize-port/resize-port.h" // IWYU pragma: keep -#include "lv2/state/state.h" // IWYU pragma: keep -#include "lv2/time/time.h" // IWYU pragma: keep -#include "lv2/ui/ui.h" // IWYU pragma: keep -#include "lv2/units/units.h" // IWYU pragma: keep -#include "lv2/uri-map/uri-map.h" // IWYU pragma: keep -#include "lv2/urid/urid.h" // IWYU pragma: keep -#include "lv2/worker/worker.h" // IWYU pragma: keep +#include <lv2/atom/atom.h> // IWYU pragma: keep +#include <lv2/atom/forge.h> // IWYU pragma: keep +#include <lv2/atom/util.h> // IWYU pragma: keep +#include <lv2/buf-size/buf-size.h> // IWYU pragma: keep +#include <lv2/core/attributes.h> // IWYU pragma: keep +#include <lv2/core/lv2.h> // IWYU pragma: keep +#include <lv2/core/lv2_util.h> // IWYU pragma: keep +#include <lv2/data-access/data-access.h> // IWYU pragma: keep +#include <lv2/dynmanifest/dynmanifest.h> // IWYU pragma: keep +#include <lv2/event/event-helpers.h> // IWYU pragma: keep +#include <lv2/event/event.h> // IWYU pragma: keep +#include <lv2/instance-access/instance-access.h> // IWYU pragma: keep +#include <lv2/log/log.h> // IWYU pragma: keep +#include <lv2/log/logger.h> // IWYU pragma: keep +#include <lv2/midi/midi.h> // IWYU pragma: keep +#include <lv2/morph/morph.h> // IWYU pragma: keep +#include <lv2/options/options.h> // IWYU pragma: keep +#include <lv2/parameters/parameters.h> // IWYU pragma: keep +#include <lv2/patch/patch.h> // IWYU pragma: keep +#include <lv2/port-groups/port-groups.h> // IWYU pragma: keep +#include <lv2/port-props/port-props.h> // IWYU pragma: keep +#include <lv2/presets/presets.h> // IWYU pragma: keep +#include <lv2/resize-port/resize-port.h> // IWYU pragma: keep +#include <lv2/state/state.h> // IWYU pragma: keep +#include <lv2/time/time.h> // IWYU pragma: keep +#include <lv2/ui/ui.h> // IWYU pragma: keep +#include <lv2/units/units.h> // IWYU pragma: keep +#include <lv2/uri-map/uri-map.h> // IWYU pragma: keep +#include <lv2/urid/urid.h> // IWYU pragma: keep +#include <lv2/worker/worker.h> // IWYU pragma: keep int main() diff --git a/test/headers/.clang-tidy b/test/headers/.clang-tidy index dd0b95f..bf971cc 100644 --- a/test/headers/.clang-tidy +++ b/test/headers/.clang-tidy @@ -1,15 +1,15 @@ -# Copyright 2020-2022 David Robillard <d@drobilla.net> +# Copyright 2020-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC Checks: > *, + -*-macro-to-enum, -*-magic-numbers, -altera-*, -bugprone-assignment-in-if-condition, -bugprone-easily-swappable-parameters, -bugprone-macro-parentheses, -llvmlibc-restrict-system-libc-headers, - -modernize-macro-to-enum, -performance-no-int-to-ptr, -readability-identifier-length, CheckOptions: diff --git a/test/headers/test_headers.c b/test/headers/test_headers.c index 5736b44..d62b000 100644 --- a/test/headers/test_headers.c +++ b/test/headers/test_headers.c @@ -1,36 +1,36 @@ // Copyright 2022 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC -#include "lv2/atom/atom.h" // IWYU pragma: keep -#include "lv2/atom/forge.h" // IWYU pragma: keep -#include "lv2/atom/util.h" // IWYU pragma: keep -#include "lv2/buf-size/buf-size.h" // IWYU pragma: keep -#include "lv2/core/attributes.h" // IWYU pragma: keep -#include "lv2/core/lv2.h" // IWYU pragma: keep -#include "lv2/core/lv2_util.h" // IWYU pragma: keep -#include "lv2/data-access/data-access.h" // IWYU pragma: keep -#include "lv2/dynmanifest/dynmanifest.h" // IWYU pragma: keep -#include "lv2/event/event-helpers.h" // IWYU pragma: keep -#include "lv2/event/event.h" // IWYU pragma: keep -#include "lv2/instance-access/instance-access.h" // IWYU pragma: keep -#include "lv2/log/log.h" // IWYU pragma: keep -#include "lv2/log/logger.h" // IWYU pragma: keep -#include "lv2/midi/midi.h" // IWYU pragma: keep -#include "lv2/morph/morph.h" // IWYU pragma: keep -#include "lv2/options/options.h" // IWYU pragma: keep -#include "lv2/parameters/parameters.h" // IWYU pragma: keep -#include "lv2/patch/patch.h" // IWYU pragma: keep -#include "lv2/port-groups/port-groups.h" // IWYU pragma: keep -#include "lv2/port-props/port-props.h" // IWYU pragma: keep -#include "lv2/presets/presets.h" // IWYU pragma: keep -#include "lv2/resize-port/resize-port.h" // IWYU pragma: keep -#include "lv2/state/state.h" // IWYU pragma: keep -#include "lv2/time/time.h" // IWYU pragma: keep -#include "lv2/ui/ui.h" // IWYU pragma: keep -#include "lv2/units/units.h" // IWYU pragma: keep -#include "lv2/uri-map/uri-map.h" // IWYU pragma: keep -#include "lv2/urid/urid.h" // IWYU pragma: keep -#include "lv2/worker/worker.h" // IWYU pragma: keep +#include <lv2/atom/atom.h> // IWYU pragma: keep +#include <lv2/atom/forge.h> // IWYU pragma: keep +#include <lv2/atom/util.h> // IWYU pragma: keep +#include <lv2/buf-size/buf-size.h> // IWYU pragma: keep +#include <lv2/core/attributes.h> // IWYU pragma: keep +#include <lv2/core/lv2.h> // IWYU pragma: keep +#include <lv2/core/lv2_util.h> // IWYU pragma: keep +#include <lv2/data-access/data-access.h> // IWYU pragma: keep +#include <lv2/dynmanifest/dynmanifest.h> // IWYU pragma: keep +#include <lv2/event/event-helpers.h> // IWYU pragma: keep +#include <lv2/event/event.h> // IWYU pragma: keep +#include <lv2/instance-access/instance-access.h> // IWYU pragma: keep +#include <lv2/log/log.h> // IWYU pragma: keep +#include <lv2/log/logger.h> // IWYU pragma: keep +#include <lv2/midi/midi.h> // IWYU pragma: keep +#include <lv2/morph/morph.h> // IWYU pragma: keep +#include <lv2/options/options.h> // IWYU pragma: keep +#include <lv2/parameters/parameters.h> // IWYU pragma: keep +#include <lv2/patch/patch.h> // IWYU pragma: keep +#include <lv2/port-groups/port-groups.h> // IWYU pragma: keep +#include <lv2/port-props/port-props.h> // IWYU pragma: keep +#include <lv2/presets/presets.h> // IWYU pragma: keep +#include <lv2/resize-port/resize-port.h> // IWYU pragma: keep +#include <lv2/state/state.h> // IWYU pragma: keep +#include <lv2/time/time.h> // IWYU pragma: keep +#include <lv2/ui/ui.h> // IWYU pragma: keep +#include <lv2/units/units.h> // IWYU pragma: keep +#include <lv2/uri-map/uri-map.h> // IWYU pragma: keep +#include <lv2/urid/urid.h> // IWYU pragma: keep +#include <lv2/worker/worker.h> // IWYU pragma: keep #ifdef __GNUC__ __attribute__((const)) diff --git a/test/meson.build b/test/meson.build index 4790a48..2fec667 100644 --- a/test/meson.build +++ b/test/meson.build @@ -36,7 +36,7 @@ if get_option('lint') serdi = find_program( 'serdi', required: get_option('tests'), - version: '>= 0.31.5', + version: '>= 0.32.0', ) native_build = ( not meson.is_cross_build() @@ -157,6 +157,11 @@ test_names = [ 'forge_overflow', ] +atom_test_suppressions = [] +if cc.get_id() == 'gcc' + atom_test_suppressions += ['-Wno-stringop-overflow'] +endif + # Build and run tests foreach test_name : test_names test( @@ -164,7 +169,7 @@ foreach test_name : test_names executable( test_name, files('test_@0@.c'.format(test_name)), - c_args: c_suppressions, + c_args: c_suppressions + atom_test_suppressions, dependencies: [lv2_dep], ), suite: 'unit', diff --git a/test/test_atom.c b/test/test_atom.c index beac05c..f88c4c7 100644 --- a/test/test_atom.c +++ b/test/test_atom.c @@ -3,10 +3,10 @@ #include "atom_test_utils.c" -#include "lv2/atom/atom.h" -#include "lv2/atom/forge.h" -#include "lv2/atom/util.h" -#include "lv2/urid/urid.h" +#include <lv2/atom/atom.h> +#include <lv2/atom/forge.h> +#include <lv2/atom/util.h> +#include <lv2/urid/urid.h> #include <stdbool.h> #include <stdint.h> @@ -101,7 +101,7 @@ main(void) lv2_atom_forge_key(&forge, eg_path); LV2_Atom_String* path = (LV2_Atom_String*)lv2_atom_forge_deref( &forge, lv2_atom_forge_uri(&forge, pstr, pstr_len)); - char* pbody = (char*)LV2_ATOM_BODY(path); + char* pbody = (char*)&path[1]; if (!!strcmp(pbody, pstr)) { return test_fail("%s != \"%s\"\n", pbody, pstr); } @@ -112,7 +112,7 @@ main(void) lv2_atom_forge_key(&forge, eg_uri); LV2_Atom_String* uri = (LV2_Atom_String*)lv2_atom_forge_deref( &forge, lv2_atom_forge_uri(&forge, ustr, ustr_len)); - char* ubody = (char*)LV2_ATOM_BODY(uri); + char* ubody = (char*)&uri[1]; if (!!strcmp(ubody, ustr)) { return test_fail("%s != \"%s\"\n", ubody, ustr); } @@ -130,7 +130,7 @@ main(void) lv2_atom_forge_key(&forge, eg_string); LV2_Atom_String* string = (LV2_Atom_String*)lv2_atom_forge_deref( &forge, lv2_atom_forge_string(&forge, "hello", strlen("hello"))); - char* sbody = (char*)LV2_ATOM_BODY(string); + char* sbody = (char*)&string[1]; if (!!strcmp(sbody, "hello")) { return test_fail("%s != \"hello\"\n", sbody); } @@ -144,7 +144,7 @@ main(void) strlen("bonjour"), 0, urid_map(NULL, "http://lexvo.org/id/term/fr"))); - char* lbody = (char*)LV2_ATOM_CONTENTS(LV2_Atom_Literal, literal); + char* lbody = (char*)&literal[1]; if (!!strcmp(lbody, "bonjour")) { return test_fail("%s != \"bonjour\"\n", lbody); } @@ -186,7 +186,7 @@ main(void) LV2_Atom_Vector* vector = (LV2_Atom_Vector*)lv2_atom_forge_deref( &forge, lv2_atom_forge_vector(&forge, sizeof(int32_t), forge.Int, 4, elems)); - void* vec_body = LV2_ATOM_CONTENTS(LV2_Atom_Vector, vector); + const void* vec_body = LV2_ATOM_CONTENTS_CONST(LV2_Atom_Vector, vector); if (!!memcmp(elems, vec_body, sizeof(elems))) { return test_fail("Corrupt vector\n"); } diff --git a/test/test_build.c b/test/test_build.c index bdc47f6..83a69df 100644 --- a/test/test_build.c +++ b/test/test_build.c @@ -1,36 +1,36 @@ // Copyright 2022 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC -#include "lv2/atom/atom.h" // IWYU pragma: keep -#include "lv2/atom/forge.h" // IWYU pragma: keep -#include "lv2/atom/util.h" // IWYU pragma: keep -#include "lv2/buf-size/buf-size.h" // IWYU pragma: keep -#include "lv2/core/attributes.h" // IWYU pragma: keep -#include "lv2/core/lv2.h" // IWYU pragma: keep -#include "lv2/core/lv2_util.h" // IWYU pragma: keep -#include "lv2/data-access/data-access.h" // IWYU pragma: keep -#include "lv2/dynmanifest/dynmanifest.h" // IWYU pragma: keep -#include "lv2/event/event-helpers.h" // IWYU pragma: keep -#include "lv2/event/event.h" // IWYU pragma: keep -#include "lv2/instance-access/instance-access.h" // IWYU pragma: keep -#include "lv2/log/log.h" // IWYU pragma: keep -#include "lv2/log/logger.h" // IWYU pragma: keep -#include "lv2/midi/midi.h" // IWYU pragma: keep -#include "lv2/morph/morph.h" // IWYU pragma: keep -#include "lv2/options/options.h" // IWYU pragma: keep -#include "lv2/parameters/parameters.h" // IWYU pragma: keep -#include "lv2/patch/patch.h" // IWYU pragma: keep -#include "lv2/port-groups/port-groups.h" // IWYU pragma: keep -#include "lv2/port-props/port-props.h" // IWYU pragma: keep -#include "lv2/presets/presets.h" // IWYU pragma: keep -#include "lv2/resize-port/resize-port.h" // IWYU pragma: keep -#include "lv2/state/state.h" // IWYU pragma: keep -#include "lv2/time/time.h" // IWYU pragma: keep -#include "lv2/ui/ui.h" // IWYU pragma: keep -#include "lv2/units/units.h" // IWYU pragma: keep -#include "lv2/uri-map/uri-map.h" // IWYU pragma: keep -#include "lv2/urid/urid.h" // IWYU pragma: keep -#include "lv2/worker/worker.h" // IWYU pragma: keep +#include <lv2/atom/atom.h> // IWYU pragma: keep +#include <lv2/atom/forge.h> // IWYU pragma: keep +#include <lv2/atom/util.h> // IWYU pragma: keep +#include <lv2/buf-size/buf-size.h> // IWYU pragma: keep +#include <lv2/core/attributes.h> // IWYU pragma: keep +#include <lv2/core/lv2.h> // IWYU pragma: keep +#include <lv2/core/lv2_util.h> // IWYU pragma: keep +#include <lv2/data-access/data-access.h> // IWYU pragma: keep +#include <lv2/dynmanifest/dynmanifest.h> // IWYU pragma: keep +#include <lv2/event/event-helpers.h> // IWYU pragma: keep +#include <lv2/event/event.h> // IWYU pragma: keep +#include <lv2/instance-access/instance-access.h> // IWYU pragma: keep +#include <lv2/log/log.h> // IWYU pragma: keep +#include <lv2/log/logger.h> // IWYU pragma: keep +#include <lv2/midi/midi.h> // IWYU pragma: keep +#include <lv2/morph/morph.h> // IWYU pragma: keep +#include <lv2/options/options.h> // IWYU pragma: keep +#include <lv2/parameters/parameters.h> // IWYU pragma: keep +#include <lv2/patch/patch.h> // IWYU pragma: keep +#include <lv2/port-groups/port-groups.h> // IWYU pragma: keep +#include <lv2/port-props/port-props.h> // IWYU pragma: keep +#include <lv2/presets/presets.h> // IWYU pragma: keep +#include <lv2/resize-port/resize-port.h> // IWYU pragma: keep +#include <lv2/state/state.h> // IWYU pragma: keep +#include <lv2/time/time.h> // IWYU pragma: keep +#include <lv2/ui/ui.h> // IWYU pragma: keep +#include <lv2/units/units.h> // IWYU pragma: keep +#include <lv2/uri-map/uri-map.h> // IWYU pragma: keep +#include <lv2/urid/urid.h> // IWYU pragma: keep +#include <lv2/worker/worker.h> // IWYU pragma: keep int main(void) diff --git a/test/test_forge_overflow.c b/test/test_forge_overflow.c index 95e9b87..7e97ae4 100644 --- a/test/test_forge_overflow.c +++ b/test/test_forge_overflow.c @@ -3,9 +3,9 @@ #include "atom_test_utils.c" -#include "lv2/atom/atom.h" -#include "lv2/atom/forge.h" -#include "lv2/urid/urid.h" +#include <lv2/atom/atom.h> +#include <lv2/atom/forge.h> +#include <lv2/urid/urid.h> #include <assert.h> #include <stdint.h> @@ -90,7 +90,7 @@ test_literal_overflow(void) static int test_sequence_overflow(void) { - static const size_t size = sizeof(LV2_Atom_Sequence) + 6 * sizeof(LV2_Atom); + static const size_t size = sizeof(LV2_Atom_Sequence) + (6 * sizeof(LV2_Atom)); LV2_URID_Map map = {NULL, urid_map}; // Test over a range that fails in the sequence header and event components @@ -121,7 +121,7 @@ test_sequence_overflow(void) static int test_vector_head_overflow(void) { - static const size_t size = sizeof(LV2_Atom_Vector) + 3 * sizeof(LV2_Atom); + static const size_t size = sizeof(LV2_Atom_Vector) + (3 * sizeof(LV2_Atom)); LV2_URID_Map map = {NULL, urid_map}; // Test over a range that fails in the vector header and elements @@ -154,7 +154,7 @@ test_vector_head_overflow(void) static int test_vector_overflow(void) { - static const size_t size = sizeof(LV2_Atom_Vector) + 3 * sizeof(LV2_Atom); + static const size_t size = sizeof(LV2_Atom_Vector) + (3 * sizeof(LV2_Atom)); static const int32_t vec[] = {1, 2, 3}; LV2_URID_Map map = {NULL, urid_map}; @@ -181,7 +181,7 @@ test_vector_overflow(void) static int test_tuple_overflow(void) { - static const size_t size = sizeof(LV2_Atom_Tuple) + 3 * sizeof(LV2_Atom); + static const size_t size = sizeof(LV2_Atom_Tuple) + (3 * sizeof(LV2_Atom)); LV2_URID_Map map = {NULL, urid_map}; // Test over a range that fails in the tuple header and elements |