Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Checks: |
-misc-unused-using-decls
-misc-include-cleaner
-modernize-use-using
-readability-duplicate-include
-readability-redundant-preprocessor
HeaderFilterRegex: \./.+\\.(h|hpp)$
WarningsAsErrors: false
24 changes: 22 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.23)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

option(REFLECTCPP_BUILD_SHARED "Build shared library" ${BUILD_SHARED_LIBS})
option(REFLECTCPP_INSTALL "Install reflect cpp" OFF)

Expand Down Expand Up @@ -154,9 +156,27 @@ endif()
add_library(reflectcpp::reflectcpp ALIAS reflectcpp)

if (MSVC)
target_compile_options(reflectcpp PRIVATE $<$<CONFIG:Debug>:-Wall>)
target_compile_options(reflectcpp PRIVATE
$<$<CONFIG:Debug>:
-Wall
>
$<$<CONFIG:Release>:
-DNDEBUG
>
)
else()
target_compile_options(reflectcpp PRIVATE $<$<CONFIG:Debug>:-Wall -Wextra>)
target_compile_options(reflectcpp PRIVATE
$<$<CONFIG:Debug>:
-Wall -Wextra -Wpedantic -Wshadow -Wconversion
#-Wnull-dereference -Wold-style-cast
#-g3 -fno-omit-frame-pointer
#-fsanitize=address,undefined
#-fno-sanitize-recover=undefined
>
$<$<CONFIG:Release>:
-DNDEBUG
>
)
endif()

if(REFLECTCPP_USE_STD_EXPECTED)
Expand Down
4 changes: 0 additions & 4 deletions benchmarks/all/canada_read.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#include <benchmark/benchmark.h>

#include <array>
#include <iostream>
#include <optional>
#include <rfl/avro.hpp>
#include <rfl/bson.hpp>
#include <rfl/capnproto.hpp>
Expand All @@ -13,7 +10,6 @@
#include <rfl/toml.hpp>
#include <rfl/ubjson.hpp>
#include <rfl/yaml.hpp>
#include <type_traits>
#include <vector>

