Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check and format json and c++ files #103

Merged
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp

{
"name": "Beman Project Generic Devcontainer",
"build": {
"dockerfile": "Dockerfile"
},
"postCreateCommand": "bash .devcontainer/postcreate.sh",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cmake-tools"
]
}
}
{
"name": "Beman Project Generic Devcontainer",
"build": {
"dockerfile": "Dockerfile"
},
"postCreateCommand": "bash .devcontainer/postcreate.sh",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cmake-tools"
]
}
}
}
File renamed without changes.
20 changes: 11 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# TODO: - id: trailing-whitespace
# TODO: - id: end-of-file-fixer
# FIXME: - id: check-yaml
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
- id: check-yaml
exclude: ^\.clang-(format|tidy)$
- id: check-added-large-files

# TODO: Clang-format for C++
# This brings in a portable version of clang-format.
# See also: https://github.com/ssciwr/clang-format-wheel
# - repo: https://github.com/pre-commit/mirrors-clang-format
# rev: v19.1.4
# hooks:
# - id: clang-format
# types_or: [c++, c, json]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.4
hooks:
- id: clang-format
types_or: [c++, c, json]
exclude: docs/TODO.json

# TODO: CMake linting and formatting
# - repo: https://github.com/BlankSpruce/gersemi
Expand Down
2 changes: 1 addition & 1 deletion docs/TODO.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ToDo
# ToDo

| Section | Code | Test | Doc | Comment |
| ------- |:----:|:----:|:---:| ------- |
Expand Down
2 changes: 1 addition & 1 deletion docs/dependency.txt
Original file line number Diff line number Diff line change
Expand Up @@ -515,4 +515,4 @@ when_all_with_variant into_variant
when_all_with_variant when_all
with_awaitable_senders as_awaitable
write_env make_sender
write_env queryable
write_env queryable
22 changes: 11 additions & 11 deletions docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ When an asynchronous operation completes it _signals_ its completion by calling
<details>
<summary>environment</summary>
The term _enviroment_ refers to the bag of properties associated with an <code>_object_</code> by the call <code><a href=‘#get-env’>std::execution::get_env</a>(_object_)</code>. By default the environment for objects is empty (<code><a href=‘#empty-env’>std::execution::empty_env</a></code>). In particular, environments associated with <code><a href=‘#receiver’>receiver</a></code>s are used to provide access to properties like the <a href=‘#get-stop-token’>stop token</a>, <a href=‘#get-scheduler’>scheduler</a>, or <a href=‘#get-allocator’>allocator</a> associated with the <code><a href=‘#receiver’>receiver</a></code>. The various properties associated with an object are accessed via <a href=‘#queries’>queries</a>.
</details>
</details>

## Concepts
This section lists the concepts from `std::execution`.
Expand All @@ -46,15 +46,15 @@ struct example_state
{
using operation_state_concept = std::execution::operation_state_t;
std::remove_cvref_t<Receiver> receiver;

auto start() & noexcept {
std::execution::set_value(std::move(this->receiver));
}
};

