Message ID | 20240830152721.1420313-21-mzamazal@redhat.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Hi MIlan, Thank you for the patch. On Fri, Aug 30, 2024 at 05:27:17PM +0200, Milan Zamazal wrote: > The LSP autoformatter doesn't like some of the current formatting, let's > make it happy. > > Signed-off-by: Milan Zamazal <mzamazal@redhat.com> > --- > include/libcamera/base/log.h | 22 +++++----- > include/libcamera/base/span.h | 40 +++++++++---------- > include/libcamera/base/utils.h | 2 +- > include/libcamera/internal/camera_manager.h | 4 +- > .../libcamera/internal/ipa_data_serializer.h | 7 ++-- > 5 files changed, 38 insertions(+), 37 deletions(-) > > diff --git a/include/libcamera/base/log.h b/include/libcamera/base/log.h > index 62093012..38b0ab01 100644 > --- a/include/libcamera/base/log.h > +++ b/include/libcamera/base/log.h > @@ -43,17 +43,17 @@ private: > LogSeverity severity_; > }; > > -#define LOG_DECLARE_CATEGORY(name) \ > -extern const LogCategory &_LOG_CATEGORY(name)(); > - > -#define LOG_DEFINE_CATEGORY(name) \ > -LOG_DECLARE_CATEGORY(name) \ > -const LogCategory &_LOG_CATEGORY(name)() \ > -{ \ > - /* The instance will be deleted by the Logger destructor. */ \ > - static LogCategory *category = LogCategory::create(#name); \ > - return *category; \ > -} > +#define LOG_DECLARE_CATEGORY(name) \ > + extern const LogCategory &_LOG_CATEGORY(name)(); > + > +#define LOG_DEFINE_CATEGORY(name) \ > + LOG_DECLARE_CATEGORY(name) \ > + const LogCategory &_LOG_CATEGORY(name)() \ > + { \ > + /* The instance will be deleted by the Logger destructor. */ \ > + static LogCategory *category = LogCategory::create(#name); \ > + return *category; \ > + } I'd rather not. > > class LogMessage > { > diff --git a/include/libcamera/base/span.h b/include/libcamera/base/span.h > index 92cce4f0..86201aa2 100644 > --- a/include/libcamera/base/span.h > +++ b/include/libcamera/base/span.h Nack for the whole file. > @@ -125,7 +125,7 @@ public: > constexpr Span(element_type (&arr)[N], > std::enable_if_t<std::is_convertible<std::remove_pointer_t<decltype(utils::data(arr))> (*)[], > element_type (*)[]>::value && > - N == Extent, > + N == Extent, > std::nullptr_t> = nullptr) noexcept > : data_(arr) > { > @@ -135,7 +135,7 @@ public: > constexpr Span(std::array<value_type, N> &arr, > std::enable_if_t<std::is_convertible<std::remove_pointer_t<decltype(utils::data(arr))> (*)[], > element_type (*)[]>::value && > - N == Extent, > + N == Extent, > std::nullptr_t> = nullptr) noexcept > : data_(arr.data()) > { > @@ -145,7 +145,7 @@ public: > constexpr Span(const std::array<value_type, N> &arr, > std::enable_if_t<std::is_convertible<std::remove_pointer_t<decltype(utils::data(arr))> (*)[], > element_type (*)[]>::value && > - N == Extent, > + N == Extent, > std::nullptr_t> = nullptr) noexcept > : data_(arr.data()) > { > @@ -154,10 +154,10 @@ public: > template<class Container> > explicit constexpr Span(Container &cont, > std::enable_if_t<!details::is_span<Container>::value && > - !details::is_array<Container>::value && > - !std::is_array<Container>::value && > - std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], > - element_type (*)[]>::value, > + !details::is_array<Container>::value && > + !std::is_array<Container>::value && > + std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], > + element_type (*)[]>::value, > std::nullptr_t> = nullptr) > : data_(utils::data(cont)) > { > @@ -166,10 +166,10 @@ public: > template<class Container> > explicit constexpr Span(const Container &cont, > std::enable_if_t<!details::is_span<Container>::value && > - !details::is_array<Container>::value && > - !std::is_array<Container>::value && > - std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], > - element_type (*)[]>::value, > + !details::is_array<Container>::value && > + !std::is_array<Container>::value && > + std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], > + element_type (*)[]>::value, > std::nullptr_t> = nullptr) > : data_(utils::data(cont)) > { > @@ -179,7 +179,7 @@ public: > template<class U, std::size_t N> > explicit constexpr Span(const Span<U, N> &s, > std::enable_if_t<std::is_convertible<U (*)[], element_type (*)[]>::value && > - N == Extent, > + N == Extent, > std::nullptr_t> = nullptr) noexcept > : data_(s.data()) > { > @@ -316,10 +316,10 @@ public: > template<class Container> > constexpr Span(Container &cont, > std::enable_if_t<!details::is_span<Container>::value && > - !details::is_array<Container>::value && > - !std::is_array<Container>::value && > - std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], > - element_type (*)[]>::value, > + !details::is_array<Container>::value && > + !std::is_array<Container>::value && > + std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], > + element_type (*)[]>::value, > std::nullptr_t> = nullptr) > : data_(utils::data(cont)), size_(utils::size(cont)) > { > @@ -328,10 +328,10 @@ public: > template<class Container> > constexpr Span(const Container &cont, > std::enable_if_t<!details::is_span<Container>::value && > - !details::is_array<Container>::value && > - !std::is_array<Container>::value && > - std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], > - element_type (*)[]>::value, > + !details::is_array<Container>::value && > + !std::is_array<Container>::value && > + std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], > + element_type (*)[]>::value, > std::nullptr_t> = nullptr) > : data_(utils::data(cont)), size_(utils::size(cont)) > { > diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h > index 98c683a7..a9b27d0f 100644 > --- a/include/libcamera/base/utils.h > +++ b/include/libcamera/base/utils.h > @@ -12,8 +12,8 @@ > #include <iterator> > #include <ostream> > #include <sstream> > -#include <string> > #include <string.h> > +#include <string> Technically, I think string.h goes after string in alphabetical order. However, sorting "<string>" and "<string.h>" moves "<string.h>" first. Whatever makes clang-format happy is fine with me for this. > #include <sys/time.h> > #include <type_traits> > #include <utility> > diff --git a/include/libcamera/internal/camera_manager.h b/include/libcamera/internal/camera_manager.h > index 0150ca61..95ddf4cf 100644 > --- a/include/libcamera/internal/camera_manager.h > +++ b/include/libcamera/internal/camera_manager.h > @@ -7,8 +7,6 @@ > > #pragma once > > -#include <libcamera/camera_manager.h> > - Done on purpose. > #include <memory> > #include <sys/types.h> > #include <vector> > @@ -18,6 +16,8 @@ > #include <libcamera/base/thread.h> > #include <libcamera/base/thread_annotations.h> > > +#include <libcamera/camera_manager.h> > + > #include "libcamera/internal/process.h" > > namespace libcamera { > diff --git a/include/libcamera/internal/ipa_data_serializer.h b/include/libcamera/internal/ipa_data_serializer.h > index 13470a89..66d9a19f 100644 > --- a/include/libcamera/internal/ipa_data_serializer.h > +++ b/include/libcamera/internal/ipa_data_serializer.h Ack for the whole file. > @@ -18,6 +18,7 @@ > #include <libcamera/control_ids.h> > #include <libcamera/framebuffer.h> > #include <libcamera/geometry.h> > + > #include <libcamera/ipa/ipa_interface.h> > > #include "libcamera/internal/control_serializer.h" > @@ -161,7 +162,7 @@ public: > std::vector<SharedFD>::const_iterator fdIter = fdsBegin; > for (uint32_t i = 0; i < vecLen; i++) { > uint32_t sizeofData = readPOD<uint32_t>(dataIter, 0, dataEnd); > - uint32_t sizeofFds = readPOD<uint32_t>(dataIter, 4, dataEnd); > + uint32_t sizeofFds = readPOD<uint32_t>(dataIter, 4, dataEnd); > dataIter += 8; > > ret[i] = IPADataSerializer<V>::deserialize(dataIter, > @@ -268,7 +269,7 @@ public: > std::vector<SharedFD>::const_iterator fdIter = fdsBegin; > for (uint32_t i = 0; i < mapLen; i++) { > uint32_t sizeofData = readPOD<uint32_t>(dataIter, 0, dataEnd); > - uint32_t sizeofFds = readPOD<uint32_t>(dataIter, 4, dataEnd); > + uint32_t sizeofFds = readPOD<uint32_t>(dataIter, 4, dataEnd); > dataIter += 8; > > K key = IPADataSerializer<K>::deserialize(dataIter, > @@ -280,7 +281,7 @@ public: > dataIter += sizeofData; > fdIter += sizeofFds; > sizeofData = readPOD<uint32_t>(dataIter, 0, dataEnd); > - sizeofFds = readPOD<uint32_t>(dataIter, 4, dataEnd); > + sizeofFds = readPOD<uint32_t>(dataIter, 4, dataEnd); > dataIter += 8; > > const V value = IPADataSerializer<V>::deserialize(dataIter,
diff --git a/include/libcamera/base/log.h b/include/libcamera/base/log.h index 62093012..38b0ab01 100644 --- a/include/libcamera/base/log.h +++ b/include/libcamera/base/log.h @@ -43,17 +43,17 @@ private: LogSeverity severity_; }; -#define LOG_DECLARE_CATEGORY(name) \ -extern const LogCategory &_LOG_CATEGORY(name)(); - -#define LOG_DEFINE_CATEGORY(name) \ -LOG_DECLARE_CATEGORY(name) \ -const LogCategory &_LOG_CATEGORY(name)() \ -{ \ - /* The instance will be deleted by the Logger destructor. */ \ - static LogCategory *category = LogCategory::create(#name); \ - return *category; \ -} +#define LOG_DECLARE_CATEGORY(name) \ + extern const LogCategory &_LOG_CATEGORY(name)(); + +#define LOG_DEFINE_CATEGORY(name) \ + LOG_DECLARE_CATEGORY(name) \ + const LogCategory &_LOG_CATEGORY(name)() \ + { \ + /* The instance will be deleted by the Logger destructor. */ \ + static LogCategory *category = LogCategory::create(#name); \ + return *category; \ + } class LogMessage { diff --git a/include/libcamera/base/span.h b/include/libcamera/base/span.h index 92cce4f0..86201aa2 100644 --- a/include/libcamera/base/span.h +++ b/include/libcamera/base/span.h @@ -125,7 +125,7 @@ public: constexpr Span(element_type (&arr)[N], std::enable_if_t<std::is_convertible<std::remove_pointer_t<decltype(utils::data(arr))> (*)[], element_type (*)[]>::value && - N == Extent, + N == Extent, std::nullptr_t> = nullptr) noexcept : data_(arr) { @@ -135,7 +135,7 @@ public: constexpr Span(std::array<value_type, N> &arr, std::enable_if_t<std::is_convertible<std::remove_pointer_t<decltype(utils::data(arr))> (*)[], element_type (*)[]>::value && - N == Extent, + N == Extent, std::nullptr_t> = nullptr) noexcept : data_(arr.data()) { @@ -145,7 +145,7 @@ public: constexpr Span(const std::array<value_type, N> &arr, std::enable_if_t<std::is_convertible<std::remove_pointer_t<decltype(utils::data(arr))> (*)[], element_type (*)[]>::value && - N == Extent, + N == Extent, std::nullptr_t> = nullptr) noexcept : data_(arr.data()) { @@ -154,10 +154,10 @@ public: template<class Container> explicit constexpr Span(Container &cont, std::enable_if_t<!details::is_span<Container>::value && - !details::is_array<Container>::value && - !std::is_array<Container>::value && - std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], - element_type (*)[]>::value, + !details::is_array<Container>::value && + !std::is_array<Container>::value && + std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], + element_type (*)[]>::value, std::nullptr_t> = nullptr) : data_(utils::data(cont)) { @@ -166,10 +166,10 @@ public: template<class Container> explicit constexpr Span(const Container &cont, std::enable_if_t<!details::is_span<Container>::value && - !details::is_array<Container>::value && - !std::is_array<Container>::value && - std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], - element_type (*)[]>::value, + !details::is_array<Container>::value && + !std::is_array<Container>::value && + std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], + element_type (*)[]>::value, std::nullptr_t> = nullptr) : data_(utils::data(cont)) { @@ -179,7 +179,7 @@ public: template<class U, std::size_t N> explicit constexpr Span(const Span<U, N> &s, std::enable_if_t<std::is_convertible<U (*)[], element_type (*)[]>::value && - N == Extent, + N == Extent, std::nullptr_t> = nullptr) noexcept : data_(s.data()) { @@ -316,10 +316,10 @@ public: template<class Container> constexpr Span(Container &cont, std::enable_if_t<!details::is_span<Container>::value && - !details::is_array<Container>::value && - !std::is_array<Container>::value && - std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], - element_type (*)[]>::value, + !details::is_array<Container>::value && + !std::is_array<Container>::value && + std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], + element_type (*)[]>::value, std::nullptr_t> = nullptr) : data_(utils::data(cont)), size_(utils::size(cont)) { @@ -328,10 +328,10 @@ public: template<class Container> constexpr Span(const Container &cont, std::enable_if_t<!details::is_span<Container>::value && - !details::is_array<Container>::value && - !std::is_array<Container>::value && - std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], - element_type (*)[]>::value, + !details::is_array<Container>::value && + !std::is_array<Container>::value && + std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[], + element_type (*)[]>::value, std::nullptr_t> = nullptr) : data_(utils::data(cont)), size_(utils::size(cont)) { diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h index 98c683a7..a9b27d0f 100644 --- a/include/libcamera/base/utils.h +++ b/include/libcamera/base/utils.h @@ -12,8 +12,8 @@ #include <iterator> #include <ostream> #include <sstream> -#include <string> #include <string.h> +#include <string> #include <sys/time.h> #include <type_traits> #include <utility> diff --git a/include/libcamera/internal/camera_manager.h b/include/libcamera/internal/camera_manager.h index 0150ca61..95ddf4cf 100644 --- a/include/libcamera/internal/camera_manager.h +++ b/include/libcamera/internal/camera_manager.h @@ -7,8 +7,6 @@ #pragma once -#include <libcamera/camera_manager.h> - #include <memory> #include <sys/types.h> #include <vector> @@ -18,6 +16,8 @@ #include <libcamera/base/thread.h> #include <libcamera/base/thread_annotations.h> +#include <libcamera/camera_manager.h> + #include "libcamera/internal/process.h" namespace libcamera { diff --git a/include/libcamera/internal/ipa_data_serializer.h b/include/libcamera/internal/ipa_data_serializer.h index 13470a89..66d9a19f 100644 --- a/include/libcamera/internal/ipa_data_serializer.h +++ b/include/libcamera/internal/ipa_data_serializer.h @@ -18,6 +18,7 @@ #include <libcamera/control_ids.h> #include <libcamera/framebuffer.h> #include <libcamera/geometry.h> + #include <libcamera/ipa/ipa_interface.h> #include "libcamera/internal/control_serializer.h" @@ -161,7 +162,7 @@ public: std::vector<SharedFD>::const_iterator fdIter = fdsBegin; for (uint32_t i = 0; i < vecLen; i++) { uint32_t sizeofData = readPOD<uint32_t>(dataIter, 0, dataEnd); - uint32_t sizeofFds = readPOD<uint32_t>(dataIter, 4, dataEnd); + uint32_t sizeofFds = readPOD<uint32_t>(dataIter, 4, dataEnd); dataIter += 8; ret[i] = IPADataSerializer<V>::deserialize(dataIter, @@ -268,7 +269,7 @@ public: std::vector<SharedFD>::const_iterator fdIter = fdsBegin; for (uint32_t i = 0; i < mapLen; i++) { uint32_t sizeofData = readPOD<uint32_t>(dataIter, 0, dataEnd); - uint32_t sizeofFds = readPOD<uint32_t>(dataIter, 4, dataEnd); + uint32_t sizeofFds = readPOD<uint32_t>(dataIter, 4, dataEnd); dataIter += 8; K key = IPADataSerializer<K>::deserialize(dataIter, @@ -280,7 +281,7 @@ public: dataIter += sizeofData; fdIter += sizeofFds; sizeofData = readPOD<uint32_t>(dataIter, 0, dataEnd); - sizeofFds = readPOD<uint32_t>(dataIter, 4, dataEnd); + sizeofFds = readPOD<uint32_t>(dataIter, 4, dataEnd); dataIter += 8; const V value = IPADataSerializer<V>::deserialize(dataIter,
The LSP autoformatter doesn't like some of the current formatting, let's make it happy. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> --- include/libcamera/base/log.h | 22 +++++----- include/libcamera/base/span.h | 40 +++++++++---------- include/libcamera/base/utils.h | 2 +- include/libcamera/internal/camera_manager.h | 4 +- .../libcamera/internal/ipa_data_serializer.h | 7 ++-- 5 files changed, 38 insertions(+), 37 deletions(-)