Skip to content

Commit

Permalink
Merge pull request #1470 from NVIDIA/clangd-cleanup
Browse files Browse the repository at this point in the history
try to clean up some clangd errors
  • Loading branch information
ericniebler authored Jan 22, 2025
2 parents d592785 + 6c8f7dc commit 9514e7b
Show file tree
Hide file tree
Showing 91 changed files with 191 additions and 219 deletions.
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ ImplementationFileExtensions:
- cpp
- cxx
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: none
User: eniebler
CheckOptions:
Expand Down
19 changes: 16 additions & 3 deletions .clangd
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,33 @@ If:

---

# Apply a config conditionally to all C++ files
# Apply a config conditionally to all C++ files except those in the
# include/execpools directory which need platform-dependent headers
If:
PathMatch: .*\.(c|h)pp
PathMatch: .*\.(c|h)pp$
PathExclude: .*/execpools/.*

---

# Apply a config conditionally to all CUDA files
If:
PathMatch: .*\.cuh?
PathMatch: .*\.cuh?$
CompileFlags:
Add:
# Allow variadic CUDA functions
- "-Xclang=-fcuda-allow-variadic-functions"

---

# The following file assumes a define.
If:
PathMatch: .*/__system_context_default_impl_entry\.hpp
CompileFlags:
Add:
- "-DSTDEXEC_SYSTEM_CONTEXT_INLINE=inline"

---

# Use clang++ in CUDA mode to provide intellisense for files with `nvexec` in their path
If:
PathMatch: (include|examples|test)/nvexec.*
Expand Down Expand Up @@ -70,3 +81,5 @@ Diagnostics:
# The NVHPC version of _NVCXX_EXPAND_PACK macro triggers this clang error.
# Temporarily suppressing it, but should probably fix
- "template_param_shadow"
- "pp_expr_bad_token_binop" # erroneous error from STDEXEC_ENABLE_EXTRA_TYPE_CHECKING()
- "#warnings"
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ set_target_properties(stdexec PROPERTIES
VERSION "${STDEXEC_VERSION}"
SOVERSION "${STDEXEC_VERSION_MAJOR}")

if (BUILD_TESTING)
# Test headers are self-contained
set_target_properties(stdexec PROPERTIES
VERIFY_INTERFACE_HEADER_SETS TRUE)
endif()

# Declare the public include directories
include(GNUInstallDirs)

Expand Down
1 change: 0 additions & 1 deletion include/exec/__detail/__bit_cast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#endif

#include <cstring>
#include <type_traits>

namespace exec {

Expand Down
1 change: 0 additions & 1 deletion include/exec/__detail/__bwos_lifo_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <cstddef>
#include <cstdint>
#include <memory>
#include <new>
#include <utility>
#include <vector>

Expand Down
8 changes: 5 additions & 3 deletions include/exec/__detail/__numa.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
#pragma once

#include "../../stdexec/__detail/__config.hpp"
#include "../scope.hpp"
#include "../../stdexec/__detail/__meta.hpp"
#include "../scope.hpp" // IWYU pragma: keep

#include <algorithm>
#include <algorithm> // IWYU pragma: keep
#include <cstddef>
#include <memory>
#include <new>
#include <new> // IWYU pragma: keep
#include <thread>
#include <utility>

// Work around a bug in the NVHPC compilers prior to version 24.03
#if STDEXEC_NVHPC()
Expand Down
2 changes: 1 addition & 1 deletion include/exec/__detail/__system_context_default_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ namespace exec::__system_context_default_impl {
}
};

