Skip to content

Commit

Permalink
Merge a885ee6 into 021efe5
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber authored Dec 15, 2021
2 parents 021efe5 + a885ee6 commit cb4cae2
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ if (BUILD_TESTING)
catch_discover_tests(tests)
source_group(TREE "${CMAKE_CURRENT_LIST_DIR}/tests" FILES ${testSources})
if (MSVC)
target_compile_features(tests PRIVATE cxx_std_20)
target_compile_options(tests PRIVATE /std:c++latest) # C++20 does not include ranges yet in MSVC, because the ABI is not finalized
target_compile_options(tests PRIVATE /permissive- /constexpr:steps10000000 /diagnostics:caret)
else()
Expand Down
1 change: 1 addition & 0 deletions include/llama/ArrayIndexRange.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "ArrayExtents.hpp"
#include "Core.hpp"
#include "HasRanges.hpp"

#include <algorithm>
#include <iterator>
Expand Down
16 changes: 16 additions & 0 deletions include/llama/HasRanges.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: GPL-3.0-or-later

#pragma once

// TODO(bgruber): clang 10-13 (libstdc++ from gcc 11.2) fail to compile this currently with the issue described here:
// https://stackoverflow.com/questions/64300832/why-does-clang-think-gccs-subrange-does-not-satisfy-gccs-ranges-begin-functi
// Intel LLVM compiler is also using the clang frontend
#define CAN_USE_RANGES 0
#if __has_include(<version>)
# include <version>
# if defined(__cpp_concepts) && defined(__cpp_lib_ranges) && (!defined(__clang__) || __clang_major__ >= 14) \
&& !defined(__INTEL_LLVM_COMPILER)
# undef CAN_USE_RANGES
# define CAN_USE_RANGES 1
# endif
#endif
1 change: 1 addition & 0 deletions include/llama/View.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "BlobAllocators.hpp"
#include "Concepts.hpp"
#include "Core.hpp"
#include "HasRanges.hpp"
#include "macros.hpp"
#include "mapping/One.hpp"

Expand Down
1 change: 1 addition & 0 deletions include/llama/VirtualRecord.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pragma once

#include "View.hpp"
#include "HasRanges.hpp"

#include <iosfwd>
#include <type_traits>
Expand Down
1 change: 1 addition & 0 deletions include/llama/llama.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "Copy.hpp"
#include "Core.hpp"
#include "DumpMapping.hpp"
#include "HasRanges.hpp"
#include "Meta.hpp"
#include "ProxyRefOpMixin.hpp"
#include "Vector.hpp"
Expand Down
10 changes: 0 additions & 10 deletions include/llama/macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,6 @@
/// Forces a copy of a value. This is useful to prevent ODR usage of constants when compiling for GPU targets.
#define LLAMA_COPY(x) decltype(x)(x)

// TODO(bgruber): clang 10 and 11 fail to compile this currently with the issue described here:
// https://stackoverflow.com/questions/64300832/why-does-clang-think-gccs-subrange-does-not-satisfy-gccs-ranges-begin-functi
// let's try again with clang 12
// Intel LLVM compiler is also using the clang frontend
#if(__has_include(<ranges>) && defined(__cpp_concepts) && !defined(__clang__) && !defined(__INTEL_LLVM_COMPILER))
# define CAN_USE_RANGES 1
#else
# define CAN_USE_RANGES 0
#endif

// https://devblogs.microsoft.com/cppblog/optimizing-the-layout-of-empty-base-classes-in-vs2015-update-2-3/
#if defined(_MSC_VER)
# define LLAMA_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
Expand Down

0 comments on commit cb4cae2

Please sign in to comment.