Skip to content

Commit

Permalink
clang-format and mdspan guards
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Ransom Ryan committed Apr 13, 2020
1 parent 048012f commit 04ccbca
Show file tree
Hide file tree
Showing 18 changed files with 1,416 additions and 1,407 deletions.
17 changes: 6 additions & 11 deletions src/experimental/__p0009_bits/accessor_basic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,15 @@
namespace std {
namespace experimental {

template <class ElementType>
struct accessor_basic {

template <class ElementType> struct accessor_basic {

using offset_policy = accessor_basic;
using element_type = ElementType;
using reference = ElementType&;
using pointer = ElementType*;
using reference = ElementType &;
using pointer = ElementType *;

MDSPAN_INLINE_FUNCTION
constexpr pointer
offset(pointer p, ptrdiff_t i) const noexcept {
constexpr pointer offset(pointer p, ptrdiff_t i) const noexcept {
return p + i;
}

Expand All @@ -70,10 +68,7 @@ struct accessor_basic {
}

MDSPAN_INLINE_FUNCTION
constexpr pointer decay(pointer p) const noexcept {
return p;
}

constexpr pointer decay(pointer p) const noexcept { return p; }
};

} // end namespace experimental
Expand Down
4 changes: 2 additions & 2 deletions src/experimental/__p0009_bits/all_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
namespace std {
namespace experimental {

struct all_type { };
struct all_type {};

_MDSPAN_INLINE_VARIABLE constexpr auto all = all_type{ };
_MDSPAN_INLINE_VARIABLE constexpr auto all = all_type{};

} // end namespace experimental
} // namespace std
372 changes: 202 additions & 170 deletions src/experimental/__p0009_bits/basic_mdspan.hpp

Large diffs are not rendered by default.

151 changes: 80 additions & 71 deletions src/experimental/__p0009_bits/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@
#define _MDSPAN_INCLUDE_EXPERIMENTAL_BITS_CONFIG_HPP_

#ifndef __has_include
# define __has_include(x) 0
#define __has_include(x) 0
#endif

#if __has_include(<version>)
# include <version>
#include <version>
#else
# include <type_traits>
# include <utility>
#include <type_traits>
#include <utility>
#endif

#define MDSPAN_CXX_STD_14 201402L
Expand All @@ -62,119 +62,128 @@
#define MDSPAN_HAS_CXX_17 (__cplusplus >= MDSPAN_CXX_STD_17)

#ifdef __apple_build_version__
# define _MDSPAN_COMPILER_APPLECLANG
#define _MDSPAN_COMPILER_APPLECLANG
#endif

#ifndef __has_cpp_attribute
# define __has_cpp_attribute(x) 0
#define __has_cpp_attribute(x) 0
#endif

#ifndef _MDSPAN_PRESERVE_STANDARD_LAYOUT
// Preserve standard layout by default, but we're not removing the old version
// that turns this off until we're sure this doesn't have an unreasonable cost
// to the compiler or optimizer.
# define _MDSPAN_PRESERVE_STANDARD_LAYOUT 1
#define _MDSPAN_PRESERVE_STANDARD_LAYOUT 1
#endif

#ifndef _MDSPAN_NO_UNIQUE_ADDRESS
# if __has_cpp_attribute(no_unique_address) >= 201803L
# define _MDSPAN_NO_UNIQUE_ADDRESS [[no_unique_address]]
# else
# define _MDSPAN_NO_UNIQUE_ADDRESS
# endif
#if __has_cpp_attribute(no_unique_address) >= 201803L
#define _MDSPAN_NO_UNIQUE_ADDRESS [[no_unique_address]]
#else
#define _MDSPAN_NO_UNIQUE_ADDRESS
#endif
#endif

#ifndef _MDSPAN_USE_CONCEPTS
# if defined(__cpp_concepts) && __cpp_concepts >= 201507L
# define _MDSPAN_USE_CONCEPTS 1
# endif
#if defined(__cpp_concepts) && __cpp_concepts >= 201507L
#define _MDSPAN_USE_CONCEPTS 1
#endif
#endif

#ifndef _MDSPAN_USE_FOLD_EXPRESSIONS
# if (defined(__cpp_fold_expressions) && __cpp_fold_expressions >= 201603L) \
|| (!defined(__cpp_fold_expressions) && MDSPAN_HAS_CXX_17)
# define _MDSPAN_USE_FOLD_EXPRESSIONS 1
# endif
#if (defined(__cpp_fold_expressions) && __cpp_fold_expressions >= 201603L) || \
(!defined(__cpp_fold_expressions) && MDSPAN_HAS_CXX_17)
#define _MDSPAN_USE_FOLD_EXPRESSIONS 1
#endif
#endif

#ifndef _MDSPAN_USE_INLINE_VARIABLES
# if defined(__cpp_inline_variables) && __cpp_inline_variables >= 201606L \
|| (!defined(__cpp_inline_variables) && MDSPAN_HAS_CXX_17)
# define _MDSPAN_USE_INLINE_VARIABLES 1
# endif
#if defined(__cpp_inline_variables) && __cpp_inline_variables >= 201606L || \
(!defined(__cpp_inline_variables) && MDSPAN_HAS_CXX_17)
#define _MDSPAN_USE_INLINE_VARIABLES 1
#endif
#endif

#ifndef _MDSPAN_NEEDS_TRAIT_VARIABLE_TEMPLATE_BACKPORTS
# if !(defined(__cpp_lib_type_trait_variable_templates) && __cpp_lib_type_trait_variable_templates >= 201510L) \
|| !MDSPAN_HAS_CXX_17
# define _MDSPAN_NEEDS_TRAIT_VARIABLE_TEMPLATE_BACKPORTS 1
# endif
#if !(defined(__cpp_lib_type_trait_variable_templates) && \
__cpp_lib_type_trait_variable_templates >= 201510L) || \
!MDSPAN_HAS_CXX_17
#define _MDSPAN_NEEDS_TRAIT_VARIABLE_TEMPLATE_BACKPORTS 1
#endif
#endif

#ifndef _MDSPAN_USE_VARIABLE_TEMPLATES
# if (defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304) \
|| (!defined(__cpp_variable_templates) && MDSPAN_HAS_CXX_14)
# define _MDSPAN_USE_VARIABLE_TEMPLATES 1
# endif
#if (defined(__cpp_variable_templates) && \
__cpp_variable_templates >= 201304) || \
(!defined(__cpp_variable_templates) && MDSPAN_HAS_CXX_14)
#define _MDSPAN_USE_VARIABLE_TEMPLATES 1
#endif
#endif // _MDSPAN_USE_VARIABLE_TEMPLATES

#ifndef _MDSPAN_USE_CONSTEXPR_14
# if (defined(__cpp_constexpr) && __cpp_constexpr >= 201304) \
|| (!defined(__cpp_constexpr) && MDSPAN_HAS_CXX_14) \
&& (!(defined(__INTEL_COMPILER) && __INTEL_COMPILER <= 1700))
# define _MDSPAN_USE_CONSTEXPR_14 1
# endif
#if (defined(__cpp_constexpr) && __cpp_constexpr >= 201304) || \
(!defined(__cpp_constexpr) && MDSPAN_HAS_CXX_14) && \
(!(defined(__INTEL_COMPILER) && __INTEL_COMPILER <= 1700))
#define _MDSPAN_USE_CONSTEXPR_14 1
#endif
#endif

#ifndef _MDSPAN_USE_INTEGER_SEQUENCE
# ifdef _MSC_VER
# if (defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304)
# define _MDSPAN_USE_INTEGER_SEQUENCE 1
# endif
# endif
#ifdef _MSC_VER
#if (defined(__cpp_lib_integer_sequence) && \
__cpp_lib_integer_sequence >= 201304)
#define _MDSPAN_USE_INTEGER_SEQUENCE 1
#endif
#endif
#endif
#ifndef _MDSPAN_USE_INTEGER_SEQUENCE
# if (defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304) \
|| (!defined(__cpp_lib_integer_sequence) && MDSPAN_HAS_CXX_14) \
/* as far as I can tell, libc++ seems to think this is a C++11 feature... */ \
|| (defined(__GLIBCXX__) && __GLIBCXX__ > 20150422 && __GNUC__ < 5 && !defined(__INTEL_CXX11_MODE__))
// several compilers lie about integer_sequence working properly unless the C++14 standard is used
# define _MDSPAN_USE_INTEGER_SEQUENCE 1
# elif defined(_MDSPAN_COMPILER_APPLECLANG) && MDSPAN_HAS_CXX_14
// appleclang seems to be missing the __cpp_lib_... macros, but doesn't seem to lie about C++14 making
// integer_sequence work
# define _MDSPAN_USE_INTEGER_SEQUENCE 1
# endif
#if (defined(__cpp_lib_integer_sequence) && \
__cpp_lib_integer_sequence >= 201304) || \
(!defined(__cpp_lib_integer_sequence) && \
MDSPAN_HAS_CXX_14) /* as far as I can tell, libc++ seems to think this is a C++11 feature... */ \
|| (defined(__GLIBCXX__) && __GLIBCXX__ > 20150422 && __GNUC__ < 5 && \
!defined(__INTEL_CXX11_MODE__))
// several compilers lie about integer_sequence working properly unless the C++14 standard is used
#define _MDSPAN_USE_INTEGER_SEQUENCE 1
#elif defined(_MDSPAN_COMPILER_APPLECLANG) && MDSPAN_HAS_CXX_14
// appleclang seems to be missing the __cpp_lib_... macros, but doesn't seem to lie about C++14 making
// integer_sequence work
#define _MDSPAN_USE_INTEGER_SEQUENCE 1
#endif
#endif