void* __default_query_system_context_interface(const __uuid& __id) noexcept {
inline void* __default_query_system_context_interface(const __uuid& __id) noexcept {
if (__id == system_scheduler::__interface_identifier) {
return __instance_holder::__singleton().__get_current_instance();
} else if (__id == __system_context_replaceability::__interface_identifier) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# error "STDEXEC_SYSTEM_CONTEXT_INLINE must be defined before including this header"
#endif

#include "__system_context_default_impl.hpp"
#include "__system_context_default_impl.hpp" // IWYU pragma: keep

STDEXEC_PRAGMA_PUSH()
STDEXEC_PRAGMA_IGNORE_GNU("-Wattributes") // warning: inline function '[...]' declared weak
Expand Down
31 changes: 17 additions & 14 deletions include/exec/__detail/__system_context_replaceability_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
#ifndef STDEXEC_SYSTEM_CONTEXT_REPLACEABILITY_API_H
#define STDEXEC_SYSTEM_CONTEXT_REPLACEABILITY_API_H

#include "stdexec/__detail/__execution_fwd.hpp"

#include <typeindex>
#include <cstdint>
#include <exception>

struct __uuid {
uint64_t __parts1;
uint64_t __parts2;
std::uint64_t __parts1;
std::uint64_t __parts2;

friend bool operator==(__uuid, __uuid) noexcept = default;
};
Expand All @@ -37,7 +36,8 @@ namespace exec::system_context_replaceability {
template <__uuid X>
using __check_constexpr_uuid = void;

//! Concept for a queryable interface. Ensures that the interface has a `__interface_identifier` member.
//! Concept for a queryable interface. Ensures that the interface has a `__interface_identifier`
//! member.
template <typename _T>
concept __queryable_interface =
requires() { typename __check_constexpr_uuid<_T::__interface_identifier>; };
Expand All @@ -49,8 +49,8 @@ namespace exec::system_context_replaceability {
__query_system_context_interface(_Interface::__interface_identifier));
}

/// Interface for completing a sender operation.
/// Backend will call frontend though this interface for completing the `schedule` and `schedule_bulk` operations.
/// Interface for completing a sender operation. Backend will call frontend though this interface
/// for completing the `schedule` and `schedule_bulk` operations.
struct receiver {
virtual ~receiver() = default;

Expand All @@ -65,14 +65,14 @@ namespace exec::system_context_replaceability {
/// Receiver for bulk sheduling operations.
struct bulk_item_receiver : receiver {
/// Called for each item of a bulk operation, possible on different threads.
virtual void start(uint32_t) noexcept = 0;
virtual void start(std::uint32_t) noexcept = 0;
};

/// Describes a storage space.
/// Used to pass preallocated storage from the frontend to the backend.
struct storage {
void* __data;
uint32_t __size;
std::uint32_t __size;
};

/// Interface for the system scheduler
Expand All @@ -81,10 +81,13 @@ namespace exec::system_context_replaceability {

virtual ~system_scheduler() = default;

/// Schedule work on system scheduler, calling `__r` when done and using `__s` for preallocated memory.
/// Schedule work on system scheduler, calling `__r` when done and using `__s` for preallocated
/// memory.
virtual void schedule(storage __s, receiver* __r) noexcept = 0;
/// Schedule bulk work of size `__n` on system scheduler, calling `__r` for each item and then when done, and using `__s` for preallocated memory.
virtual void bulk_schedule(uint32_t __n, storage __s, bulk_item_receiver* __r) noexcept = 0;
/// Schedule bulk work of size `__n` on system scheduler, calling `__r` for each item and then
/// when done, and using `__s` for preallocated memory.
virtual void
bulk_schedule(std::uint32_t __n, storage __s, bulk_item_receiver* __r) noexcept = 0;
};

/// Implementation-defined mechanism for replacing the system scheduler backend at run-time.
Expand All @@ -98,4 +101,4 @@ namespace exec::system_context_replaceability {

} // namespace exec::system_context_replaceability

#endif
#endif
1 change: 1 addition & 0 deletions include/exec/__detail/intrusive_heap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <cstddef>
#include <bit>
#include <utility>

STDEXEC_PRAGMA_PUSH()
STDEXEC_PRAGMA_IGNORE_EDG(not_used_in_partial_spec_arg_list)
Expand Down
4 changes: 1 addition & 3 deletions include/exec/any_sender_of.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
*/
#pragma once

#include "../stdexec/concepts.hpp"
#include "../stdexec/execution.hpp"
#include "../stdexec/functional.hpp"

#include "./sequence_senders.hpp"
#include "sequence_senders.hpp"

#include <cstddef>
#include <utility>
Expand Down
2 changes: 1 addition & 1 deletion include/exec/at_coroutine_exit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
// The original idea is taken from libunifex and adapted to stdexec.

#include <exception>
#include <type_traits>

#include "../stdexec/execution.hpp"

#include "inline_scheduler.hpp"
#include "any_sender_of.hpp"

Expand Down
1 change: 0 additions & 1 deletion include/exec/create.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#pragma once

#include "../stdexec/__detail/__meta.hpp"
#include "../stdexec/concepts.hpp"
#include "../stdexec/execution.hpp"

namespace exec {
Expand Down
1 change: 0 additions & 1 deletion include/exec/finally.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#pragma once

#include "../stdexec/execution.hpp"
#include "../stdexec/concepts.hpp"
#include "../stdexec/__detail/__manual_lifetime.hpp"

namespace exec {
Expand Down
2 changes: 0 additions & 2 deletions include/exec/inline_scheduler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
#pragma once

#include "../stdexec/execution.hpp"
#include <type_traits>
#include <exception>

namespace exec {
// A simple scheduler that executes its continuation inline, on the
Expand Down
2 changes: 0 additions & 2 deletions include/exec/into_tuple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
#pragma once

#include "../stdexec/execution.hpp"
#include "../stdexec/concepts.hpp"
#include "../stdexec/functional.hpp"
#include "../stdexec/__detail/__meta.hpp"
#include "../stdexec/__detail/__basic_sender.hpp"

Expand Down
1 change: 0 additions & 1 deletion include/exec/just_from.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#pragma once

#include "../stdexec/__detail/__meta.hpp"
#include "../stdexec/concepts.hpp"
#include "../stdexec/execution.hpp"

namespace exec {
Expand Down
4 changes: 4 additions & 0 deletions include/exec/libdispatch_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#pragma once

#if __has_include(<dispatch/dispatch.h>)

// TODO: This is needed for libdispatch to compile with GCC. Need to look for
// workaround.
#ifndef __has_feature
Expand Down Expand Up @@ -496,3 +498,5 @@ namespace exec {
};

} // namespace exec

#endif // __has_include(<dispatch/dispatch.h>)
1 change: 0 additions & 1 deletion include/exec/materialize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#pragma once

#include "../stdexec/execution.hpp"
#include "../stdexec/concepts.hpp"

namespace exec {
namespace __materialize {
Expand Down
1 change: 0 additions & 1 deletion include/exec/on_coro_disposition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "any_sender_of.hpp"

#include <exception>
#include <type_traits>

namespace exec {
namespace __on_coro_disp {
Expand Down
3 changes: 0 additions & 3 deletions include/exec/repeat_effect_until.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@
#pragma once

#include "../stdexec/execution.hpp"
#include "../stdexec/concepts.hpp"
#include "../stdexec/functional.hpp"
#include "../stdexec/__detail/__meta.hpp"
#include "../stdexec/__detail/__basic_sender.hpp"
#include "../stdexec/__detail/__manual_lifetime.hpp"

#include "on.hpp"
#include "trampoline_scheduler.hpp"

#include <atomic>
Expand Down
4 changes: 0 additions & 4 deletions include/exec/repeat_n.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,13 @@
#pragma once

#include "../stdexec/execution.hpp"
#include "../stdexec/concepts.hpp"
#include "../stdexec/functional.hpp"
#include "../stdexec/__detail/__meta.hpp"
#include "../stdexec/__detail/__basic_sender.hpp"
#include "../stdexec/__detail/__manual_lifetime.hpp"

#include "on.hpp"
#include "trampoline_scheduler.hpp"

#include <atomic>
#include <concepts>
#include <cstddef>
#include <exception>
#include <type_traits>
Expand Down
7 changes: 4 additions & 3 deletions include/exec/reschedule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,17 @@ namespace exec {
struct __sender {
using sender_concept = sender_t;

auto get_completion_signatures(__ignore = {}) noexcept -> __completions<_Env> {
template <class _Env>
auto get_completion_signatures(_Env&&) noexcept -> __completions<_Env> {
return {};
}

template <receiver _Receiver>
requires receiver_of<_Receiver, __completions<env_of_t<_Receiver>>>
auto connect(_Receiver __rcvr) const
-> connect_result_t<__schedule_sender_t<env_of_t<_Receiver>>, _Receiver> {
auto __sched = get_scheduler(get_env(__rcvr));
return stdexec::connect(schedule(__sched), static_cast<_Receiver&&>(__rcvr));
auto __sched = get_scheduler(stdexec::get_env(__rcvr));
return stdexec::connect(stdexec::schedule(__sched), static_cast<_Receiver&&>(__rcvr));
}

auto get_env() const noexcept {
Expand Down
3 changes: 0 additions & 3 deletions include/exec/start_now.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@
#include "stdexec/__detail/__receivers.hpp"
#include "stdexec/__detail/__senders.hpp"
#include "stdexec/__detail/__meta.hpp"
#include "stdexec/__detail/__type_traits.hpp"

#include "async_scope.hpp"

#include <atomic>
#include <functional>
#include <utility>

namespace exec {
/////////////////////////////////////////////////////////////////////////////
Expand Down
1 change: 0 additions & 1 deletion include/exec/task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <exception>
#include <utility>

#include "../stdexec/coroutine.hpp"
#include "../stdexec/execution.hpp"
#include "../stdexec/__detail/__meta.hpp"
#include "../stdexec/__detail/__optional.hpp"
Expand Down
1 change: 0 additions & 1 deletion include/exec/timed_scheduler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#pragma once

#include "../stdexec/execution.hpp"
#include "../stdexec/functional.hpp"

namespace exec {
namespace __now {
Expand Down
2 changes: 0 additions & 2 deletions include/exec/timed_thread_scheduler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include "../stdexec/__detail/__intrusive_mpsc_queue.hpp"
#include "../stdexec/__detail/__spin_loop_pause.hpp"

#include <bit>

namespace exec {
class timed_thread_scheduler;

Expand Down
Loading

0 comments on commit 9514e7b

Please sign in to comment.