static_assert(std::execution::operation_state<example_state<SomeReceiver>>);
```
</details>
</details>
</details>
<details>
<summary><code>receiver&lt;<i>Receiver</i>&gt;</code></summary>
Expand Down Expand Up @@ -90,7 +90,7 @@ struct example_receiver
{
using receiver_concept = std::execution::receiver_t;
std::remove_cvref_t<NestedReceiver> nested;

auto get_env() const noexcept {
return std::execution::get_env(this->nested);
}
Expand All @@ -112,7 +112,7 @@ struct example_receiver

static_assert(std::execution::receiver<example_receiver<SomeReceiver>>);
```
</details>
</details>
</details>
<details>
<summary><code>receiver_of&lt;<i>Receiver, Completions</i>&gt;</code></summary>
Expand All @@ -129,7 +129,7 @@ The example defines a simple <code><a href=‘#receiver’>receiver</a></code> a
struct example_receiver
{
using receiver_concept = std::execution::receiver_t;

auto set_value(int) && noexcept ->void {}
auto set_stopped() && noexcept ->void {}
};
Expand All @@ -141,7 +141,7 @@ static_assert(std::execution::receiver_of<example_receiver,
std::execution::set_value_t(int),
std::execution::set_stopped_t()
>);
// providing a superset of signal models models receiver_of:
// providing a superset of signal models models receiver_of:
static_assert(std::execution::receiver_of<example_receiver,
std::execution::completion_signals<
std::execution::set_value_t(int)
Expand Down Expand Up @@ -211,7 +211,7 @@ struct example_sender
using completion_signatures = std::execution::completion_signatures<
std::execution::set_value_t(int)
>;

int value{};
template <std::execution::receiver Receiver>
auto connect(Receiver&& receiver) const -> state<Receiver> {
Expand All @@ -238,7 +238,7 @@ To determine if <code>_Receiver_</code> can receive all <a href=‘#completion-s
<details>
<summary><code>sends_stopped&lt;<i>Sender, Env</i> = std::execution::empty_env&gt;</code></summary>

The concept <code>sends_stopped&lt;<i>Sender, Env</i>&gt;</code> determines if <code>_Sender_</code> may send a <code><a href=‘#set_stopped’>stopped</a></code> <a href=‘#completion-signals’>completion signal</a>. To do so, the concepts determines if <code><a href=‘#get_completion_signals’>std::execution::get_completion_signals</a>(_sender_, _env_)</code> contains the signatures <code><a href=‘#set_stopped’>std::execution::set_stopped_t</a>()</code>.
The concept <code>sends_stopped&lt;<i>Sender, Env</i>&gt;</code> determines if <code>_Sender_</code> may send a <code><a href=‘#set_stopped’>stopped</a></code> <a href=‘#completion-signals’>completion signal</a>. To do so, the concepts determines if <code><a href=‘#get_completion_signals’>std::execution::get_completion_signals</a>(_sender_, _env_)</code> contains the signatures <code><a href=‘#set_stopped’>std::execution::set_stopped_t</a>()</code>.
</details>
<details>
<summary><code>stoppable_token&lt;_Token_&gt;</code></summary>
Expand Down Expand Up @@ -284,7 +284,7 @@ void compute(std::stoppable_token auto token)
<summary>Example: inactive</summary>
<blockquote>
This example shows how an <code><a href=‘#operation-state’>operation_state</a></code> can use the <code>callback_type</code> together with a <code>_token_</code> to get notified when cancellation is requested.

```c++
template <std::execution::receiver Receiver>
struct example_state
Expand Down Expand Up @@ -328,7 +328,7 @@ struct example_state
std::execution::set_value(std::move(this->receiver));
}
}
};
};
```
</blockquote>
</details>
Expand Down
2 changes: 1 addition & 1 deletion docs/questions.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ likely observable.
- [exec.when.all] uses on-stop-request without saying what it actually does.
most likely on-stop-request is supposed to call stop_src.request_stop
- [exec.when.all] p11.1 uses a non-existing conversion for tuple to implement its "tie"
actually, that one may be new in C++23!
actually, that one may be new in C++23!
2 changes: 1 addition & 1 deletion examples/doc-just.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ int main() {
auto result = ex::sync_wait(ex::just(17, "hello"s, true));
assert(result);
assert(*result == std::tuple(17, "hello"s, true));
}
}
2 changes: 1 addition & 1 deletion examples/doc-just_error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ int main() {
had_error = true;
}));
assert(had_error);
}
}
2 changes: 1 addition & 1 deletion examples/doc-just_stopped.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ int main() {

auto result = ex::sync_wait(ex::just_stopped() | ex::upon_stopped([&] { stopped = true; }));
assert(stopped);
}
}
5 changes: 2 additions & 3 deletions examples/playground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ namespace ex = ::beman::execution26;

// ----------------------------------------------------------------------------

int main()
{
int main() {
auto [result] = ex::sync_wait(ex::when_all(ex::just(std::string("hello, ")), ex::just(std::string("world"))) |
ex::then([](const auto& s1, const auto& s2) { return s1 + s2; }))
.value_or(std::tuple(std::string("oops")));
std::cout << "result='" << result << "'\n";
}
}
6 changes: 3 additions & 3 deletions examples/stop_token.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ namespace exec = beman::execution26;
// - std::print isn't available everywhere, yet. Let's try a simple
// placeholder.
namespace {
::std::mutex io_lock;
void print(std::string_view text, auto&&...) {
::std::mutex io_lock;
void print(std::string_view text, auto&&...) {
const std::lock_guard guard(io_lock);
::std::cout << text;
}
Expand All @@ -71,7 +71,7 @@ struct stop_callback_for_t {
#ifdef __cpp_lib_latch
template <typename Token>
auto inactive(const Token& token) -> void {
::std::latch latch(1);
::std::latch latch(1);
const stop_callback_for_t cb(token, [&latch] { latch.count_down(); });

latch.wait();
Expand Down
4 changes: 2 additions & 2 deletions include/beman/execution26/detail/atomic_intrusive_stack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class atomic_intrusive_stack;
//!
//! @tparam Item The type of the item in the stack.
//! @tparam Next The pointer to the next item in the stack.
template <class Item, Item* Item::*Next>
template <class Item, Item* Item::* Next>
class atomic_intrusive_stack<Next> {
public:
atomic_intrusive_stack() = default;
Expand Down Expand Up @@ -85,4 +85,4 @@ class atomic_intrusive_stack<Next> {

} // namespace beman::execution26::detail

#endif
#endif
2 changes: 1 addition & 1 deletion include/beman/execution26/detail/awaitable_sender.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ concept awaitable_sender =
};
} // namespace beman::execution26::detail

#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ template <typename Sender, typename Env = ::beman::execution26::empty_env>
requires ::beman::execution26::sender_in<Sender, Env>
using completion_signatures_of_t =
::beman::execution26::detail::call_result_t< ::beman::execution26::get_completion_signatures_t, Sender, Env>;
}
} // namespace beman::execution26

// ----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion include/beman/execution26/detail/completion_tag.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ template <typename Tag>
concept completion_tag =
::std::same_as<Tag, ::beman::execution26::set_error_t> ||
::std::same_as<Tag, ::beman::execution26::set_stopped_t> || ::std::same_as<Tag, ::beman::execution26::set_value_t>;
}
} // namespace beman::execution26::detail

