From 72bea8ec1b8c24fd4b267cb17661c8f7f05d1d84 Mon Sep 17 00:00:00 2001 From: "Jonathan B. Coe" Date: Sat, 10 Oct 2026 21:49:49 +0100 Subject: [PATCH 1/3] Move headers, tests and tutorials under xyz/ with namespaces matching directories --- .github/actions/install-gcc-trunk/action.yml | 2 +- .github/workflows/bazel.yml | 4 +- .github/workflows/sanitizers.yml | 4 +- BUILD.bazel | 55 ++++++++--------- CMakeLists.txt | 44 ++++++------- CONTRIBUTING.md | 27 ++++---- README.md | 6 +- cmake/modules/FindClangTidy.cmake | 2 +- codecov.yml | 5 +- install_test/main.cc | 4 +- scripts/consteval_coverage.py | 41 ++++++++----- conformance.hh => xyz/detail/conformance.hh | 0 .../detail/conversion_thunks.hh | 4 +- .../detail/member_function_thunks.hh | 4 +- .../detail/name_mangling.hh | 14 ++--- .../detail/operator_thunks.hh | 4 +- .../detail/overload_spec.hh | 0 .../detail/protocol_traits.hh | 16 +---- .../detail/protocol_wrappers.hh | 10 +-- vtable.hh => xyz/detail/vtable.hh | 16 +++-- protocol.hh => xyz/protocol.hh | 61 +++++++++++-------- .../tests/allocator_tests.cc | 36 ++++++----- .../tests/conformance_tests.cc | 17 +++--- .../tests/consteval_check.h | 28 ++++----- .../tests/consteval_check_test.cc | 6 +- .../tests/forwarding_test.cc | 10 ++- .../tests/name_mangling_tests.cc | 30 +++++---- .../tests/protocol_member_function_tests.cc | 12 ++-- .../tests/protocol_operator_tests.cc | 9 ++- .../tests/protocol_test.cc | 20 +++--- .../tests/protocol_view_tests.cc | 17 +++--- .../tests/tagged_allocator.h | 4 +- test_helpers.h => xyz/tests/test_helpers.h | 12 ++-- .../tests/tracking_allocator.h | 4 +- vtable_tests.cc => xyz/tests/vtable_tests.cc | 14 +++-- {tutorials => xyz/tutorials}/.clang-tidy | 0 .../tutorials}/01_polymorphism.cc | 0 .../tutorials}/02_type_erasure.cc | 0 {tutorials => xyz/tutorials}/03_reflection.cc | 4 +- .../tutorials}/04_vanishing_this.cc | 0 {tutorials => xyz/tutorials}/05_allocators.cc | 0 .../tutorials}/06_advanced_vtables.cc | 6 +- .../tutorials}/07_wide_pointer_sbo.cc | 0 .../tutorials}/08_wide_pointer_narrowing.cc | 0 {tutorials => xyz/tutorials}/BUILD.bazel | 0 {tutorials => xyz/tutorials}/CMakeLists.txt | 0 46 files changed, 274 insertions(+), 278 deletions(-) rename conformance.hh => xyz/detail/conformance.hh (100%) rename conversion_thunks.hh => xyz/detail/conversion_thunks.hh (98%) rename member_function_thunks.hh => xyz/detail/member_function_thunks.hh (98%) rename name_mangling.hh => xyz/detail/name_mangling.hh (98%) rename operator_thunks.hh => xyz/detail/operator_thunks.hh (99%) rename overload_spec.hh => xyz/detail/overload_spec.hh (100%) rename protocol_traits.hh => xyz/detail/protocol_traits.hh (83%) rename protocol_wrappers.hh => xyz/detail/protocol_wrappers.hh (97%) rename vtable.hh => xyz/detail/vtable.hh (95%) rename protocol.hh => xyz/protocol.hh (94%) rename allocator_tests.cc => xyz/tests/allocator_tests.cc (97%) rename conformance_tests.cc => xyz/tests/conformance_tests.cc (98%) rename consteval_check.h => xyz/tests/consteval_check.h (93%) rename consteval_check_test.cc => xyz/tests/consteval_check_test.cc (98%) rename forwarding_test.cc => xyz/tests/forwarding_test.cc (98%) rename name_mangling_tests.cc => xyz/tests/name_mangling_tests.cc (94%) rename protocol_member_function_tests.cc => xyz/tests/protocol_member_function_tests.cc (98%) rename protocol_operator_tests.cc => xyz/tests/protocol_operator_tests.cc (99%) rename protocol_test.cc => xyz/tests/protocol_test.cc (97%) rename protocol_view_tests.cc => xyz/tests/protocol_view_tests.cc (98%) rename tagged_allocator.h => xyz/tests/tagged_allocator.h (98%) rename test_helpers.h => xyz/tests/test_helpers.h (92%) rename tracking_allocator.h => xyz/tests/tracking_allocator.h (98%) rename vtable_tests.cc => xyz/tests/vtable_tests.cc (83%) rename {tutorials => xyz/tutorials}/.clang-tidy (100%) rename {tutorials => xyz/tutorials}/01_polymorphism.cc (100%) rename {tutorials => xyz/tutorials}/02_type_erasure.cc (100%) rename {tutorials => xyz/tutorials}/03_reflection.cc (99%) rename {tutorials => xyz/tutorials}/04_vanishing_this.cc (100%) rename {tutorials => xyz/tutorials}/05_allocators.cc (100%) rename {tutorials => xyz/tutorials}/06_advanced_vtables.cc (99%) rename {tutorials => xyz/tutorials}/07_wide_pointer_sbo.cc (100%) rename {tutorials => xyz/tutorials}/08_wide_pointer_narrowing.cc (100%) rename {tutorials => xyz/tutorials}/BUILD.bazel (100%) rename {tutorials => xyz/tutorials}/CMakeLists.txt (100%) diff --git a/.github/actions/install-gcc-trunk/action.yml b/.github/actions/install-gcc-trunk/action.yml index 616af335..6cc7339d 100644 --- a/.github/actions/install-gcc-trunk/action.yml +++ b/.github/actions/install-gcc-trunk/action.yml @@ -18,7 +18,7 @@ inputs: # values, 2026-09-13) onward, any -flto build of the tests fails with # "tree code 'lang_type' is not supported in LTO streams" (GCC PR126017), # and -fsanitize=null or vptr rejects the `template for` over - # enumerators_of in tutorials/03_reflection.cc with "consteval-only value + # enumerators_of in xyz/tutorials/03_reflection.cc with "consteval-only value # outside an immediate function context". Restore gcc-latest.deb once a # snapshot fixes both. default: https://kayari.org/gcc-latest/gcc-latest_17.0.0-20260906gitb6dabcdc335a.deb diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index 1f553712..f4cfa722 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -21,7 +21,7 @@ on: - "scripts/bazel.py" - "scripts/bazel.sh" - "scripts/compiler_discovery.py" - - "tutorials/BUILD.bazel" + - "xyz/tutorials/BUILD.bazel" # No `paths:` filter here. The `bazel` summary job is a required status # check for merging to main, and a workflow that is filtered out by # `paths:` never reports a check, which leaves unrelated pull requests @@ -72,7 +72,7 @@ jobs: - "scripts/bazel.py" - "scripts/bazel.sh" - "scripts/compiler_discovery.py" - - "tutorials/BUILD.bazel" + - "xyz/tutorials/BUILD.bazel" build: needs: detect-changes diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.yml index a651423d..28c16259 100644 --- a/.github/workflows/sanitizers.yml +++ b/.github/workflows/sanitizers.yml @@ -21,7 +21,7 @@ on: - "scripts/bazel.py" - "scripts/bazel.sh" - "scripts/compiler_discovery.py" - - "tutorials/BUILD.bazel" + - "xyz/tutorials/BUILD.bazel" # No `paths:` filter here. The `sanitizers` summary job is a required # status check for merging to main, and a workflow that is filtered out by # `paths:` never reports a check, which leaves unrelated pull requests @@ -72,7 +72,7 @@ jobs: - "scripts/bazel.py" - "scripts/bazel.sh" - "scripts/compiler_discovery.py" - - "tutorials/BUILD.bazel" + - "xyz/tutorials/BUILD.bazel" sanitized-tests: needs: detect-changes diff --git a/BUILD.bazel b/BUILD.bazel index 5ec02d60..f95a5509 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -3,51 +3,44 @@ load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") package(default_visibility = ["//visibility:public"]) -cc_library( - name = "name_mangling", - hdrs = ["name_mangling.hh"], -) - cc_library( name = "protocol", srcs = [ - "conformance.hh", - "conversion_thunks.hh", - "member_function_thunks.hh", - "operator_thunks.hh", - "overload_spec.hh", - "protocol_traits.hh", - "protocol_wrappers.hh", - "vtable.hh", - ], - hdrs = ["protocol.hh"], - deps = [ - ":name_mangling", + "xyz/detail/conformance.hh", + "xyz/detail/conversion_thunks.hh", + "xyz/detail/member_function_thunks.hh", + "xyz/detail/name_mangling.hh", + "xyz/detail/operator_thunks.hh", + "xyz/detail/overload_spec.hh", + "xyz/detail/protocol_traits.hh", + "xyz/detail/protocol_wrappers.hh", + "xyz/detail/vtable.hh", ], + hdrs = ["xyz/protocol.hh"], ) cc_library( name = "consteval_check", - hdrs = ["consteval_check.h"], + hdrs = ["xyz/tests/consteval_check.h"], ) cc_test( name = "protocol_test", size = "small", srcs = [ - "allocator_tests.cc", - "conformance_tests.cc", - "consteval_check_test.cc", - "forwarding_test.cc", - "name_mangling_tests.cc", - "protocol_member_function_tests.cc", - "protocol_operator_tests.cc", - "protocol_test.cc", - "protocol_view_tests.cc", - "tagged_allocator.h", - "test_helpers.h", - "tracking_allocator.h", - "vtable_tests.cc", + "xyz/tests/allocator_tests.cc", + "xyz/tests/conformance_tests.cc", + "xyz/tests/consteval_check_test.cc", + "xyz/tests/forwarding_test.cc", + "xyz/tests/name_mangling_tests.cc", + "xyz/tests/protocol_member_function_tests.cc", + "xyz/tests/protocol_operator_tests.cc", + "xyz/tests/protocol_test.cc", + "xyz/tests/protocol_view_tests.cc", + "xyz/tests/tagged_allocator.h", + "xyz/tests/test_helpers.h", + "xyz/tests/tracking_allocator.h", + "xyz/tests/vtable_tests.cc", ], deps = [ ":consteval_check", diff --git a/CMakeLists.txt b/CMakeLists.txt index de6378f7..5e88fb9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,16 +123,16 @@ target_sources( BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES - protocol.hh - conformance.hh - conversion_thunks.hh - member_function_thunks.hh - operator_thunks.hh - overload_spec.hh - protocol_traits.hh - protocol_wrappers.hh - vtable.hh - name_mangling.hh) + xyz/protocol.hh + xyz/detail/conformance.hh + xyz/detail/conversion_thunks.hh + xyz/detail/member_function_thunks.hh + xyz/detail/operator_thunks.hh + xyz/detail/overload_spec.hh + xyz/detail/protocol_traits.hh + xyz/detail/protocol_wrappers.hh + xyz/detail/vtable.hh + xyz/detail/name_mangling.hh) # Consumers need the reflection flags of whichever compiler they build with, # so the options are generator expressions evaluated at their configure time # rather than the flags of the compiler that installed the package. @@ -182,18 +182,18 @@ if(XYZ_PROTOCOL_IS_NOT_SUBPROJECT) LINK_LIBRARIES xyz_protocol::protocol FILES - protocol_test.cc - protocol_member_function_tests.cc - protocol_operator_tests.cc - protocol_view_tests.cc - conformance_tests.cc - allocator_tests.cc - consteval_check_test.cc - forwarding_test.cc - name_mangling_tests.cc - vtable_tests.cc) - - add_subdirectory(tutorials) + xyz/tests/protocol_test.cc + xyz/tests/protocol_member_function_tests.cc + xyz/tests/protocol_operator_tests.cc + xyz/tests/protocol_view_tests.cc + xyz/tests/conformance_tests.cc + xyz/tests/allocator_tests.cc + xyz/tests/consteval_check_test.cc + xyz/tests/forwarding_test.cc + xyz/tests/name_mangling_tests.cc + xyz/tests/vtable_tests.cc) + + add_subdirectory(xyz/tutorials) endif(${BUILD_TESTING}) install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9cfd76fa..4370ffad 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,7 +26,7 @@ release, bump `.bazelversion`, which is one of the The project supports both Bazel and CMake build systems. Prefer Bazel for day-to-day building and testing: on a two-core codespace a full Bazel build took 140 s against 223 s for CMake, and rebuilding after a one-character edit -to `protocol.hh` took 45 s against 81 s. +to `xyz/protocol.hh` took 45 s against 81 s. 1. **Bazel** (preferred): To build the project and run tests, execute: @@ -110,13 +110,13 @@ configure time when the version it found does not match Fix genuine findings. Suppress false positives at the site with a `NOLINT` comment that names the check and gives a reason, or, for a check that does not apply to a whole directory, in that directory's `.clang-tidy` (see -`tutorials/.clang-tidy`). Checks disabled for the whole repository are listed -with their rationale at the top of `.clang-tidy`. +`xyz/tutorials/.clang-tidy`). Checks disabled for the whole repository are +listed with their rationale at the top of `.clang-tidy`. ### Measuring Test Coverage -Test coverage is measured in two halves, because much of `protocol.hh` is -`consteval` code that executes inside the compiler where runtime coverage +Test coverage is measured in two halves, because much of `xyz/protocol.hh` +is `consteval` code that executes inside the compiler where runtime coverage instrumentation cannot see it. Runtime coverage uses GCC's gcov: @@ -177,7 +177,7 @@ constraints. Interfaces for `protocol` and `protocol_view` are plain structs or classes. Their public, non-virtual, non-template member functions define the protocol; -`protocol.hh` inspects them with C++26 reflection at compile time. +`xyz/protocol.hh` inspects them with C++26 reflection at compile time. ### Supported Features @@ -195,19 +195,20 @@ Their public, non-virtual, non-template member functions define the protocol; functions are never called, whether declared on the interface or on the conforming type. -- Guidance: Developers should refer to `protocol_test.cc`, - `forwarding_test.cc`, `allocator_tests.cc` and `tutorials/reflection.cc` for - examples of supported interface patterns. +- Guidance: Developers should refer to `xyz/tests/protocol_test.cc`, + `xyz/tests/forwarding_test.cc`, `xyz/tests/allocator_tests.cc` and + `xyz/tutorials/03_reflection.cc` for examples of supported interface + patterns. ## Usage Examples Examples of how to use the `protocol` library can be found within the test suite. -- `protocol_test.cc`: This file contains tests that demonstrate the library's - intended usage. It shows how to define an interface and then instantiate - and use the wrapper with concrete types. Developers can examine this file - for practical examples. +- `xyz/tests/protocol_test.cc`: This file contains tests that demonstrate the + library's intended usage. It shows how to define an interface and then + instantiate and use the wrapper with concrete types. Developers can examine + this file for practical examples. ## Current Status and Limitations diff --git a/README.md b/README.md index 76952bc8..4b49d6b3 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ structural-subtyping, `protocol` is owning, `protocol_view` is non-owning. See [DRAFT.md](DRAFT.md) for more details on design. This repository contains both the ISO C++ proposal to add these new library -types and a reference implementation, `protocol.hh`, built on C++26 reflection -(P2996). It requires a compiler with reflection support, such as a GCC trunk -snapshot with `-freflection`. +types and a reference implementation, `xyz/protocol.hh`, built on C++26 +reflection (P2996). It requires a compiler with reflection support, such as a +GCC trunk snapshot with `-freflection`. ## Standardization diff --git a/cmake/modules/FindClangTidy.cmake b/cmake/modules/FindClangTidy.cmake index 8f78839c..b91636bf 100644 --- a/cmake/modules/FindClangTidy.cmake +++ b/cmake/modules/FindClangTidy.cmake @@ -184,7 +184,7 @@ endfunction() if (CLANG_TIDY_ENABLE) # No CONFIG_FILE: passing --config-file disables clang-tidy's - # per-directory lookup, which is needed for tutorials/.clang-tidy to + # per-directory lookup, which is needed for xyz/tutorials/.clang-tidy to # override the repository configuration. The repository .clang-tidy is # still found by walking up from each source file. enable_clang_tidy() diff --git a/codecov.yml b/codecov.yml index a69096f9..7e7aa92f 100644 --- a/codecov.yml +++ b/codecov.yml @@ -5,9 +5,8 @@ codecov: after_n_builds: 2 ignore: - - "*_test.cc" - - "*_tests.cc" - - "tutorials/**" + - "xyz/tests/**" + - "xyz/tutorials/**" coverage: status: diff --git a/install_test/main.cc b/install_test/main.cc index e886b394..30e6c49c 100644 --- a/install_test/main.cc +++ b/install_test/main.cc @@ -1,4 +1,4 @@ -#include "protocol.hh" +#include "xyz/protocol.hh" struct Shape { double area() const; @@ -11,6 +11,6 @@ struct Square { }; int main() { - xyz::reflection::protocol shape(Square{2.0}); + xyz::protocol shape(Square{2.0}); return shape.area() == 4.0 ? 0 : 1; } diff --git a/scripts/consteval_coverage.py b/scripts/consteval_coverage.py index a6152165..2a01f5f1 100644 --- a/scripts/consteval_coverage.py +++ b/scripts/consteval_coverage.py @@ -64,7 +64,9 @@ # Library headers use the .hh suffix; test helpers (.h) are not instrumented. INSTRUMENTED_HEADERS = sorted( - os.path.basename(path) for path in glob.glob(os.path.join(SOURCE_ROOT, "*.hh")) + os.path.relpath(path, SOURCE_ROOT) + for pattern in ("xyz/*.hh", "xyz/detail/*.hh") + for path in glob.glob(os.path.join(SOURCE_ROOT, pattern)) ) TRAP_HEADER = "consteval_coverage_probe.h" @@ -79,17 +81,17 @@ # Translation units that instantiate protocols and so drive the consteval # machinery in the instrumented headers, cheapest to compile first: each # only arms the probe points the ones before it left uncovered. -# protocol_member_function_tests.cc is left out: it reaches no probe point -# the others miss. +# xyz/tests/protocol_member_function_tests.cc is left out: it reaches no probe +# point the others miss. DEFAULT_TRANSLATION_UNITS = [ - "vtable_tests.cc", - "name_mangling_tests.cc", - "conformance_tests.cc", - "allocator_tests.cc", - "protocol_operator_tests.cc", - "protocol_test.cc", - "protocol_view_tests.cc", - "forwarding_test.cc", + "xyz/tests/vtable_tests.cc", + "xyz/tests/name_mangling_tests.cc", + "xyz/tests/conformance_tests.cc", + "xyz/tests/allocator_tests.cc", + "xyz/tests/protocol_operator_tests.cc", + "xyz/tests/protocol_test.cc", + "xyz/tests/protocol_view_tests.cc", + "xyz/tests/forwarding_test.cc", ] ProbeKey = tuple[int, int] # (header index, line number) @@ -427,7 +429,7 @@ def populate_work_dir( """ Fill `work_dir` with the instrumented headers and everything they need. - Every root header and each probe translation unit is copied, so that + Every header and each probe translation unit is copied, so that every quote-include resolves inside the work directory; nothing falls back to an uninstrumented original. A previous run's directory is replaced; any other existing directory is left alone. @@ -439,14 +441,21 @@ def populate_work_dir( shutil.rmtree(work_dir) os.makedirs(work_dir) open(marker, "w").close() - for pattern in ("*.h", "*.hh"): + os.makedirs(os.path.join(work_dir, "xyz", "detail")) + os.makedirs(os.path.join(work_dir, "xyz", "tests")) + for pattern in ("xyz/*.hh", "xyz/detail/*.hh", "xyz/tests/*.h"): for path in glob.glob(os.path.join(SOURCE_ROOT, pattern)): - shutil.copy(path, work_dir) + shutil.copy( + path, os.path.join(work_dir, os.path.relpath(path, SOURCE_ROOT)) + ) for header, lines in instrumented_by_header.items(): with open(os.path.join(work_dir, header), "w") as out: out.write("\n".join(lines) + "\n") for translation_unit in translation_units: - shutil.copy(os.path.join(SOURCE_ROOT, translation_unit), work_dir) + shutil.copy( + os.path.join(SOURCE_ROOT, translation_unit), + os.path.join(work_dir, translation_unit), + ) def compile_batch( @@ -469,6 +478,8 @@ def compile_batch( "-w", "-include", trap_header, + "-iquote", + configuration.work_dir, ] for directory in configuration.include_directories: command.extend(["-I", directory]) diff --git a/conformance.hh b/xyz/detail/conformance.hh similarity index 100% rename from conformance.hh rename to xyz/detail/conformance.hh diff --git a/conversion_thunks.hh b/xyz/detail/conversion_thunks.hh similarity index 98% rename from conversion_thunks.hh rename to xyz/detail/conversion_thunks.hh index 26111fc2..af8220df 100644 --- a/conversion_thunks.hh +++ b/xyz/detail/conversion_thunks.hh @@ -22,8 +22,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include -#include "overload_spec.hh" -#include "vtable.hh" +#include "xyz/detail/overload_spec.hh" +#include "xyz/detail/vtable.hh" namespace xyz::detail { diff --git a/member_function_thunks.hh b/xyz/detail/member_function_thunks.hh similarity index 98% rename from member_function_thunks.hh rename to xyz/detail/member_function_thunks.hh index 54e2ac16..287c7ece 100644 --- a/member_function_thunks.hh +++ b/xyz/detail/member_function_thunks.hh @@ -23,8 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include "overload_spec.hh" -#include "vtable.hh" +#include "xyz/detail/overload_spec.hh" +#include "xyz/detail/vtable.hh" namespace xyz::detail { diff --git a/name_mangling.hh b/xyz/detail/name_mangling.hh similarity index 98% rename from name_mangling.hh rename to xyz/detail/name_mangling.hh index becffa22..55237850 100644 --- a/name_mangling.hh +++ b/xyz/detail/name_mangling.hh @@ -39,9 +39,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -namespace xyz::name_mangling { - -namespace detail { +namespace xyz::detail { template consteval std::string decimal(T value) { @@ -351,8 +349,6 @@ consteval std::string base_name_of(std::meta::info function) { return mangle_atom(identifier_of(function)); } -} // namespace detail - // Names the member function `function`, distinguishing overloads by folding // its cv- and ref-qualification, noexcept-ness, return type and each // parameter's type into the name. Matches the Itanium ABI's own placement @@ -374,20 +370,20 @@ consteval std::string mangle(std::meta::info function) { if (is_const(function)) qualifiers += "K"; if (is_lvalue_reference_qualified(function)) qualifiers += "R"; if (is_rvalue_reference_qualified(function)) qualifiers += "O"; - std::string atom = detail::base_name_of(function); + std::string atom = base_name_of(function); std::string name = "fn_" + (qualifiers.empty() ? atom : "N" + qualifiers + atom + "E"); name += is_noexcept(function) ? "Do" : ""; if (!is_conversion_function(function)) { - name += detail::mangle_type(return_type_of(function)); + name += mangle_type(return_type_of(function)); } std::vector parameters = parameters_of(function); for (std::meta::info parameter : parameters) { - name += detail::mangle_type(type_of(parameter)); + name += mangle_type(type_of(parameter)); } return name; } -} // namespace xyz::name_mangling +} // namespace xyz::detail #endif // XYZ_PROTOCOL_NAME_MANGLING_HH_ diff --git a/operator_thunks.hh b/xyz/detail/operator_thunks.hh similarity index 99% rename from operator_thunks.hh rename to xyz/detail/operator_thunks.hh index b84895a1..4d24f9fa 100644 --- a/operator_thunks.hh +++ b/xyz/detail/operator_thunks.hh @@ -23,8 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include "overload_spec.hh" -#include "vtable.hh" +#include "xyz/detail/overload_spec.hh" +#include "xyz/detail/vtable.hh" namespace xyz::detail { diff --git a/overload_spec.hh b/xyz/detail/overload_spec.hh similarity index 100% rename from overload_spec.hh rename to xyz/detail/overload_spec.hh diff --git a/protocol_traits.hh b/xyz/detail/protocol_traits.hh similarity index 83% rename from protocol_traits.hh rename to xyz/detail/protocol_traits.hh index 8b943547..59ac6f1f 100644 --- a/protocol_traits.hh +++ b/xyz/detail/protocol_traits.hh @@ -26,7 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -namespace xyz::reflection { +namespace xyz::detail { template concept is_valid_interface = @@ -39,30 +39,18 @@ template concept is_valid_view_interface = is_valid_interface || is_valid_interface>; -template -class protocol; - -template -class protocol_view; - template struct is_protocol : std::false_type {}; -template -struct is_protocol> : std::true_type {}; - template inline constexpr bool is_protocol_v = is_protocol::value; template struct is_protocol_view : std::false_type {}; -template -struct is_protocol_view> : std::true_type {}; - template inline constexpr bool is_protocol_view_v = is_protocol_view::value; -} // namespace xyz::reflection +} // namespace xyz::detail #endif // XYZ_PROTOCOL_PROTOCOL_TRAITS_HH_ diff --git a/protocol_wrappers.hh b/xyz/detail/protocol_wrappers.hh similarity index 97% rename from protocol_wrappers.hh rename to xyz/detail/protocol_wrappers.hh index b30acaf9..d8877eb5 100644 --- a/protocol_wrappers.hh +++ b/xyz/detail/protocol_wrappers.hh @@ -27,11 +27,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include "conformance.hh" -#include "conversion_thunks.hh" -#include "member_function_thunks.hh" -#include "operator_thunks.hh" -#include "overload_spec.hh" +#include "xyz/detail/conformance.hh" +#include "xyz/detail/conversion_thunks.hh" +#include "xyz/detail/member_function_thunks.hh" +#include "xyz/detail/operator_thunks.hh" +#include "xyz/detail/overload_spec.hh" namespace xyz::detail { diff --git a/vtable.hh b/xyz/detail/vtable.hh similarity index 95% rename from vtable.hh rename to xyz/detail/vtable.hh index 25aba16f..14be2ae6 100644 --- a/vtable.hh +++ b/xyz/detail/vtable.hh @@ -30,17 +30,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include "conformance.hh" -#include "name_mangling.hh" -#include "overload_spec.hh" -#include "protocol_traits.hh" +#include "xyz/detail/conformance.hh" +#include "xyz/detail/name_mangling.hh" +#include "xyz/detail/overload_spec.hh" +#include "xyz/detail/protocol_traits.hh" namespace xyz::detail { // The mangled name of `Member`, computed once per distinct `Member`. template constexpr inline auto mangled_name_of = - std::define_static_string(xyz::name_mangling::mangle(Member)); + std::define_static_string(xyz::detail::mangle(Member)); // The `VtableType` entry named after the mangled member function `Member`. template @@ -63,8 +63,7 @@ template >) { + if constexpr (is_protocol_v>) { assert(!valueless_after_move(*protocol_object) && "cannot call member function of valueless protocol"); } @@ -77,8 +76,7 @@ template consteval std::vector generate_vtable_specs() { std::vector function_pointer_specs; diff --git a/protocol.hh b/xyz/protocol.hh similarity index 94% rename from protocol.hh rename to xyz/protocol.hh index 269895a0..0ded634c 100644 --- a/protocol.hh +++ b/xyz/protocol.hh @@ -17,8 +17,8 @@ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ==============================================================================*/ -#ifndef XYZ_REFLECTION_PROTOCOL_HH_ -#define XYZ_REFLECTION_PROTOCOL_HH_ +#ifndef XYZ_PROTOCOL_PROTOCOL_HH_ +#define XYZ_PROTOCOL_PROTOCOL_HH_ // A C++26-reflection-based implementation of protocol and protocol_view. // @@ -26,8 +26,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // runtime through a generated vtable; `protocol`'s vtable extends // `protocol_view`'s with destroy/copy/move entries used for allocator-aware // ownership. Vtable entries are named by mangling the interface member -// function's signature (see "name_mangling.hh"), so an entry can be found by -// the signature it implements rather than by declaration order. +// function's signature (see "xyz/detail/name_mangling.hh"), so an entry can +// be found by the signature it implements rather than by declaration order. // // Neither implementation currently supports operators other than operator(). @@ -48,16 +48,28 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include "conformance.hh" -#include "conversion_thunks.hh" -#include "member_function_thunks.hh" -#include "name_mangling.hh" -#include "operator_thunks.hh" -#include "protocol_traits.hh" -#include "protocol_wrappers.hh" -#include "vtable.hh" +#include "xyz/detail/conformance.hh" +#include "xyz/detail/conversion_thunks.hh" +#include "xyz/detail/member_function_thunks.hh" +#include "xyz/detail/name_mangling.hh" +#include "xyz/detail/operator_thunks.hh" +#include "xyz/detail/protocol_traits.hh" +#include "xyz/detail/protocol_wrappers.hh" +#include "xyz/detail/vtable.hh" -namespace xyz::reflection { +namespace xyz { + +template +class protocol; + +template +class protocol_view; + +template +struct detail::is_protocol> : std::true_type {}; + +template +struct detail::is_protocol_view> : std::true_type {}; // Returns `true` if `Candidate` is a structural subtype of `Interface`; // otherwise returns `false`. @@ -120,7 +132,8 @@ struct bad_protocol_cast : std::exception { // through the owning vtable (see `vtable` below). Calling a member function // on a valueless (moved-from) `protocol` is a precondition violation. // --------------------------------------------------------------------------- -template > +template > class protocol : public detail::protocol_wrappers_t, detail::vtable_t, @@ -248,7 +261,7 @@ class protocol // Grants `protocol_view` access so that a view of a protocol can share its // vtable. - template + template friend class protocol_view; template @@ -502,7 +515,7 @@ class protocol // does not restrict the interface. Use `protocol_view` to view a // const object. // --------------------------------------------------------------------------- -template +template class protocol_view : public detail::protocol_wrappers_t, detail::vtable_t, @@ -522,7 +535,7 @@ class protocol_view // Views a non-const object that conforms to the Interface T. template requires is_protocol_conformant_v> && - (!is_protocol_view_v>) && + (!detail::is_protocol_view_v>) && (!std::is_const_v) protocol_view(U& object) : object_(static_cast(std::addressof(object))), @@ -531,7 +544,7 @@ class protocol_view // A view of a temporary would dangle. template requires is_protocol_conformant_v> && - (!is_protocol_view_v>) && + (!detail::is_protocol_view_v>) && (!std::is_const_v) protocol_view(const U&&) = delete; @@ -549,7 +562,7 @@ class protocol_view private: // Grants `protocol_view` access so it can share this view's // `object_`/`vtable_`. - template + template friend class protocol_view; // Grants the synthesised member thunks access to `object_`/`vtable_` so @@ -603,7 +616,7 @@ class protocol_view // // Views a const object `T` and exposes the const member functions. // --------------------------------------------------------------------------- -template +template class protocol_view : public detail::protocol_wrappers_t, detail::vtable_t, @@ -623,7 +636,7 @@ class protocol_view // Views a (possibly const) object that conforms to the Interface T. template requires is_protocol_conformant_v> && - (!is_protocol_view_v>) + (!detail::is_protocol_view_v>) protocol_view(const U& object) : object_(static_cast(std::addressof(object))), vtable_(&detail::view_vtable_for) {} @@ -631,7 +644,7 @@ class protocol_view // A view of a temporary would dangle. template requires is_protocol_conformant_v> && - (!is_protocol_view_v>) + (!detail::is_protocol_view_v>) protocol_view(const U&&) = delete; // Views the object a `protocol` owns, sharing its vtable. @@ -701,6 +714,6 @@ class protocol_view const detail::vtable_t* vtable_; }; -} // namespace xyz::reflection +} // namespace xyz -#endif // XYZ_REFLECTION_PROTOCOL_HH_ +#endif // XYZ_PROTOCOL_PROTOCOL_HH_ diff --git a/allocator_tests.cc b/xyz/tests/allocator_tests.cc similarity index 97% rename from allocator_tests.cc rename to xyz/tests/allocator_tests.cc index fd26c7b6..10494beb 100644 --- a/allocator_tests.cc +++ b/xyz/tests/allocator_tests.cc @@ -25,15 +25,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include "protocol.hh" -#include "tagged_allocator.h" -#include "tracking_allocator.h" - -// Workaround to move protocol into xyz namespace -namespace xyz { -using reflection::protocol; -} +#include "xyz/protocol.hh" +#include "xyz/tests/tagged_allocator.h" +#include "xyz/tests/tracking_allocator.h" +namespace xyz::tests { namespace { // A simple interface to test protocol with. @@ -45,7 +41,7 @@ struct IntLike { // test narrowing constructors. struct Blank {}; -using TestAlloc = xyz::TrackingAllocator; +using TestAlloc = xyz::tests::TrackingAllocator; using TestProtocol = xyz::protocol; // A simple test class that we will place in protocol. @@ -574,8 +570,8 @@ TEST(ProtocolTest, SwapUnequal) { // Extends TrackingAllocator with POCCA set to true. template -struct PoccaAllocator : xyz::TrackingAllocator { - using xyz::TrackingAllocator::TrackingAllocator; +struct PoccaAllocator : xyz::tests::TrackingAllocator { + using xyz::tests::TrackingAllocator::TrackingAllocator; using propagate_on_container_copy_assignment = std::true_type; template @@ -623,8 +619,8 @@ TEST(ProtocolTest, CopyAssignmentUnequalPocca) { // Extends TrackingAllocator with POCMA set to true. template -struct PocmaAllocator : xyz::TrackingAllocator { - using xyz::TrackingAllocator::TrackingAllocator; +struct PocmaAllocator : xyz::tests::TrackingAllocator { + using xyz::tests::TrackingAllocator::TrackingAllocator; using propagate_on_container_move_assignment = std::true_type; template @@ -674,8 +670,8 @@ TEST(ProtocolTest, MoveAssignmentUnequalPocma) { // Extends TrackingAllocator with POCS set to true. template -struct PocsAllocator : xyz::TrackingAllocator { - using xyz::TrackingAllocator::TrackingAllocator; +struct PocsAllocator : xyz::tests::TrackingAllocator { + using xyz::tests::TrackingAllocator::TrackingAllocator; using propagate_on_container_swap = std::true_type; template @@ -732,7 +728,7 @@ struct TestException : std::bad_alloc {}; // Tests can pass in should_throw and change its value to exercise exception // safety. template -struct ThrowingAllocator : xyz::TrackingAllocator { +struct ThrowingAllocator : xyz::tests::TrackingAllocator { const bool* should_throw_; template @@ -745,7 +741,7 @@ struct ThrowingAllocator : xyz::TrackingAllocator { // them; the check cannot see that in this uninstantiated template. ThrowingAllocator(unsigned* allocs, unsigned* deallocs, const bool* should_throw) - : xyz::TrackingAllocator(allocs, deallocs), + : xyz::tests::TrackingAllocator(allocs, deallocs), should_throw_(should_throw) {} // NOLINTEND(readability-non-const-parameter) @@ -754,12 +750,13 @@ struct ThrowingAllocator : xyz::TrackingAllocator { if (*should_throw_) { throw TestException{}; } - return xyz::TrackingAllocator::allocate(count); + return xyz::tests::TrackingAllocator::allocate(count); } template ThrowingAllocator(const ThrowingAllocator& other) - : xyz::TrackingAllocator(other), should_throw_(other.should_throw_) {} + : xyz::tests::TrackingAllocator(other), + should_throw_(other.should_throw_) {} }; using ThrowingAlloc = ThrowingAllocator; @@ -1051,3 +1048,4 @@ TEST(ProtocolTest, UnequalMoveAssignment) { } } // namespace +} // namespace xyz::tests diff --git a/conformance_tests.cc b/xyz/tests/conformance_tests.cc similarity index 98% rename from conformance_tests.cc rename to xyz/tests/conformance_tests.cc index 86e3a05c..6f8313ed 100644 --- a/conformance_tests.cc +++ b/xyz/tests/conformance_tests.cc @@ -12,10 +12,9 @@ #include #include -#include "protocol.hh" - -using xyz::reflection::is_protocol_conformant; +#include "xyz/protocol.hh" +namespace xyz::tests { namespace { // --------------------------------------------------------------------------- @@ -721,14 +720,13 @@ TEST(ConformsToTest, ReservedMemberNamesAreThePublicMembersOfProtocol) { }; #ifndef __clang__ - static_assert(public_member_names_are(^^xyz::reflection::protocol, + static_assert(public_member_names_are(^^xyz::protocol, xyz::detail::reserved_member_names)); + static_assert(public_member_names_are(^^xyz::protocol_view, { + })); static_assert( - public_member_names_are(^^xyz::reflection::protocol_view, { - })); - static_assert(public_member_names_are( - ^^xyz::reflection::protocol_view, { - })); + public_member_names_are(^^xyz::protocol_view, { + })); #endif // __clang__ } @@ -1100,3 +1098,4 @@ TEST(ConformsToTest, StaticOverloadConformsAlongsideNonStatic) { } } // namespace +} // namespace xyz::tests diff --git a/consteval_check.h b/xyz/tests/consteval_check.h similarity index 93% rename from consteval_check.h rename to xyz/tests/consteval_check.h index 347e1068..7da707e2 100644 --- a/consteval_check.h +++ b/xyz/tests/consteval_check.h @@ -17,8 +17,8 @@ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ==============================================================================*/ -#ifndef XYZ_REFLECTION_CONSTEVAL_CHECK_H_ -#define XYZ_REFLECTION_CONSTEVAL_CHECK_H_ +#ifndef XYZ_CONSTEVAL_CHECK_H_ +#define XYZ_CONSTEVAL_CHECK_H_ // A compile-time assertion helper for use inside `consteval` blocks and // functions. `static_assert` requires its operand to be a constant expression @@ -43,7 +43,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #endif -namespace xyz { +namespace xyz::tests { class consteval_check_failure : public std::exception { public: @@ -58,7 +58,7 @@ class consteval_check_failure : public std::exception { std::string message_; }; -namespace detail::consteval_check { +namespace consteval_check { // Best-effort rendering of an operand for the diagnostic. template @@ -162,8 +162,8 @@ constexpr void report(captured_value value, report(value.evaluate(), expression_text, location); } -} // namespace detail::consteval_check -} // namespace xyz +} // namespace consteval_check +} // namespace xyz::tests // GCC's -Wparentheses fires on `capturer <= lhs == rhs`, so the capture is // bracketed by push/pop pragmas. Kept as separate macros so that the main @@ -174,13 +174,13 @@ constexpr void report(captured_value value, #define XYZ_CONSTEVAL_CHECK_INTERNAL_RESTORE_WARNINGS \ _Pragma("GCC diagnostic pop") -#define XYZ_CONSTEVAL_CHECK(...) \ - do { \ - XYZ_CONSTEVAL_CHECK_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ - ::xyz::detail::consteval_check::report( \ - (::xyz::detail::consteval_check::value_capturer{} <= __VA_ARGS__), \ - #__VA_ARGS__, std::source_location::current()); \ - XYZ_CONSTEVAL_CHECK_INTERNAL_RESTORE_WARNINGS \ +#define XYZ_CONSTEVAL_CHECK(...) \ + do { \ + XYZ_CONSTEVAL_CHECK_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + ::xyz::tests::consteval_check::report( \ + (::xyz::tests::consteval_check::value_capturer{} <= __VA_ARGS__), \ + #__VA_ARGS__, std::source_location::current()); \ + XYZ_CONSTEVAL_CHECK_INTERNAL_RESTORE_WARNINGS \ } while (false) -#endif // XYZ_REFLECTION_CONSTEVAL_CHECK_H_ +#endif // XYZ_CONSTEVAL_CHECK_H_ diff --git a/consteval_check_test.cc b/xyz/tests/consteval_check_test.cc similarity index 98% rename from consteval_check_test.cc rename to xyz/tests/consteval_check_test.cc index 38829475..ad5b218b 100644 --- a/consteval_check_test.cc +++ b/xyz/tests/consteval_check_test.cc @@ -18,15 +18,14 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ==============================================================================*/ -#include "consteval_check.h" +#include "xyz/tests/consteval_check.h" #include #include #include -using xyz::consteval_check_failure; - +namespace xyz::tests { namespace { // --------------------------------------------------------------------------- @@ -151,3 +150,4 @@ TEST(ConstevalCheckTest, UnsupportedTypeDisplaysPlaceholder) { } } // namespace +} // namespace xyz::tests diff --git a/forwarding_test.cc b/xyz/tests/forwarding_test.cc similarity index 98% rename from forwarding_test.cc rename to xyz/tests/forwarding_test.cc index 60112dfc..526bc7df 100644 --- a/forwarding_test.cc +++ b/xyz/tests/forwarding_test.cc @@ -13,11 +13,9 @@ #include #include -#include "protocol.hh" - -using xyz::reflection::protocol; -using xyz::reflection::protocol_view; +#include "xyz/protocol.hh" +namespace xyz::tests { namespace { // Counts copies and moves so tests can assert how arguments and return @@ -672,8 +670,7 @@ TEST(ReflectionProtocolTest, AcceptExplicitObject) { int bar(this const Conforming&) { return 10; } }; - static_assert( - xyz::reflection::is_protocol_conformant_v); + static_assert(xyz::is_protocol_conformant_v); protocol p(Conforming{}); EXPECT_EQ(p.foo(), 5); @@ -686,3 +683,4 @@ TEST(ReflectionProtocolTest, AcceptExplicitObject) { } } // namespace +} // namespace xyz::tests diff --git a/name_mangling_tests.cc b/xyz/tests/name_mangling_tests.cc similarity index 94% rename from name_mangling_tests.cc rename to xyz/tests/name_mangling_tests.cc index 4cf4c183..2bcac98e 100644 --- a/name_mangling_tests.cc +++ b/xyz/tests/name_mangling_tests.cc @@ -9,10 +9,11 @@ #include #include -#include "name_mangling.hh" +#include "xyz/detail/name_mangling.hh" -using xyz::name_mangling::mangle; +using xyz::detail::mangle; +namespace xyz::tests { namespace { enum class Kind : std::uint8_t { one, two }; @@ -81,7 +82,7 @@ TEST(NameManglingTest, ConversionFunctionManglesItsTargetTypeOnce) { }; static_assert(mangle(^^Conversions::operator Widget) == - "fn_NKcvN12_GLOBAL__N_16WidgetEE"); + "fn_NKcvN3xyz5tests12_GLOBAL__N_16WidgetEE"); static_assert(mangle(^^Conversions::operator int) == "fn_cviDo"); } @@ -121,12 +122,12 @@ TEST(NameManglingTest, NamesAnExtendedFundamentalTypeParameter) { TEST(NameManglingTest, NamesAReferenceToALocalClassType) { static_assert(mangle(^^Interface::set_widget_ref) == - "fn_14set_widget_refvRKN12_GLOBAL__N_16WidgetE"); + "fn_14set_widget_refvRKN3xyz5tests12_GLOBAL__N_16WidgetE"); } TEST(NameManglingTest, NamesAnEnumerationParameter) { static_assert(mangle(^^Interface::set_kind) == - "fn_8set_kindvN12_GLOBAL__N_14KindE"); + "fn_8set_kindvN3xyz5tests12_GLOBAL__N_14KindE"); } TEST(NameManglingTest, NamesAClassTemplateSpecialisationParameter) { @@ -140,19 +141,21 @@ TEST(NameManglingTest, NamesAClassTemplateSpecialisationParameter) { TEST(NameManglingTest, NamesAnIntegralNonTypeTemplateArgument) { static_assert(mangle(^^Interface::set_tagged) == - "fn_10set_taggedvN12_GLOBAL__N_16TaggedILi3EEE"); + "fn_10set_taggedvN3xyz5tests12_GLOBAL__N_16TaggedILi3EEE"); } TEST(NameManglingTest, NamesANegativeIntegralNonTypeTemplateArgument) { - static_assert(mangle(^^Interface::set_negative_tagged) == - "fn_19set_negative_taggedvN12_GLOBAL__N_16TaggedILin3EEE"); + static_assert( + mangle(^^Interface::set_negative_tagged) == + "fn_19set_negative_taggedvN3xyz5tests12_GLOBAL__N_16TaggedILin3EEE"); } TEST(NameManglingTest, DoesNotTruncateA64BitNonTypeTemplateArgumentToSizeT) { static_assert(mangle(^^Interface::set_zero) == - "fn_8set_zerovN12_GLOBAL__N_18Tagged64ILx0EEE"); - static_assert(mangle(^^Interface::set_big) == - "fn_7set_bigvN12_GLOBAL__N_18Tagged64ILx4294967296EEE"); + "fn_8set_zerovN3xyz5tests12_GLOBAL__N_18Tagged64ILx0EEE"); + static_assert( + mangle(^^Interface::set_big) == + "fn_7set_bigvN3xyz5tests12_GLOBAL__N_18Tagged64ILx4294967296EEE"); static_assert(mangle(^^Interface::set_zero) != mangle(^^Interface::set_big)); } @@ -354,8 +357,8 @@ TEST(NameManglingTest, NamesUnaryOnlyOperators) { TEST(NameManglingTest, NamesAssignmentAndCompoundAssignmentOperators) { static_assert(mangle(^^AllOperators::operator=) == - "fn_aSRN12_GLOBAL__N_112AllOperatorsE" - "RKN12_GLOBAL__N_112AllOperatorsE"); + "fn_aSRN3xyz5tests12_GLOBAL__N_112AllOperatorsE" + "RKN3xyz5tests12_GLOBAL__N_112AllOperatorsE"); static_assert(mangle(^^AllOperators::operator+=) == "fn_pLii"); static_assert(mangle(^^AllOperators::operator-=) == "fn_mIii"); static_assert(mangle(^^AllOperators::operator*=) == "fn_mLii"); @@ -421,3 +424,4 @@ TEST(NameManglingTest, } } // namespace +} // namespace xyz::tests diff --git a/protocol_member_function_tests.cc b/xyz/tests/protocol_member_function_tests.cc similarity index 98% rename from protocol_member_function_tests.cc rename to xyz/tests/protocol_member_function_tests.cc index 01783093..f7dd8581 100644 --- a/protocol_member_function_tests.cc +++ b/xyz/tests/protocol_member_function_tests.cc @@ -7,11 +7,10 @@ #include #include -#include "protocol.hh" -#include "tracking_allocator.h" - -using xyz::reflection::protocol; +#include "xyz/protocol.hh" +#include "xyz/tests/tracking_allocator.h" +namespace xyz::tests { namespace { // Concepts for negative member function tests: a requires-expression naming a @@ -374,9 +373,9 @@ TEST(ReflectionProtocolTest, ForwardingWithCustomAllocator) { unsigned allocs = 0; unsigned deallocs = 0; - xyz::TrackingAllocator alloc{&allocs, &deallocs}; + xyz::tests::TrackingAllocator alloc{&allocs, &deallocs}; - protocol> p( + protocol> p( std::allocator_arg, alloc, Conforming(42)); EXPECT_EQ(p.get(), 42); @@ -606,3 +605,4 @@ TEST(ReflectionProtocolTest, VolatileConformingType) { } } // namespace +} // namespace xyz::tests diff --git a/protocol_operator_tests.cc b/xyz/tests/protocol_operator_tests.cc similarity index 99% rename from protocol_operator_tests.cc rename to xyz/tests/protocol_operator_tests.cc index ea5a86b7..7f0bb8a4 100644 --- a/protocol_operator_tests.cc +++ b/xyz/tests/protocol_operator_tests.cc @@ -28,12 +28,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include "protocol.hh" -#include "test_helpers.h" - -using xyz::reflection::protocol; -using xyz::reflection::protocol_view; +#include "xyz/protocol.hh" +#include "xyz/tests/test_helpers.h" +namespace xyz::tests { namespace { TEST(ReflectionProtocolTest, CallOperator) { @@ -1630,3 +1628,4 @@ TEST(ReflectionProtocolTest, ComparisonWithStringViewAndSentinelOperands) { EXPECT_TRUE(std::default_sentinel == pcv); } } // namespace +} // namespace xyz::tests diff --git a/protocol_test.cc b/xyz/tests/protocol_test.cc similarity index 97% rename from protocol_test.cc rename to xyz/tests/protocol_test.cc index 0fe902ef..dc4fd11d 100644 --- a/protocol_test.cc +++ b/xyz/tests/protocol_test.cc @@ -2,7 +2,7 @@ // protocol_view: type traits, special member functions, constructability, // protocol_cast and target_type. -#include "protocol.hh" +#include "xyz/protocol.hh" #include @@ -13,12 +13,11 @@ #include #include -using xyz::reflection::is_protocol_v; -using xyz::reflection::is_protocol_view_v; -using xyz::reflection::is_valid_interface; -using xyz::reflection::protocol; -using xyz::reflection::protocol_view; +using xyz::detail::is_protocol_v; +using xyz::detail::is_protocol_view_v; +using xyz::detail::is_valid_interface; +namespace xyz::tests { namespace { // --------------------------------------------------------------------------- @@ -557,12 +556,11 @@ TEST(ReflectionProtocolTest, FailedProtocolCast) { struct OtherType {}; protocol p(Conforming{.value = 25}); - EXPECT_THROW(protocol_cast(p), xyz::reflection::bad_protocol_cast); + EXPECT_THROW(protocol_cast(p), xyz::bad_protocol_cast); EXPECT_EQ(protocol_cast(&p), nullptr); protocol_view pv(p); - EXPECT_THROW(protocol_cast(pv), - xyz::reflection::bad_protocol_cast); + EXPECT_THROW(protocol_cast(pv), xyz::bad_protocol_cast); EXPECT_EQ(protocol_cast(&pv), nullptr); } @@ -604,8 +602,7 @@ TEST(ReflectionProtocolViewTest, FailedConstProtocolCast) { Conforming c; protocol_view pv(c); - EXPECT_THROW(protocol_cast(pv), - xyz::reflection::bad_protocol_cast); + EXPECT_THROW(protocol_cast(pv), xyz::bad_protocol_cast); EXPECT_EQ(protocol_cast(&pv), nullptr); } @@ -789,3 +786,4 @@ TEST(ReflectionProtocolTest, ValuelessAfterMoveFunctionDoesNotCollide) { } } // namespace +} // namespace xyz::tests diff --git a/protocol_view_tests.cc b/xyz/tests/protocol_view_tests.cc similarity index 98% rename from protocol_view_tests.cc rename to xyz/tests/protocol_view_tests.cc index 9d24d1e7..73873a75 100644 --- a/protocol_view_tests.cc +++ b/xyz/tests/protocol_view_tests.cc @@ -9,13 +9,11 @@ #include #include -#include "protocol.hh" -#include "test_helpers.h" -#include "tracking_allocator.h" - -using xyz::reflection::protocol; -using xyz::reflection::protocol_view; +#include "xyz/protocol.hh" +#include "xyz/tests/test_helpers.h" +#include "xyz/tests/tracking_allocator.h" +namespace xyz::tests { namespace { // Concepts for negative member function tests: a requires-expression naming a @@ -759,10 +757,10 @@ TEST(ReflectionProtocolViewTest, ViewOfProtocolWithCustomAllocator) { unsigned allocs = 0; unsigned deallocs = 0; - xyz::TrackingAllocator alloc{&allocs, &deallocs}; + xyz::tests::TrackingAllocator alloc{&allocs, &deallocs}; - protocol> p(std::allocator_arg, - alloc, Conforming{}); + protocol> p( + std::allocator_arg, alloc, Conforming{}); protocol_view view(p); EXPECT_EQ(view.get(), 9); @@ -864,3 +862,4 @@ TEST(ReflectionProtocolViewTest, ViewOfConformingObjectPassedByValue) { } } // namespace +} // namespace xyz::tests diff --git a/tagged_allocator.h b/xyz/tests/tagged_allocator.h similarity index 98% rename from tagged_allocator.h rename to xyz/tests/tagged_allocator.h index 4b87a34e..d500f9af 100644 --- a/tagged_allocator.h +++ b/xyz/tests/tagged_allocator.h @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -namespace xyz { +namespace xyz::tests { template struct TaggedAllocator { @@ -76,6 +76,6 @@ struct TaggedAllocator { } }; -} // namespace xyz +} // namespace xyz::tests #endif // XYZ_TAGGED_ALLOCATOR_H_ diff --git a/test_helpers.h b/xyz/tests/test_helpers.h similarity index 92% rename from test_helpers.h rename to xyz/tests/test_helpers.h index 27508fcb..202cf138 100644 --- a/test_helpers.h +++ b/xyz/tests/test_helpers.h @@ -21,9 +21,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef XYZ_TEST_HELPERS_H #define XYZ_TEST_HELPERS_H -#include "protocol.hh" +#include "xyz/protocol.hh" -namespace xyz { +namespace xyz::tests { template constexpr bool static_test() { @@ -39,10 +39,8 @@ struct NonCopyable { NonCopyable& operator=(NonCopyable&&) = default; }; -} // namespace xyz - -// Concepts for call operator tests, shared by protocol_test.cc and -// protocol_operator_tests.cc. +// Concepts for call operator tests, shared by protocol_operator_tests.cc and +// protocol_view_tests.cc. template concept is_callable = requires(P& p) { p(); }; @@ -60,4 +58,6 @@ concept operator_overload_set_can_be_sliced_from = requires(Derived d) { xyz::detail::operator_overload_set) {}(d); }; +} // namespace xyz::tests + #endif // XYZ_TEST_HELPERS_H diff --git a/tracking_allocator.h b/xyz/tests/tracking_allocator.h similarity index 98% rename from tracking_allocator.h rename to xyz/tests/tracking_allocator.h index 4b0dae2e..ca00d0e7 100644 --- a/tracking_allocator.h +++ b/xyz/tests/tracking_allocator.h @@ -24,7 +24,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -namespace xyz { +namespace xyz::tests { template struct TrackingAllocator { @@ -70,6 +70,6 @@ struct TrackingAllocator { } }; -} // namespace xyz +} // namespace xyz::tests #endif // XYZ_TRACKING_ALLOCATOR_H_ diff --git a/vtable_tests.cc b/xyz/tests/vtable_tests.cc similarity index 83% rename from vtable_tests.cc rename to xyz/tests/vtable_tests.cc index 43876624..d74da4b1 100644 --- a/vtable_tests.cc +++ b/xyz/tests/vtable_tests.cc @@ -1,7 +1,7 @@ // Tests for xyz::detail::generate_vtable_specs: a vtable entry's // function-pointer type must carry the interface member's noexcept-ness -// (issue #365), since the view trampolines in vtable.hh deduce their own -// noexcept-ness from that pointer type. +// (issue #365), since the view trampolines in xyz/detail/vtable.hh deduce their +// own noexcept-ness from that pointer type. #include @@ -11,9 +11,10 @@ #include #include -#include "name_mangling.hh" -#include "vtable.hh" +#include "xyz/detail/name_mangling.hh" +#include "xyz/detail/vtable.hh" +namespace xyz::tests { namespace { struct NoexceptInterface { @@ -32,10 +33,10 @@ using xyz::detail::vtable_t; // std::define_static_string, and this GCC trunk snapshot emits a duplicate // symbol when that template is instantiated for `Member` a second time // (once here, once inside generate_vtable_specs). Calling -// xyz::name_mangling::mangle directly avoids the shared template. +// xyz::detail::mangle directly avoids the shared template. template consteval std::meta::info vtable_entry_for() { - std::string name = xyz::name_mangling::mangle(Member); + std::string name = xyz::detail::mangle(Member); std::vector members = nonstatic_data_members_of( VtableType, std::meta::access_context::unprivileged()); for (std::meta::info member : members) { @@ -59,3 +60,4 @@ TEST(VtableTest, ThrowingInterfaceMemberGetsANonNoexceptVtableEntry) { } } // namespace +} // namespace xyz::tests diff --git a/tutorials/.clang-tidy b/xyz/tutorials/.clang-tidy similarity index 100% rename from tutorials/.clang-tidy rename to xyz/tutorials/.clang-tidy diff --git a/tutorials/01_polymorphism.cc b/xyz/tutorials/01_polymorphism.cc similarity index 100% rename from tutorials/01_polymorphism.cc rename to xyz/tutorials/01_polymorphism.cc diff --git a/tutorials/02_type_erasure.cc b/xyz/tutorials/02_type_erasure.cc similarity index 100% rename from tutorials/02_type_erasure.cc rename to xyz/tutorials/02_type_erasure.cc diff --git a/tutorials/03_reflection.cc b/xyz/tutorials/03_reflection.cc similarity index 99% rename from tutorials/03_reflection.cc rename to xyz/tutorials/03_reflection.cc index ed2f7b4b..707069e3 100644 --- a/tutorials/03_reflection.cc +++ b/xyz/tutorials/03_reflection.cc @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include "consteval_check.h" +#include "xyz/tests/consteval_check.h" // A very brief (and intentionally incomplete) tour of C++26 reflection. @@ -92,7 +92,7 @@ TEST(TutorialsReflection, MembersOfWithConstevalBlock) { // A bare `throw std::runtime_error("...")` would work too, but the // resulting diagnostic only shows the hand-written string, not what was // actually compared. `XYZ_CONSTEVAL_CHECK` decomposes the expression and - // throws `xyz::consteval_check_failure`, whose `what()` carries the + // throws `xyz::tests::consteval_check_failure`, whose `what()` carries the // `file:line`, the expression text, and the operand values, e.g. // "reflection.cc:NN: check failed: identifier_of(members[1]) == \"y\" // [\"x\" == \"y\"]". GCC prints `what()` of an uncaught exception thrown diff --git a/tutorials/04_vanishing_this.cc b/xyz/tutorials/04_vanishing_this.cc similarity index 100% rename from tutorials/04_vanishing_this.cc rename to xyz/tutorials/04_vanishing_this.cc diff --git a/tutorials/05_allocators.cc b/xyz/tutorials/05_allocators.cc similarity index 100% rename from tutorials/05_allocators.cc rename to xyz/tutorials/05_allocators.cc diff --git a/tutorials/06_advanced_vtables.cc b/xyz/tutorials/06_advanced_vtables.cc similarity index 99% rename from tutorials/06_advanced_vtables.cc rename to xyz/tutorials/06_advanced_vtables.cc index 1bec55d3..a7cab17e 100644 --- a/tutorials/06_advanced_vtables.cc +++ b/xyz/tutorials/06_advanced_vtables.cc @@ -33,11 +33,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include "consteval_check.h" +#include "xyz/tests/consteval_check.h" // A study of using vtables for overloaded member functions and `operator()`. -// This tutorial follows on from the work in `tutorials/polymorphism.cc` and -// `tutorials/reflection.cc` +// This tutorial follows on from the work in +// `xyz/tutorials/01_polymorphism.cc` and `xyz/tutorials/03_reflection.cc` namespace xyz::tutorials::simple_vtable { diff --git a/tutorials/07_wide_pointer_sbo.cc b/xyz/tutorials/07_wide_pointer_sbo.cc similarity index 100% rename from tutorials/07_wide_pointer_sbo.cc rename to xyz/tutorials/07_wide_pointer_sbo.cc diff --git a/tutorials/08_wide_pointer_narrowing.cc b/xyz/tutorials/08_wide_pointer_narrowing.cc similarity index 100% rename from tutorials/08_wide_pointer_narrowing.cc rename to xyz/tutorials/08_wide_pointer_narrowing.cc diff --git a/tutorials/BUILD.bazel b/xyz/tutorials/BUILD.bazel similarity index 100% rename from tutorials/BUILD.bazel rename to xyz/tutorials/BUILD.bazel diff --git a/tutorials/CMakeLists.txt b/xyz/tutorials/CMakeLists.txt similarity index 100% rename from tutorials/CMakeLists.txt rename to xyz/tutorials/CMakeLists.txt From dd48ae92d42325f1402f4a6b33f9442ea28067d6 Mon Sep 17 00:00:00 2001 From: Philip Craig <689193+philipcraig@users.noreply.github.com> Date: Sun, 11 Oct 2026 06:50:00 +0000 Subject: [PATCH 2/3] Tidy up the layout follow-ups to the xyz/ move - Put the detail headers in a :detail Bazel target that the tests depend on directly, rather than private headers of :protocol. - Find the coverage script's headers with one recursive glob under xyz/ and create each destination directory as files are copied, so any translation unit can be probed. - Move consteval_check.h, shared by tests and tutorials, to xyz/testing. --- BUILD.bazel | 15 ++++++++--- codecov.yml | 1 + scripts/consteval_coverage.py | 34 ++++++++++++------------ xyz/{tests => testing}/consteval_check.h | 18 ++++++------- xyz/tests/consteval_check_test.cc | 4 ++- xyz/tutorials/03_reflection.cc | 4 +-- xyz/tutorials/06_advanced_vtables.cc | 2 +- 7 files changed, 45 insertions(+), 33 deletions(-) rename xyz/{tests => testing}/consteval_check.h (96%) diff --git a/BUILD.bazel b/BUILD.bazel index f95a5509..ad404f6a 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -3,9 +3,11 @@ load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") package(default_visibility = ["//visibility:public"]) +# Implementation headers. Visible only inside this repository; tests that +# include them depend on this target directly. cc_library( - name = "protocol", - srcs = [ + name = "detail", + hdrs = [ "xyz/detail/conformance.hh", "xyz/detail/conversion_thunks.hh", "xyz/detail/member_function_thunks.hh", @@ -16,12 +18,18 @@ cc_library( "xyz/detail/protocol_wrappers.hh", "xyz/detail/vtable.hh", ], + visibility = ["//:__subpackages__"], +) + +cc_library( + name = "protocol", hdrs = ["xyz/protocol.hh"], + deps = [":detail"], ) cc_library( name = "consteval_check", - hdrs = ["xyz/tests/consteval_check.h"], + hdrs = ["xyz/testing/consteval_check.h"], ) cc_test( @@ -44,6 +52,7 @@ cc_test( ], deps = [ ":consteval_check", + ":detail", ":protocol", "@googletest//:gtest_main", ], diff --git a/codecov.yml b/codecov.yml index 7e7aa92f..008936f6 100644 --- a/codecov.yml +++ b/codecov.yml @@ -6,6 +6,7 @@ codecov: ignore: - "xyz/tests/**" + - "xyz/testing/**" - "xyz/tutorials/**" coverage: diff --git a/scripts/consteval_coverage.py b/scripts/consteval_coverage.py index 2a01f5f1..fca4650a 100644 --- a/scripts/consteval_coverage.py +++ b/scripts/consteval_coverage.py @@ -62,12 +62,20 @@ SOURCE_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +def source_files(suffix: str) -> list[str]: + """Repository-relative paths of the files under xyz/ ending in `suffix`.""" + return sorted( + os.path.relpath(path, SOURCE_ROOT) + for path in glob.glob( + os.path.join(SOURCE_ROOT, "xyz", "**", f"*{suffix}"), recursive=True + ) + ) + + # Library headers use the .hh suffix; test helpers (.h) are not instrumented. -INSTRUMENTED_HEADERS = sorted( - os.path.relpath(path, SOURCE_ROOT) - for pattern in ("xyz/*.hh", "xyz/detail/*.hh") - for path in glob.glob(os.path.join(SOURCE_ROOT, pattern)) -) +INSTRUMENTED_HEADERS = source_files(".hh") +HELPER_HEADERS = source_files(".h") TRAP_HEADER = "consteval_coverage_probe.h" @@ -441,21 +449,13 @@ def populate_work_dir( shutil.rmtree(work_dir) os.makedirs(work_dir) open(marker, "w").close() - os.makedirs(os.path.join(work_dir, "xyz", "detail")) - os.makedirs(os.path.join(work_dir, "xyz", "tests")) - for pattern in ("xyz/*.hh", "xyz/detail/*.hh", "xyz/tests/*.h"): - for path in glob.glob(os.path.join(SOURCE_ROOT, pattern)): - shutil.copy( - path, os.path.join(work_dir, os.path.relpath(path, SOURCE_ROOT)) - ) + for path in INSTRUMENTED_HEADERS + HELPER_HEADERS + translation_units: + destination = os.path.join(work_dir, path) + os.makedirs(os.path.dirname(destination), exist_ok=True) + shutil.copy(os.path.join(SOURCE_ROOT, path), destination) for header, lines in instrumented_by_header.items(): with open(os.path.join(work_dir, header), "w") as out: out.write("\n".join(lines) + "\n") - for translation_unit in translation_units: - shutil.copy( - os.path.join(SOURCE_ROOT, translation_unit), - os.path.join(work_dir, translation_unit), - ) def compile_batch( diff --git a/xyz/tests/consteval_check.h b/xyz/testing/consteval_check.h similarity index 96% rename from xyz/tests/consteval_check.h rename to xyz/testing/consteval_check.h index 7da707e2..463c647e 100644 --- a/xyz/tests/consteval_check.h +++ b/xyz/testing/consteval_check.h @@ -43,7 +43,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #endif -namespace xyz::tests { +namespace xyz::testing { class consteval_check_failure : public std::exception { public: @@ -163,7 +163,7 @@ constexpr void report(captured_value value, } } // namespace consteval_check -} // namespace xyz::tests +} // namespace xyz::testing // GCC's -Wparentheses fires on `capturer <= lhs == rhs`, so the capture is // bracketed by push/pop pragmas. Kept as separate macros so that the main @@ -174,13 +174,13 @@ constexpr void report(captured_value value, #define XYZ_CONSTEVAL_CHECK_INTERNAL_RESTORE_WARNINGS \ _Pragma("GCC diagnostic pop") -#define XYZ_CONSTEVAL_CHECK(...) \ - do { \ - XYZ_CONSTEVAL_CHECK_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ - ::xyz::tests::consteval_check::report( \ - (::xyz::tests::consteval_check::value_capturer{} <= __VA_ARGS__), \ - #__VA_ARGS__, std::source_location::current()); \ - XYZ_CONSTEVAL_CHECK_INTERNAL_RESTORE_WARNINGS \ +#define XYZ_CONSTEVAL_CHECK(...) \ + do { \ + XYZ_CONSTEVAL_CHECK_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + ::xyz::testing::consteval_check::report( \ + (::xyz::testing::consteval_check::value_capturer{} <= __VA_ARGS__), \ + #__VA_ARGS__, std::source_location::current()); \ + XYZ_CONSTEVAL_CHECK_INTERNAL_RESTORE_WARNINGS \ } while (false) #endif // XYZ_CONSTEVAL_CHECK_H_ diff --git a/xyz/tests/consteval_check_test.cc b/xyz/tests/consteval_check_test.cc index ad5b218b..8ee9e10c 100644 --- a/xyz/tests/consteval_check_test.cc +++ b/xyz/tests/consteval_check_test.cc @@ -18,13 +18,15 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ==============================================================================*/ -#include "xyz/tests/consteval_check.h" +#include "xyz/testing/consteval_check.h" #include #include #include +using xyz::testing::consteval_check_failure; + namespace xyz::tests { namespace { diff --git a/xyz/tutorials/03_reflection.cc b/xyz/tutorials/03_reflection.cc index 707069e3..9739efd6 100644 --- a/xyz/tutorials/03_reflection.cc +++ b/xyz/tutorials/03_reflection.cc @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include "xyz/tests/consteval_check.h" +#include "xyz/testing/consteval_check.h" // A very brief (and intentionally incomplete) tour of C++26 reflection. @@ -92,7 +92,7 @@ TEST(TutorialsReflection, MembersOfWithConstevalBlock) { // A bare `throw std::runtime_error("...")` would work too, but the // resulting diagnostic only shows the hand-written string, not what was // actually compared. `XYZ_CONSTEVAL_CHECK` decomposes the expression and - // throws `xyz::tests::consteval_check_failure`, whose `what()` carries the + // throws `xyz::testing::consteval_check_failure`, whose `what()` carries the // `file:line`, the expression text, and the operand values, e.g. // "reflection.cc:NN: check failed: identifier_of(members[1]) == \"y\" // [\"x\" == \"y\"]". GCC prints `what()` of an uncaught exception thrown diff --git a/xyz/tutorials/06_advanced_vtables.cc b/xyz/tutorials/06_advanced_vtables.cc index a7cab17e..6c489d07 100644 --- a/xyz/tutorials/06_advanced_vtables.cc +++ b/xyz/tutorials/06_advanced_vtables.cc @@ -33,7 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include "xyz/tests/consteval_check.h" +#include "xyz/testing/consteval_check.h" // A study of using vtables for overloaded member functions and `operator()`. // This tutorial follows on from the work in From 7b848dcc87de3492623a563c35e96c7374681fcf Mon Sep 17 00:00:00 2001 From: Philip Craig <689193+philipcraig@users.noreply.github.com> Date: Sun, 11 Oct 2026 07:26:47 +0000 Subject: [PATCH 3/3] Drop the unused protocol dependency from the reflection tutorials The tutorials include only consteval_check.h; .bazelrc already enables -freflection for every target. --- xyz/tutorials/BUILD.bazel | 2 -- 1 file changed, 2 deletions(-) diff --git a/xyz/tutorials/BUILD.bazel b/xyz/tutorials/BUILD.bazel index dafa485b..15746ac2 100644 --- a/xyz/tutorials/BUILD.bazel +++ b/xyz/tutorials/BUILD.bazel @@ -22,7 +22,6 @@ cc_test( srcs = ["03_reflection.cc"], deps = [ "//:consteval_check", - "//:protocol", "@googletest//:gtest_main", ], ) @@ -47,7 +46,6 @@ cc_test( srcs = ["06_advanced_vtables.cc"], deps = [ "//:consteval_check", - "//:protocol", "@googletest//:gtest_main", ], )