// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// Copyright (C) 2020 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// This file incorporates work covered by the following copyright and permission
// notice:
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
//
//===----------------------------------------------------------------------===//

#ifndef _ONEDPL_RANGES
#define _ONEDPL_RANGES

// Workarounds for libstdc++9, libstdc++10 when new TBB version is found in the environment
#if __cplusplus >= 201703L
#    if __has_include(<tbb/version.h>)
#        ifndef PSTL_USE_PARALLEL_POLICIES
#            define PSTL_USE_PARALLEL_POLICIES (_GLIBCXX_RELEASE != 9)
#        endif
#        ifndef _GLIBCXX_USE_TBB_PAR_BACKEND
#            define _GLIBCXX_USE_TBB_PAR_BACKEND (_GLIBCXX_RELEASE > 10)
#        endif
#    endif // __has_include(<tbb/version.h>)
#endif     // __cplusplus >= 201703L

#define _ONEDPL_USE_RANGES 1
#include "oneapi/dpl/pstl/onedpl_config.h"

#include "oneapi/dpl/pstl/ranges_defs.h"

#if !_ONEDPL_ALGORITHM_RANGES_FORWARD_DECLARED
#    include "oneapi/dpl/pstl/glue_algorithm_ranges_defs.h"
#    define _ONEDPL_ALGORITHM_RANGES_FORWARD_DECLARED 1
#endif

#if !_ONEDPL_NUMERIC_RANGES_FORWARD_DECLARED
#    include "oneapi/dpl/pstl/glue_numeric_ranges_defs.h"
#    define _ONEDPL_NUMERIC_RANGES_FORWARD_DECLARED 1
#endif

#if _ONEDPL_EXECUTION_POLICIES_DEFINED
// If <execution> has already been included, pull in implementations
#    include "oneapi/dpl/pstl/glue_algorithm_ranges_impl.h"
#    include "oneapi/dpl/pstl/glue_numeric_ranges_impl.h"
#endif

#endif /* _ONEDPL_RANGES */