// ----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion include/beman/execution26/detail/connect_all_result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ using connect_all_result =
::beman::execution26::detail::basic_state<Sender, Receiver>*,
Sender,
::beman::execution26::detail::indices_for<Sender> >;
}
} // namespace beman::execution26::detail

// ----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion include/beman/execution26/detail/decayed_tuple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace beman::execution26::detail {
*/
template <typename... T>
using decayed_tuple = ::std::tuple<::std::decay_t<T>...>;
}
} // namespace beman::execution26::detail

// ----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion include/beman/execution26/detail/decayed_typeof.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace beman::execution26::detail {
*/
template <auto&& Tag>
using decayed_typeof = ::std::decay_t<decltype(Tag)>;
}
} // namespace beman::execution26::detail

// ----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion include/beman/execution26/detail/decays_to.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace beman::execution26::detail {
*/
template <typename From, typename To>
concept decays_to = ::std::same_as<::std::decay_t<From>, To>;
}
} // namespace beman::execution26::detail

// ----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion include/beman/execution26/detail/env_of_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace beman::execution26 {
*/
template <typename T>
using env_of_t = decltype(::beman::execution26::get_env(::std::declval<T>()));
}
} // namespace beman::execution26

// ----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion include/beman/execution26/detail/env_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ using env_type = ::beman::execution26::detail::call_result_t<
Index,
::beman::execution26::detail::state_type<Sender, Receiver>&,
const Receiver&>;
}
} // namespace beman::execution26::detail

// ----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion include/beman/execution26/detail/error_types_of_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ using error_types_of_t =
::beman::execution26::completion_signatures_of_t<Sender, Env>,
::std::type_identity_t,
Variant>;
}
} // namespace beman::execution26

// ----------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ struct get_completion_signatures_t {

public:
template <typename Sender, typename Env>
requires(not ::std::same_as<void,
decltype(get_completion_signatures_t::get(::std::declval<Sender>(),
::std::declval<Env>()))>)
requires(not::std::same_as<void,
decltype(get_completion_signatures_t::get(::std::declval<Sender>(),
::std::declval<Env>()))>)
auto operator()(Sender&& sender, Env&& env) const noexcept {
return this->get(::std::forward<Sender>(sender), ::std::forward<Env>(env));
}
Expand All @@ -67,4 +67,4 @@ inline constexpr get_completion_signatures_t get_completion_signatures{};

// ----------------------------------------------------------------------------

#endif
#endif
2 changes: 1 addition & 1 deletion include/beman/execution26/detail/inplace_stop_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class beman::execution26::inplace_stop_callback final
template <typename Init>
inplace_stop_callback(::beman::execution26::inplace_stop_token, Init&&);
inplace_stop_callback(const inplace_stop_callback&) = delete;
inplace_stop_callback(inplace_stop_callback&&) = delete;
inplace_stop_callback(inplace_stop_callback&&) = delete;
~inplace_stop_callback() {
if (this->source) {
this->source->deregister(this);
Expand Down
4 changes: 2 additions & 2 deletions include/beman/execution26/detail/intrusive_stack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ template <auto Next>
class intrusive_stack;

//! @brief This data structure is an intrusive queue that is not thread-safe.
template <class Item, Item* Item::*Next>
template <class Item, Item* Item::* Next>
class intrusive_stack<Next> {
public:
//! @brief Pushes an item to the queue.
Expand Down Expand Up @@ -44,4 +44,4 @@ class intrusive_stack<Next> {

} // namespace beman::execution26::detail

#endif
#endif
4 changes: 1 addition & 3 deletions include/beman/execution26/detail/join_env.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ class join_env {
requires(Env1&, const Query& query, Args&&... args) {
env1.query(query, ::std::forward<Args>(args)...);
} ||
requires(Env2& e2, const Query& query, Args&&... args) {
e2.query(query, ::std::forward<Args>(args)...);
})
requires(Env2& e2, const Query& query, Args&&... args) { e2.query(query, ::std::forward<Args>(args)...); })
auto query(const Query& query, Args&&... args) noexcept -> decltype(auto) {
if constexpr (requires { env1.query(query, ::std::forward<Args>(args)...); }) {
return env1.query(query, ::std::forward<Args>(args)...);
Expand Down
Loading
Loading