namespace canada_read {
Expand Down
4 changes: 0 additions & 4 deletions benchmarks/all/canada_write.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#include <benchmark/benchmark.h>

#include <array>
#include <iostream>
#include <optional>
#include <rfl/avro.hpp>
#include <rfl/bson.hpp>
#include <rfl/capnproto.hpp>
Expand All @@ -13,7 +10,6 @@
#include <rfl/toml.hpp>
#include <rfl/ubjson.hpp>
#include <rfl/yaml.hpp>
#include <type_traits>
#include <vector>

namespace canada_write {
Expand Down
3 changes: 0 additions & 3 deletions benchmarks/all/licenses_read.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include <benchmark/benchmark.h>

#include <array>
#include <iostream>
#include <optional>
#include <rfl/avro.hpp>
#include <rfl/bson.hpp>
Expand All @@ -14,7 +12,6 @@
#include <rfl/ubjson.hpp>
#include <rfl/xml.hpp>
#include <rfl/yaml.hpp>
#include <type_traits>
#include <vector>

namespace licenses_read {
Expand Down
3 changes: 0 additions & 3 deletions benchmarks/all/licenses_write.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include <benchmark/benchmark.h>

#include <array>
#include <iostream>
#include <optional>
#include <rfl/avro.hpp>
#include <rfl/bson.hpp>
Expand All @@ -14,7 +12,6 @@
#include <rfl/ubjson.hpp>
#include <rfl/xml.hpp>
#include <rfl/yaml.hpp>
#include <type_traits>
#include <vector>

namespace licenses_write {
Expand Down
4 changes: 0 additions & 4 deletions benchmarks/all/person_read.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#include <benchmark/benchmark.h>

#include <array>
#include <iostream>
#include <optional>
#include <rfl/avro.hpp>
#include <rfl/bson.hpp>
#include <rfl/capnproto.hpp>
Expand All @@ -14,7 +11,6 @@
#include <rfl/ubjson.hpp>
#include <rfl/xml.hpp>
#include <rfl/yaml.hpp>
#include <type_traits>
#include <vector>
namespace person_read {

Expand Down
4 changes: 0 additions & 4 deletions benchmarks/all/person_write.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#include <benchmark/benchmark.h>

#include <array>
#include <iostream>
#include <optional>
#include <rfl/avro.hpp>
#include <rfl/bson.hpp>
#include <rfl/capnproto.hpp>
Expand All @@ -14,7 +11,6 @@
#include <rfl/ubjson.hpp>
#include <rfl/xml.hpp>
#include <rfl/yaml.hpp>
#include <type_traits>
#include <vector>

namespace person_write {
Expand Down
3 changes: 0 additions & 3 deletions benchmarks/json/canada.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
#include <rapidjson/document.h>
#include <simdjson.h>

#include <array>
#include <iostream>
#include <nlohmann/json.hpp>
#include <optional>
#include <rfl/json.hpp>
#include <type_traits>
#include <vector>

namespace canada {
Expand Down Expand Up @@ -256,7 +253,7 @@
return feature_collection;
}

static rfl::Result<FeatureCollection> read_using_simdjson(

Check warning on line 256 in benchmarks/json/canada.cpp

View workflow job for this annotation

GitHub Actions / macos-latest (benchmarks)

unused function 'read_using_simdjson' [-Wunused-function]

Check warning on line 256 in benchmarks/json/canada.cpp

View workflow job for this annotation

GitHub Actions / (benchmarks-C++23-llvm-18)

unused function 'read_using_simdjson' [-Wunused-function]

Check warning on line 256 in benchmarks/json/canada.cpp

View workflow job for this annotation

GitHub Actions / (benchmarks-C++20-llvm-18)

unused function 'read_using_simdjson' [-Wunused-function]

Check warning on line 256 in benchmarks/json/canada.cpp

View workflow job for this annotation

GitHub Actions / (benchmarks-C++20-llvm-17)

unused function 'read_using_simdjson' [-Wunused-function]

Check warning on line 256 in benchmarks/json/canada.cpp

View workflow job for this annotation

GitHub Actions / (benchmarks-C++20-llvm-16)

unused function 'read_using_simdjson' [-Wunused-function]

Check warning on line 256 in benchmarks/json/canada.cpp

View workflow job for this annotation

GitHub Actions / macos-latest (benchmarks)

unused function 'read_using_simdjson' [-Wunused-function]

Check warning on line 256 in benchmarks/json/canada.cpp

View workflow job for this annotation

GitHub Actions / (benchmarks-C++20-llvm-17)

unused function 'read_using_simdjson' [-Wunused-function]

Check warning on line 256 in benchmarks/json/canada.cpp

View workflow job for this annotation

GitHub Actions / (benchmarks-C++20-llvm-18)

unused function 'read_using_simdjson' [-Wunused-function]

Check warning on line 256 in benchmarks/json/canada.cpp

View workflow job for this annotation

GitHub Actions / (benchmarks-C++23-llvm-18)

unused function 'read_using_simdjson' [-Wunused-function]

Check warning on line 256 in benchmarks/json/canada.cpp

View workflow job for this annotation

GitHub Actions / macos-13 (benchmarks)

unused function 'read_using_simdjson' [-Wunused-function]

Check warning on line 256 in benchmarks/json/canada.cpp

View workflow job for this annotation

GitHub Actions / (benchmarks-C++20-llvm-16)

unused function 'read_using_simdjson' [-Wunused-function]

Check warning on line 256 in benchmarks/json/canada.cpp

View workflow job for this annotation

GitHub Actions / macos-13 (benchmarks)

unused function 'read_using_simdjson' [-Wunused-function]
const std::string &_json_string) {
try {
simdjson::ondemand::parser parser;
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/json/licenses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
#include <rapidjson/document.h>
#include <simdjson.h>

#include <array>
#include <iostream>
#include <nlohmann/json.hpp>
#include <optional>
#include <rfl/json.hpp>
#include <type_traits>
#include <vector>

namespace licenses {
Expand Down
1 change: 0 additions & 1 deletion benchmarks/json/person.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <array>
#include <iostream>
#include <nlohmann/json.hpp>
#include <optional>
#include <rfl/json.hpp>
#include <type_traits>
#include <vector>
Expand Down
3 changes: 1 addition & 2 deletions include/rfl/Box.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define RFL_BOX_HPP_

#include <memory>
#include <stdexcept>

#include "Result.hpp"

Expand Down Expand Up @@ -146,7 +145,7 @@ namespace std {
template <class T>
struct hash<rfl::Box<T>> {
size_t operator()(const rfl::Box<T>& _b) const {
return hash<unique_ptr<T>>()(_b.ptr());
return std::hash<std::unique_ptr<T>>{}(_b.ptr());
}
};

Expand Down
3 changes: 0 additions & 3 deletions include/rfl/Field.hpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
#ifndef RFL_FIELD_HPP_
#define RFL_FIELD_HPP_

#include <algorithm>
#include <string_view>
#include <tuple>
#include <type_traits>
#include <utility>

#include "Literal.hpp"
#include "default.hpp"
#include "internal/Array.hpp"
#include "internal/StringLiteral.hpp"
#include "internal/to_std_array.hpp"
#include "internal/wrap_in_rfl_array_t.hpp"

namespace rfl {
Expand Down
1 change: 0 additions & 1 deletion include/rfl/Literal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <cstdint>
#include <functional>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
Expand Down
3 changes: 1 addition & 2 deletions include/rfl/Ref.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,10 @@ inline std::basic_ostream<CharT, Traits>& operator<<(
} // namespace rfl

namespace std {

template <class T>
struct hash<rfl::Ref<T>> {
size_t operator()(const rfl::Ref<T>& _r) const {
return hash<shared_ptr<T>>()(_r.ptr());
return std::hash<std::shared_ptr<T>>{}(_r.ptr());
}
};

Expand Down
3 changes: 0 additions & 3 deletions include/rfl/Result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
#include <expected>
#endif

#include <algorithm>
#include <array>
#include <functional>
#include <iostream>
#include <new>
#include <optional>
#include <stdexcept>
#include <string>
#include <type_traits>
Expand Down
7 changes: 0 additions & 7 deletions include/rfl/Tuple.hpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
#ifndef RFL_TUPLE_HPP_
#define RFL_TUPLE_HPP_

#include <algorithm>
#include <array>
#include <bit>
#include <cstdint>
#include <limits>
#include <memory>
#include <optional>
#include <stdexcept>
#include <tuple>
#include <type_traits>
#include <utility>
Expand Down
13 changes: 2 additions & 11 deletions include/rfl/Validator.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#ifndef RFL_VALIDATOR_HPP_
#define RFL_VALIDATOR_HPP_

#include <cstddef>
#include <exception>
#include <functional>
#include <string>
#include <type_traits>
#include <utility>

Expand Down Expand Up @@ -110,17 +111,7 @@ struct Validator {
template <class T, class V, class... Vs>
inline auto operator<=>(const Validator<T, V, Vs...>& _v1,
const Validator<T, V, Vs...>& _v2) {
#if __cpp_lib_three_way_comparison >= 201907L
return _v1.value() <=> _v2.value();
#else
if (_v1.value() < _v2.value()) {
return std::strong_ordering::less;
} else if (_v1.value() > _v2.value()) {
return std::strong_ordering::greater;
} else {
return std::strong_ordering::equal;
}
#endif
}

template <class T, class V, class... Vs>
Expand Down
10 changes: 5 additions & 5 deletions include/rfl/avro/Parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "../Generic.hpp"
#include "../Tuple.hpp"
#include "../always_false.hpp"
#include "../parsing/Parser.hpp"
//#include "../parsing/Parser.hpp"
#include "Reader.hpp"
#include "Writer.hpp"

Expand Down Expand Up @@ -82,15 +82,15 @@ struct Parser<avro::Reader, avro::Writer,
}

template <class P>
static void write(const W& _w,
static void write(const W& /*_w*/,
const internal::Skip<T, _skip_serialization,
_skip_deserialization>& _skip,
const P& _parent) noexcept {
_skip_deserialization>& /*_skip*/,
const P& /*_parent*/) noexcept {
static_assert(always_false_v<P>, "rfl::Skip is unsupported in Avro.");
}

template <class U>
static schema::Type to_schema(U* _definitions) {
static schema::Type to_schema(U* /*_definitions*/) {
static_assert(always_false_v<U>, "rfl::Skip is unsupported in Avro.");
return schema::Type{};
}
Expand Down
Loading
Loading