1/***************************************************************************
2 * Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and *
3 * Martin Renou *
4 * Copyright (c) QuantStack *
5 * Copyright (c) Serge Guelton *
6 * *
7 * Distributed under the terms of the BSD 3-Clause License. *
8 * *
9 * The full license is in the file LICENSE, distributed with this software. *
10 ****************************************************************************/
11
12#ifndef XSIMD_HPP
13#define XSIMD_HPP
14
15#if defined(__has_cpp_attribute)
16// if this check passes, then the compiler supports feature test macros
17#if __has_cpp_attribute(nodiscard) >= 201603L
18// if this check passes, then the compiler supports [[nodiscard]] without a message
19#define XSIMD_NO_DISCARD [[nodiscard]]
20#endif
21#endif
22
23#if !defined(XSIMD_NO_DISCARD) && __cplusplus >= 201703L
24// this means that the previous tests failed, but we are using C++17 or higher
25#define XSIMD_NO_DISCARD [[nodiscard]]
26#endif
27
28#if !defined(XSIMD_NO_DISCARD) && (defined(__GNUC__) || defined(__clang__))
29// this means that the previous checks failed, but we are using GCC or Clang
30#define XSIMD_NO_DISCARD __attribute__((warn_unused_result))
31#endif
32
33#if !defined(XSIMD_NO_DISCARD)
34// this means that all the previous checks failed, so we fallback to doing nothing
35#define XSIMD_NO_DISCARD
36#endif
37
38#ifdef __cpp_if_constexpr
39// this means that the compiler supports the `if constexpr` construct
40#define XSIMD_IF_CONSTEXPR if constexpr
41#endif
42
43#if !defined(XSIMD_IF_CONSTEXPR) && __cplusplus >= 201703L
44// this means that the previous test failed, but we are using C++17 or higher
45#define XSIMD_IF_CONSTEXPR if constexpr
46#endif
47
48#if !defined(XSIMD_IF_CONSTEXPR)
49// this means that all the previous checks failed, so we fallback to a normal `if`
50#define XSIMD_IF_CONSTEXPR if
51#endif
52
53#include "config/xsimd_config.hpp"
54
55#include "arch/xsimd_scalar.hpp"
56#include "memory/xsimd_aligned_allocator.hpp"
57
58#if defined(XSIMD_NO_SUPPORTED_ARCHITECTURE)
59// to type definition or anything appart from scalar definition and aligned allocator
60#else
61#include "types/xsimd_batch.hpp"
62#include "types/xsimd_batch_constant.hpp"
63#include "types/xsimd_traits.hpp"
64
65// This include must come last
66#include "types/xsimd_api.hpp"
67#endif
68#endif
69