#ifndef _MDSPAN_USE_RETURN_TYPE_DEDUCTION
# ifdef _MSC_VER
# if (defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304) && MDSPAN_HAS_CXX_14
# define _MDSPAN_USE_RETURN_TYPE_DEDUCTION 1
# endif
# endif
#ifdef _MSC_VER
#if (defined(__cpp_lib_integer_sequence) && \
__cpp_lib_integer_sequence >= 201304) && \
MDSPAN_HAS_CXX_14
#define _MDSPAN_USE_RETURN_TYPE_DEDUCTION 1
#endif
#endif
#endif
#ifndef _MDSPAN_USE_RETURN_TYPE_DEDUCTION
# if (defined(__cpp_return_type_deduction) && __cpp_return_type_deduction >= 201304) \
|| (!defined(__cpp_return_type_deduction) && MDSPAN_HAS_CXX_14)
# define _MDSPAN_USE_RETURN_TYPE_DEDUCTION 1
# endif
#if (defined(__cpp_return_type_deduction) && \
__cpp_return_type_deduction >= 201304) || \
(!defined(__cpp_return_type_deduction) && MDSPAN_HAS_CXX_14)
#define _MDSPAN_USE_RETURN_TYPE_DEDUCTION 1
#endif
#endif

#ifndef _MDSPAN_USE_STANDARD_TRAIT_ALIASES
# if (defined(__cpp_lib_transformation_trait_aliases) && __cpp_lib_transformation_trait_aliases >= 201304) \
|| (!defined(__cpp_lib_transformation_trait_aliases) && MDSPAN_HAS_CXX_14)
# define _MDSPAN_USE_STANDARD_TRAIT_ALIASES 1
# elif defined(_MDSPAN_COMPILER_APPLECLANG) && MDSPAN_HAS_CXX_14
// appleclang seems to be missing the __cpp_lib_... macros, but doesn't seem to lie about C++14
# define _MDSPAN_USE_STANDARD_TRAIT_ALIASES 1
# endif
#if (defined(__cpp_lib_transformation_trait_aliases) && \
__cpp_lib_transformation_trait_aliases >= 201304) || \
(!defined(__cpp_lib_transformation_trait_aliases) && MDSPAN_HAS_CXX_14)
#define _MDSPAN_USE_STANDARD_TRAIT_ALIASES 1
#elif defined(_MDSPAN_COMPILER_APPLECLANG) && MDSPAN_HAS_CXX_14
// appleclang seems to be missing the __cpp_lib_... macros, but doesn't seem to lie about C++14
#define _MDSPAN_USE_STANDARD_TRAIT_ALIASES 1
#endif
#endif

#ifndef _MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND
# if __GNUC__ < 9
# define _MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND 1
# endif
#if __GNUC__ < 9
#define _MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND 1
#endif
#endif

#endif // _MDSPAN_INCLUDE_EXPERIMENTAL_BITS_CONFIG_HPP_
Loading

0 comments on commit 04ccbca

Please sign in to comment.