Fixed clang-tidy/format errors
This commit is contained in:
parent
7315fda512
commit
652fecf4b0
11 changed files with 56 additions and 27 deletions
|
@ -8,9 +8,9 @@ FROM archlinux@sha256:a10e51dd0694d6c4142754e9d06cbce7baf91ace8031a30df37064d109
|
||||||
# 2. build/test tools
|
# 2. build/test tools
|
||||||
# 3. libraries
|
# 3. libraries
|
||||||
RUN pacman -Syyu --noconfirm \
|
RUN pacman -Syyu --noconfirm \
|
||||||
&& pacman -S --noconfirm git less vim sudo python-pip wget which pkgconf \
|
&& pacman -Syyu --noconfirm git less vim sudo python-pip wget which pkgconf \
|
||||||
&& pacman -S --noconfirm cmake make gcc ninja meson shellcheck \
|
&& pacman -Syyu --noconfirm cmake make gcc ninja meson shellcheck \
|
||||||
&& pacman -S --noconfirm gtk4 gtkmm-4.0 boost spdlog fmt libxml++-5.0
|
&& pacman -Syyu --noconfirm gtk4 gtkmm-4.0 boost spdlog fmt libxml++-5.0
|
||||||
|
|
||||||
# Create a non-root user 'dev'
|
# Create a non-root user 'dev'
|
||||||
RUN useradd -ms /bin/bash dev \
|
RUN useradd -ms /bin/bash dev \
|
||||||
|
@ -41,6 +41,9 @@ RUN sudo tar -xJf /home/artifacts/LLVM-${LLVM_VER}-Linux-X64.tar.xz -C /home/LLV
|
||||||
LLVM-${LLVM_VER}-Linux-X64/bin/clang-19 \
|
LLVM-${LLVM_VER}-Linux-X64/bin/clang-19 \
|
||||||
LLVM-${LLVM_VER}-Linux-X64/bin/clang \
|
LLVM-${LLVM_VER}-Linux-X64/bin/clang \
|
||||||
LLVM-${LLVM_VER}-Linux-X64/bin/clang++ \
|
LLVM-${LLVM_VER}-Linux-X64/bin/clang++ \
|
||||||
|
LLVM-${LLVM_VER}-Linux-X64/bin/lld \
|
||||||
|
LLVM-${LLVM_VER}-Linux-X64/bin/ld.lld \
|
||||||
|
LLVM-${LLVM_VER}-Linux-X64/bin/ld64.lld \
|
||||||
LLVM-${LLVM_VER}-Linux-X64/bin/clang-scan-deps \
|
LLVM-${LLVM_VER}-Linux-X64/bin/clang-scan-deps \
|
||||||
LLVM-${LLVM_VER}-Linux-X64/bin/llvm-symbolizer \
|
LLVM-${LLVM_VER}-Linux-X64/bin/llvm-symbolizer \
|
||||||
LLVM-${LLVM_VER}-Linux-X64/bin/clang-format \
|
LLVM-${LLVM_VER}-Linux-X64/bin/clang-format \
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
|
sudo chmod -R a+x /home/tools/
|
||||||
|
sudo chown -R dev /home/tools/
|
||||||
|
|
||||||
# Check that ejabberd server started successfully
|
# Check that ejabberd server started successfully
|
||||||
red='\e[1;31m'
|
red='\e[1;31m'
|
||||||
off='\e[0m'
|
off='\e[0m'
|
||||||
|
|
|
@ -79,6 +79,12 @@ jobs:
|
||||||
ls -la ${{ github.workspace }}
|
ls -la ${{ github.workspace }}
|
||||||
echo "This job's status is ${{ job.status }}."
|
echo "This job's status is ${{ job.status }}."
|
||||||
|
|
||||||
|
- name: Store list of repo files
|
||||||
|
run: |
|
||||||
|
cd ${{ github.workspace }}
|
||||||
|
find -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.c" -o -name "*.cpp" \) > repo_files_to_check.txt
|
||||||
|
find -type f \( -name "*.c" -o -name "*.cpp" \) > repo_sources_to_check.txt
|
||||||
|
|
||||||
#- name: Delete cache
|
#- name: Delete cache
|
||||||
# run: |
|
# run: |
|
||||||
# rm -rf ${{ runner.tool_cache }}/cache-llvm-19-restore
|
# rm -rf ${{ runner.tool_cache }}/cache-llvm-19-restore
|
||||||
|
@ -103,8 +109,7 @@ jobs:
|
||||||
export LLVM_VER=19.1.1
|
export LLVM_VER=19.1.1
|
||||||
export PATH="/home/LLVM-${LLVM_VER}/bin:${PATH}"
|
export PATH="/home/LLVM-${LLVM_VER}/bin:${PATH}"
|
||||||
cd ${{ github.workspace }}
|
cd ${{ github.workspace }}
|
||||||
find -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.c" -o -name "*.cpp" \) > repo_sources_to_check.txt
|
export REPO_FILES=$(cat repo_files_to_check.txt)
|
||||||
export REPO_FILES=$(cat repo_sources_to_check.txt)
|
|
||||||
|
|
||||||
printf "\nList of files to be checked:\n"
|
printf "\nList of files to be checked:\n"
|
||||||
echo "::group::files to be checked"
|
echo "::group::files to be checked"
|
||||||
|
@ -136,10 +141,17 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
export LLVM_VER=19.1.1
|
export LLVM_VER=19.1.1
|
||||||
export PATH="/home/LLVM-${LLVM_VER}/bin:${PATH}"
|
export PATH="/home/LLVM-${LLVM_VER}/bin:${PATH}"
|
||||||
|
cd ${{ github.workspace }}
|
||||||
|
|
||||||
|
sed -i 's|/usr/sbin/g++|/home/LLVM-19.1.1/bin/clang++ -stdlib=libc++ -I/home/LLVM-${LLVM_VER}/include/c++/v1|' build_gcc/compile_commands.json
|
||||||
|
sed -i 's|-fdeps-format=p1689r5||' build_gcc/compile_commands.json
|
||||||
|
sed -i 's|-fmodules-ts||' build_gcc/compile_commands.json
|
||||||
|
sed -i 's|-fmodule-mapper=.*\.modmap||' build_gcc/compile_commands.json
|
||||||
|
|
||||||
wget https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/main/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
|
wget https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/main/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
|
||||||
python run-clang-tidy.py \
|
python run-clang-tidy.py \
|
||||||
|
-warnings-as-errors=* \
|
||||||
-use-color \
|
-use-color \
|
||||||
-warnings-as-errors all \
|
|
||||||
-exclude-header-filter .*build.* \
|
-exclude-header-filter .*build.* \
|
||||||
-header-filter .hpp \
|
-header-filter .hpp \
|
||||||
-p ${{ github.workspace }}/build_gcc/ \
|
-p ${{ github.workspace }}/build_gcc/ \
|
||||||
|
@ -164,10 +176,10 @@ jobs:
|
||||||
# -GNinja -DCMAKE_BUILD_TYPE=Release \
|
# -GNinja -DCMAKE_BUILD_TYPE=Release \
|
||||||
# -DENABLE_EXAMPLES=ON \
|
# -DENABLE_EXAMPLES=ON \
|
||||||
# -DENABLE_TESTS=ON \
|
# -DENABLE_TESTS=ON \
|
||||||
# -DCMAKE_CXX_FLAGS="-stdlib=libstdc++ -fno-omit-frame-pointer -g -fsanitize=address,undefined,leak,function,nullability,vptr" \
|
# -DCMAKE_CXX_FLAGS="-stdlib=libc++ -I/home/LLVM-${LLVM_VER}/include/c++/v1 -fno-omit-frame-pointer -g -fsanitize=address,undefined,leak,function,nullability,vptr" \
|
||||||
# -DCMAKE_EXE_LINKER_FLAGS="-L/usr/lib/x86_64-linux-gnu -lstdc++ -fno-omit-frame-pointer -g -fsanitize=address,undefined,leak,function,nullability,vptr"
|
# -DCMAKE_EXE_LINKER_FLAGS="-L/home/LLVM-${LLVM_VER}/lib/ -Wl,-rpath,/home/LLVM-${LLVM_VER}/lib -lc++ -lc++abi -lm -lc -lgcc_s -lgcc -fno-omit-frame-pointer -g -fsanitize=address,undefined,leak,function,nullability,vptr"
|
||||||
# cmake --build ${{ github.workspace }}/build_clang --parallel `nproc`
|
# cmake --build ${{ github.workspace }}/build_clang --parallel `nproc`
|
||||||
#
|
|
||||||
#- name: Clang unit tests with -fsanitize=address
|
#- name: Clang unit tests with -fsanitize=address
|
||||||
# run: |
|
# run: |
|
||||||
# export LLVM_VER=19.1.1
|
# export LLVM_VER=19.1.1
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -29,5 +29,4 @@ ext/
|
||||||
libxmlplusplus-prefix/
|
libxmlplusplus-prefix/
|
||||||
spdlog.pc
|
spdlog.pc
|
||||||
build*
|
build*
|
||||||
larra
|
|
||||||
temp*
|
temp*
|
||||||
|
|
21
.vscode/tasks.json
vendored
21
.vscode/tasks.json
vendored
|
@ -18,13 +18,24 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// https://clang.llvm.org/extra/clang-tidy/
|
// https://clang.llvm.org/extra/clang-tidy/
|
||||||
// Add ' -fix ' to automatically fix errors
|
|
||||||
"label": "Checker: clang-tidy dry-run",
|
"label": "Checker: clang-tidy dry-run",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": [
|
"command": [
|
||||||
"python /home/tools/run-clang-tidy.py -exclude-header-filter .*build.* -use-color -warnings-as-errors all -header-filter .hpp -p ${workspaceFolder}/build_clang/ -config-file ${workspaceFolder}/.clang-tidy",
|
"python /home/tools/run-clang-tidy.py -exclude-header-filter .*build.* -use-color -warnings-as-errors=* -header-filter .hpp -p ${workspaceFolder}/build_clang/ -config-file ${workspaceFolder}/.clang-tidy",
|
||||||
" ${workspaceFolder}/examples ",
|
" ${workspaceFolder}/examples",
|
||||||
" ${workspaceFolder}/library/ ",
|
" ${workspaceFolder}/library/",
|
||||||
|
" ${workspaceFolder}/src/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// https://clang.llvm.org/extra/clang-tidy/
|
||||||
|
"label": "Checker: clang-tidy fix errors",
|
||||||
|
"type": "shell",
|
||||||
|
"command": [
|
||||||
|
"python /home/tools/run-clang-tidy.py -exclude-header-filter .*build.* -use-color -warnings-as-errors=* -header-filter .hpp -p ${workspaceFolder}/build_clang/ -config-file ${workspaceFolder}/.clang-tidy",
|
||||||
|
" -fix",
|
||||||
|
" ${workspaceFolder}/examples",
|
||||||
|
" ${workspaceFolder}/library/",
|
||||||
" ${workspaceFolder}/src/"
|
" ${workspaceFolder}/src/"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -148,7 +159,7 @@
|
||||||
"cd ${workspaceFolder} &&",
|
"cd ${workspaceFolder} &&",
|
||||||
"mkdir -p build_clang && cd build_clang &&",
|
"mkdir -p build_clang && cd build_clang &&",
|
||||||
"cmake -Wno-dev ",
|
"cmake -Wno-dev ",
|
||||||
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON ",
|
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON",
|
||||||
//
|
//
|
||||||
// Uncomment for GCC standart library: libstdc++
|
// Uncomment for GCC standart library: libstdc++
|
||||||
//" -DCMAKE_CXX_FLAGS=\"-stdlib=libstdc++ -fno-omit-frame-pointer -g -fsanitize=address,undefined,leak,function,nullability,vptr\"",
|
//" -DCMAKE_CXX_FLAGS=\"-stdlib=libstdc++ -fno-omit-frame-pointer -g -fsanitize=address,undefined,leak,function,nullability,vptr\"",
|
||||||
|
|
|
@ -74,7 +74,7 @@ struct Client {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool active = true;
|
bool active = true;
|
||||||
XmlStream<Connection> connection;
|
XmlStream<Connection> connection{};
|
||||||
BareJid jid;
|
BareJid jid;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace larra::xmpp {
|
||||||
enum class Required : bool { kNotRequired = false, kRequired = true };
|
enum class Required : bool { kNotRequired = false, kRequired = true };
|
||||||
|
|
||||||
struct SaslMechanisms {
|
struct SaslMechanisms {
|
||||||
std::vector<std::string> mechanisms;
|
std::vector<std::string> mechanisms{};
|
||||||
|
|
||||||
[[nodiscard]] static auto Parse(const xmlpp::Element*) -> SaslMechanisms;
|
[[nodiscard]] static auto Parse(const xmlpp::Element*) -> SaslMechanisms;
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,8 +19,8 @@ struct BasicStream {
|
||||||
static constexpr auto kAddXmlDecl = true;
|
static constexpr auto kAddXmlDecl = true;
|
||||||
static inline const std::string kDefaultPrefix = "";
|
static inline const std::string kDefaultPrefix = "";
|
||||||
static inline const std::string kDefaultName = "stream:stream";
|
static inline const std::string kDefaultName = "stream:stream";
|
||||||
FromType from;
|
FromType from{};
|
||||||
ToType to;
|
ToType to{};
|
||||||
std::optional<std::string> id;
|
std::optional<std::string> id;
|
||||||
std::optional<std::string> version;
|
std::optional<std::string> version;
|
||||||
std::optional<std::string> xmlLang;
|
std::optional<std::string> xmlLang;
|
||||||
|
@ -46,7 +46,8 @@ struct BasicStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Self>
|
template <typename Self>
|
||||||
[[nodiscard]] constexpr auto XmlLang(this Self&& self, std::optional<std::string> value) -> BasicStream {
|
[[nodiscard]] constexpr auto XmlLang(this Self&& self, std::optional<std::string> value) // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||||
|
-> BasicStream {
|
||||||
return utils::FieldSetHelper::With<"xmlLang", BasicStream>(std::forward_like<Self>(self), std::move(value));
|
return utils::FieldSetHelper::With<"xmlLang", BasicStream>(std::forward_like<Self>(self), std::move(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ using UserAccountVariant = std::variant<PlainUserAccount, EncryptionUserAccount,
|
||||||
struct UserAccount : UserAccountVariant {
|
struct UserAccount : UserAccountVariant {
|
||||||
using UserAccountVariant::variant;
|
using UserAccountVariant::variant;
|
||||||
template <typename Self>
|
template <typename Self>
|
||||||
constexpr auto Jid(this Self&& self, BareJid value) -> UserAccount {
|
constexpr auto Jid(this Self&& self, BareJid value) -> UserAccount { // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||||
return std::visit<UserAccount>(
|
return std::visit<UserAccount>(
|
||||||
[&](auto& ref) -> std::decay_t<decltype(ref)> {
|
[&](auto& ref) -> std::decay_t<decltype(ref)> {
|
||||||
return {std::forward_like<Self>(ref).Jid(std::move(value))};
|
return {std::forward_like<Self>(ref).Jid(std::move(value))};
|
||||||
|
@ -44,7 +44,7 @@ struct UserAccount : UserAccountVariant {
|
||||||
self);
|
self);
|
||||||
}
|
}
|
||||||
template <typename Self>
|
template <typename Self>
|
||||||
constexpr auto Password(this Self&& self, std::string value) -> UserAccount {
|
constexpr auto Password(this Self&& self, std::string value) -> UserAccount { // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||||
return std::visit<UserAccount>(
|
return std::visit<UserAccount>(
|
||||||
[&](auto& ref) -> std::decay_t<decltype(ref)> {
|
[&](auto& ref) -> std::decay_t<decltype(ref)> {
|
||||||
return std::forward_like<Self>(ref).Password(std::move(value));
|
return std::forward_like<Self>(ref).Password(std::move(value));
|
||||||
|
@ -52,7 +52,7 @@ struct UserAccount : UserAccountVariant {
|
||||||
self);
|
self);
|
||||||
}
|
}
|
||||||
template <typename Self>
|
template <typename Self>
|
||||||
constexpr auto Jid(this Self&& self) -> decltype(auto) {
|
constexpr auto Jid(this Self&& self) -> decltype(auto) { // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||||
return std::visit<decltype(std::forward_like<Self>(std::declval<BareJid&>()))>(
|
return std::visit<decltype(std::forward_like<Self>(std::declval<BareJid&>()))>(
|
||||||
[](auto& ref) -> decltype(auto) {
|
[](auto& ref) -> decltype(auto) {
|
||||||
return std::forward_like<Self>(ref.jid);
|
return std::forward_like<Self>(ref.jid);
|
||||||
|
@ -60,7 +60,7 @@ struct UserAccount : UserAccountVariant {
|
||||||
self);
|
self);
|
||||||
}
|
}
|
||||||
template <typename Self>
|
template <typename Self>
|
||||||
constexpr auto Password(this Self&& self) -> decltype(auto) {
|
constexpr auto Password(this Self&& self) -> decltype(auto) { // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||||
return std::visit<decltype(std::forward_like<Self>(std::declval<BareJid&>()))>(
|
return std::visit<decltype(std::forward_like<Self>(std::declval<BareJid&>()))>(
|
||||||
[](auto& ref) -> decltype(auto) {
|
[](auto& ref) -> decltype(auto) {
|
||||||
return std::forward_like<Self>(ref.password);
|
return std::forward_like<Self>(ref.password);
|
||||||
|
|
|
@ -84,7 +84,7 @@ struct FieldsDescription {
|
||||||
* \return an object of type std::decay_t<Self> with data from T with fields from \ref self and the \ref value of the field \ref ptr
|
* \return an object of type std::decay_t<Self> with data from T with fields from \ref self and the \ref value of the field \ref ptr
|
||||||
*/
|
*/
|
||||||
template <typename Self, typename Value, typename Type>
|
template <typename Self, typename Value, typename Type>
|
||||||
constexpr auto With(Type(T::* ptr), Self&& self, Value&& value) const
|
constexpr auto With(Type(T::* ptr), Self&& self, Value&& value) const // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||||
requires(std::is_constructible_v<T, impl::GetTypeT<Fs>...> && std::is_constructible_v<std::decay_t<Self>, T> &&
|
requires(std::is_constructible_v<T, impl::GetTypeT<Fs>...> && std::is_constructible_v<std::decay_t<Self>, T> &&
|
||||||
std::is_constructible_v<Type, decltype(value)> && impl::SetConcept<Self, Type, Fs...>)
|
std::is_constructible_v<Type, decltype(value)> && impl::SetConcept<Self, Type, Fs...>)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Parser : private xmlpp::SaxParser {
|
||||||
|
|
||||||
auto ParseChunk(std::string_view str) -> const _xmlError*;
|
auto ParseChunk(std::string_view str) -> const _xmlError*;
|
||||||
|
|
||||||
std::stack<xmlpp::Element*> context;
|
std::stack<xmlpp::Element*> context{};
|
||||||
xmlpp::Document& doc;
|
xmlpp::Document& doc;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -313,7 +313,7 @@ struct XmlStream : Stream {
|
||||||
|
|
||||||
XmlStream(XmlStream&& other) = default;
|
XmlStream(XmlStream&& other) = default;
|
||||||
|
|
||||||
std::unique_ptr<BufferType> streambuf; // Not movable :(
|
std::unique_ptr<BufferType> streambuf{}; // Not movable :(
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace larra::xmpp
|
} // namespace larra::xmpp
|
||||||
|
|
Loading…
Reference in a new issue